diff --git a/docs/cmake-functions.md b/docs/cmake-functions.md index 3b2c381..0efdb20 100644 --- a/docs/cmake-functions.md +++ b/docs/cmake-functions.md @@ -337,7 +337,8 @@ The following variables should be set before calling `dmod_add_executable` or `d - `DMOD_COMPRESSION_METHOD` - Compression method for DMFC files (default: "fastlz") - `DMOD_ASSETS_PATHS` - List of directories with the sources of a module's assets (views, images, fonts). When set, they are converted into `DMOD_VIEWS_DIR` (default: `/views`) by the `dmod_assets` target, which the module depends on - with tools `dmf-get` downloads at configure time, only for the kinds of files found: - `*.dmvs` views - `todmv` - `.dmv`; - - images (`DMOD_IMAGE_EXTENSIONS`, default `png jpg jpeg jpe jfif bmp qoi gif tif tiff`) - `todmvi` with the `dmimg` decoder of each extension (`dmimg_png`, `dmimg_jpeg` for `.jpg`, ...; `DMOD_IMAGE_DECODERS` overrides the list) - `.dmvi`, next to the views, so a view finds them by name. An optional `.ini` next to an image (`logo.png.ini`) sets its conversion: `format` (`auto`, `rgb565`, `rgb565a8`, `argb8888`, `i8`, `a8`, `a4`), `size` (`WIDTHxHEIGHT`, scaled down to fit), `compression` (`fastlz`, `none`), `dither` (`on`/`off`). Keys before any section apply to every output; each `[section]` is an output `
.dmvi` of its own (e.g. `[logo]` and `[logo-mask]` from one image). - fonts (`DMOD_FONT_EXTENSIONS`, default `ttf otf ttc`) - `todmvf` - `.dmvf`, next to the views. A font needs its `.ini` (`Roboto-Regular.ttf.ini`), as a font is made for one pixel size: each `[section]` is an output `
.dmvf` with its `size` (pixel size, `4` ... `127`, required) and optional `chars` (codepoint ranges, e.g. `0x20-0x7E,0x104`; default: printable ASCII, Latin-1, Latin Extended-A). A font without an `.ini` is left out with a warning. + - images (`DMOD_IMAGE_EXTENSIONS`, default `png jpg jpeg jpe jfif bmp qoi gif tif tiff`) - `todmvi` with the `dmimg` decoder of each extension (`dmimg_png`, `dmimg_jpeg` for `.jpg`, ...; `DMOD_IMAGE_DECODERS` overrides the list) - `.dmvi`, next to the views, so a view finds them by name. An optional `.ini` next to an image (`logo.png.ini`) sets its conversion: `format` (`auto`, `rgb565`, `rgb565a8`, `argb8888`, `i8`, `a8`, `a4`), `size` (`WIDTHxHEIGHT`, scaled down to fit), `compression` (`fastlz`, `none`), `dither` (`on`/`off`). Keys before any section apply to every output; each `[section]` is an output `
.dmvi` of its own (e.g. `[logo]` and `[logo-mask]` from one image). + - fonts (`DMOD_FONT_EXTENSIONS`, default `ttf otf ttc`) - `todmvf` - `.dmvf`, next to the views. A font needs its `.ini` (`Roboto-Regular.ttf.ini`), as a font is made for one pixel size: each `[section]` is an output `
.dmvf` with its `size` (pixel size, `4` ... `127`, required) and optional `chars` (codepoint ranges, e.g. `0x20-0x7E,0x104`; default: printable ASCII, Latin-1, Latin Extended-A) and `tracking` (letter spacing added to every advance, in pixels, e.g. `-2.4`, like CSS `letter-spacing`). A font without an `.ini` is left out with a warning. Two sources of one output name are a configuration error. diff --git a/scripts/CMakeLists.txt b/scripts/CMakeLists.txt index e1d5209..47f9d08 100644 --- a/scripts/CMakeLists.txt +++ b/scripts/CMakeLists.txt @@ -213,6 +213,8 @@ endfunction() # size = pixel size (em), 4 ... 127 - required # chars = codepoint ranges, e.g. 0x20-0x7E,0x104 (default: printable # ASCII, Latin-1, Latin Extended-A) +# tracking = letter spacing added to every advance, pixels, e.g. -2.4 +# (CSS letter-spacing; default 0) # # Related variables: # DMOD_VIEWS_DIR output directory of the converted assets @@ -296,8 +298,13 @@ function(_dmod_font_option iniPath key value outVar) set(ARGS "") if(key STREQUAL "chars") set(ARGS -c ${value}) + elseif(key STREQUAL "tracking") + if(NOT value MATCHES "^[-+]?[0-9]+(\\.[0-9]+)?$") + message(SEND_ERROR "${iniPath}: tracking must be a number of pixels, e.g. -2.4 (got '${value}')") + endif() + set(ARGS -t ${value}) else() - message(SEND_ERROR "${iniPath}: unknown key '${key}' (size, chars)") + message(SEND_ERROR "${iniPath}: unknown key '${key}' (size, chars, tracking)") endif() set(${outVar} "${ARGS}" PARENT_SCOPE) endfunction()