Commit 093c6ed4 authored by bzt's avatar bzt

Fixed formating

parent 2f637012
......@@ -147,7 +147,7 @@ or provided by libc.
That's all, no more dependencies. :-)
******************************************************************************
## Load Fonts
```c
int ssfn_load(ssfn_t *ctx, ssfn_font_t *font);
......@@ -155,7 +155,7 @@ int ssfn_load(ssfn_t *ctx, ssfn_font_t *font);
Loads a font into the renderer context.
## Parameters
### Parameters
| Parameter | Description |
| --------- | ----------- |
......@@ -165,12 +165,12 @@ Loads a font into the renderer context.
You can load an SSFN file and pass it's address, or you can also use `ld -b binary` to convert an SSFN file
into an object and link that with your code. In this case you'll have a `_binary_(filename)_start` label.
## Return value
### Return value
Error code. `SSFN_ERR_BADFILE` means bad (incorrect or inconsistent) SSFN format. Hint: use `sfn2asc -d` to
debug what's wrong with it.
******************************************************************************
## Select Face
```c
int ssfn_select(ssfn_t *ctx, int family, char *name, int style, int size, int mode);
......@@ -183,7 +183,7 @@ of bounding box and the baseline is scaled. In other words, if you set `size` to
you'll get an exatly 32 pixel tall 'A', see Font Metrics above. Passing `SSFN_STYLE_ABS_SIZE`
will scale the glyph's height to `size`. This is also the default for monospace fonts.
## Parameters
### Parameters
| Parameter | Description |
| --------- | ----------- |
......@@ -224,12 +224,12 @@ Parameter defines:
| `SSFN_MODE_ALPHA` | rasterize glyph as an alpha channel, 1 byte for each pixel |
| `SSFN_MODE_CMAP` | rasterize in color map mode, 1 byte for each pixel (see `SSFN_CMAP_TO_RGBA()` macro) |
## Return value
### Return value
Error code. `SSFN_ERR_NOFACE` returned if no font could be found, otherwise `SSFN_ERR_BADx` refers to
the invalid argument.
******************************************************************************
## Convert UTF-8 to UNICODE
```c
uint32_t ssfn_utf8(char **str);
......@@ -239,17 +239,17 @@ Decodes an UTF-8 multibyte character. Be careful, this function does not check i
valid and points to a string with only valid UTF-8 sequences. The behaviour with invalid input is undefined. All
the other functions check for valid input, this is an exception.
## Parameters
### Parameters
| Parameter | Description |
| --------- | ----------- |
| str | pointer to a UTF-8 string pointer |
## Return value
### Return value
UNICODE code point, and `str` pointer adjusted to the next multibyte sequence.
******************************************************************************
## Render a Glyph
```c
ssfn_glyph_t *ssfn_render(ssfn_t *ctx, uint32_t unicode);
......@@ -261,14 +261,14 @@ character, then the renderer will look for the best style match to figure out wh
you've asked for a specific font with `SSFN_FAMILY_BYNAME`. If there's no font for the requested style,
then the renderer will mimic bold or italic.
## Parameters
### Parameters
| Parameter | Description |
| ----------- | ----------- |
| ctx | pointer to the renderer's context |
| unicode | UNICODE code point of the character to be rendered (see `ssfn_utf8()`) |
## Return value
### Return value
Returns `NULL` on error (and you can get the error code with `ssfn_lasterr(ctx)`. On success, it returns a newly
allocated `ssfn_glyph_t` structure.
......@@ -297,7 +297,7 @@ decode the data can be found in [modes.md](https://gitlab.com/bztsrc/scalable-fo
I suggest to store the returned glyph in a cache. Once you've done with it, you can free the glyph with a
standard libc `free()` call, no special treatment needed.
******************************************************************************
## Kerning
```c
int ssfn_kern(ssfn_t *ctx, uint32_t unicode, uint32_t nextunicode, int *x, int *y);
......@@ -309,7 +309,7 @@ to get valid results. For this purpose, you can pass `SSFN_MODE_NONE` to the ren
`SSFN_FAMILY_BYNAME` to select exactly one font, and then you don't have to call ssfn_render). If
the character or the kerning pair not found, `x`and `y` will be left unchanged.
## Parameters
### Parameters
| Parameter | Description |
| ----------- | ----------- |
......@@ -319,11 +319,11 @@ the character or the kerning pair not found, `x`and `y` will be left unchanged.
| x | pointer to a signed integer, relative coordinate in pixels |
| y | pointer to a singed integer, relative coordinate in pixels |
## Return value
### Return value
Error code, and relative kerning offsets adjusted to `x` and `y`.
******************************************************************************
## Get Memory Usage
```c
int ssfn_mem(ssfn_t *ctx);
......@@ -338,17 +338,17 @@ The contour coordinates are internally stored on 2 bytes, with 4096 x 4096 grid
(12 + 4 bits). Rasterization and hinting also use 2 bytes per pixel, but in a 256 x 256 grid and 0 - 255
precision (8 + 8 bits), and there's a separate raster line for each row.
## Parameters
### Parameters
| Parameter | Description |
| ----------- | ----------- |
| ctx | pointer to the renderer's context |
## Return value
### Return value
Total memory consumed in bytes.
******************************************************************************
## Free Memory
```c
void ssfn_free(ssfn_t *ctx);
......@@ -356,17 +356,17 @@ void ssfn_free(ssfn_t *ctx);
Destructor of the renderer context. Frees all internal buffers and clears the context.
## Parameters
### Parameters
| Parameter | Description |
| --------- | ----------- |
| ctx | pointer to the renderer's context |
## Return value
### Return value
None.
******************************************************************************
## Error Handling
```c
int ssfn_lasterr(ssfn_t *ctx)
......@@ -375,17 +375,16 @@ int ssfn_lasterr(ssfn_t *ctx)
Returns the error code for the last error occured. Passing a NULL to this function results in
an undefined behaviour, because it's implemented as a macro.
## Parameters
### Parameters
| Parameter | Description |
| --------- | ----------- |
| ctx | pointer to the renderer's context |
## Return value
### Return value
The error code or `SSFN_OK` if there was no error.
******************************************************************************
```c
const char *ssfn_error(int errcode)
......@@ -393,17 +392,16 @@ const char *ssfn_error(int errcode)
Returns the human readable string equivalent of an error code in English. Also implemented as a macro.
## Parameters
### Parameters
| Parameter | Description |
| --------- | ----------- |
| errcode | error code |
## Return value
### Return value
Pointer to a string constant. `SSFN_OK` returns an empty string, not NULL nor "Success".
******************************************************************************
Simple Renderer Function
------------------------
......@@ -416,7 +414,7 @@ on one font only, can't scale or dynamically style the glyph, and it can only ha
about baseline, but it handles advances. For these limitations in return it does not allocate memory at all, has
exactly zero dependency and compiles to about 1 kilobyte.
******************************************************************************
## Render a Glyph
```c
int ssfn_putc(uint32_t unicode);
......@@ -425,7 +423,7 @@ int ssfn_putc(uint32_t unicode);
Render a character to screen. Unlike the functions in the normal renderer, this function does not check its input,
passing invalid parameters results in an undefined behaviour. This is as simple as it gets.
## Parameters
### Parameters
| Parameter | Description |
| --------- | ----------- |
......@@ -451,7 +449,7 @@ The define selects the destination buffer's pixel format. `SSFN_CONSOLEBITMAP_PA
(indexed), `SSFN_CONSOLEBITMAP_HICOLOR` selects 2 bytes (5-5-5 or 5-6-5 RGB) and `SSFN_CONSOLEBITMAP_TRUECOLOR`
selects 4 bytes (8-8-8-8 xRGB). For performance reasons, 3 bytes (24 bit true color) mode is not supported.
## Return value
### Return value
Either `SSFN_OK`, `SSFN_ERR_NOGLYPH` or `SSFN_ERR_INVINP` (when the character would be displayed out of screen). On
success it modifies `ssfn_dst_x`, `ssfn_dst_y`, `ssfn_adv_x` and `ssfn_adv_y`.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment