{"id":18301391,"url":"https://github.com/lvgl/lv_font_conv","last_synced_at":"2025-04-05T04:12:46.174Z","repository":{"id":40246191,"uuid":"176873129","full_name":"lvgl/lv_font_conv","owner":"lvgl","description":"Converts TTF/WOFF fonts to compact bitmap format","archived":false,"fork":false,"pushed_at":"2024-04-04T20:46:38.000Z","size":2924,"stargazers_count":151,"open_issues_count":6,"forks_count":65,"subscribers_count":12,"default_branch":"master","last_synced_at":"2024-04-13T21:41:48.223Z","etag":null,"topics":["c","conveter","font","lvgl","ttf","woff"],"latest_commit_sha":null,"homepage":" https://lvgl.io/tools/fontconverter","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lvgl.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":"support/Dockerfile","governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-03-21T05:00:20.000Z","updated_at":"2024-06-20T19:04:38.114Z","dependencies_parsed_at":"2023-02-08T06:01:29.580Z","dependency_job_id":"3222adbb-5aff-41b4-bb8d-3649fe4df77e","html_url":"https://github.com/lvgl/lv_font_conv","commit_stats":{"total_commits":240,"total_committers":11,"mean_commits":"21.818181818181817","dds":"0.30000000000000004","last_synced_commit":"968adde4d1d6e01af18774ce83e51da119cf5d91"},"previous_names":[],"tags_count":23,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lvgl%2Flv_font_conv","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lvgl%2Flv_font_conv/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lvgl%2Flv_font_conv/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lvgl%2Flv_font_conv/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lvgl","download_url":"https://codeload.github.com/lvgl/lv_font_conv/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247284951,"owners_count":20913704,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["c","conveter","font","lvgl","ttf","woff"],"created_at":"2024-11-05T15:15:54.743Z","updated_at":"2025-04-05T04:12:46.149Z","avatar_url":"https://github.com/lvgl.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"lv_font_conv - font convertor to compact bitmap format\n======================================================\n\n[![CI](https://github.com/lvgl/lv_font_conv/workflows/CI/badge.svg?branch=master)](https://github.com/lvgl/lv_font_conv/actions)\n[![NPM version](https://img.shields.io/npm/v/lv_font_conv.svg?style=flat)](https://www.npmjs.org/package/lv_font_conv)\n\nConverts TTF/WOFF/OTF fonts to __[compact format](https://github.com/lvgl/lv_font_conv/blob/master/doc/font_spec.md)__, suitable for small embedded systems. Main features are:\n\n- Allows bitonal and anti-aliased glyphs (1-4 bits per pixel).\n- Preserves kerning info.\n- Compression.\n- Users can select required glyphs only (subsetting).\n- Multiple font sources can be merged.\n- Simple CLI interface, easy to integrate into external build systems.\n\n\n## Install the script\n\n[node.js](https://nodejs.org/en/download/) v14+ required.\n\nGlobal install of the last version, execute as \"lv_font_conv\"\n\n```sh\n# install release from npm registry\nnpm i lv_font_conv -g\n# install from github's repo, master branch\nnpm i lvgl/lv_font_conv -g\n```\n\n**run via [npx](https://www.npmjs.com/package/npx) without install**\n\n```sh\n# run from npm registry\nnpx lv_font_conv -h\n# run from github master\nnpx github:lvgl/lv_font_conv -h\n```\n\nNote, running via `npx` may take some time until modules installed, be patient.\n\n\n## CLI params\n\nCommon:\n\n- `--bpp` - bits per pixel (antialiasing).\n- `--size` - output font size (pixels).\n- `-o`, `--output` - output path (file or directory, depends on format).\n- `--format` - output format.\n  - `--format dump` - dump glyph images and font info, useful for debug.\n  - `--format bin` - dump font in binary form (as described in [spec](https://github.com/lvgl/lv_font_conv/blob/master/doc/font_spec.md)).\n  - `--format lvgl` - dump font in [LVGL](https://github.com/lvgl/lvgl) format.\n- `--force-fast-kern-format` - always use more fast kering storage format,\n  at cost of some size. If size difference appears, it will be displayed.\n- `--lcd` - generate bitmaps with 3x horizontal resolution, for subpixel\n  smoothing.\n- `--lcd-v` - generate bitmaps with 3x vertical resolution, for subpixel\n  smoothing.\n- `--use-color-info` - try to use glyph color info from font to create\n  grayscale icons. Since gray tones are emulated via transparency, result\n  will be good on contrast background only.\n- `--lv-include` - only with `--format lvgl`, set alternate path for `lvgl.h`.\n- `--no-compress` - disable built-in RLE compression.\n- `--no-prefilter` - disable bitmap lines filter (XOR), used to improve\n  compression ratio.\n- `--byte-align` - pad the line ends of the bitmaps to a whole byte (requires `--no-compress` and `--bpp != 3`)\n- `--no-kerning` - drop kerning info to reduce size (not recommended).\n\nPer font:\n\n- `--font` - path to font file (ttf/woff/woff2/otf). May be used multiple time for\n  merge.\n- `-r`, `--range` - single glyph or range + optional mapping, belongs to\n  previously declared `--font`. Can be used multiple times. Examples:\n  - `-r 0x1F450` - single value, dec or hex format.\n  - `-r 0x1F450-0x1F470` - range.\n  - `-r '0x1F450=\u003e0xF005'` - single glyph with mapping.\n  - `-r '0x1F450-0x1F470=\u003e0xF005'` - range with mapping.\n  - `-r 0x1F450 -r 0x1F451-0x1F470` - 2 ranges.\n  - `-r 0x1F450,0x1F451-0x1F470` - the same as above, but defined with single `-r`.\n- `--symbols` - list of characters to copy (instead of numeric format in `-r`).\n  - `--symbols 0123456789.,` - extract chars to display numbers.\n- `--autohint-off` - do not force autohinting (\"light\" is on by default).\n- `--autohint-strong` - use more strong autohinting (will break kerning).\n\nAdditional debug options:\n- `--full-info` - don't shorten 'font_info.json' (include pixels data).\n\n\n## Examples\n\nMerge english from Roboto Regular and icons from Font Awesome, and show debug\ninfo:\n\n`env DEBUG=* lv_font_conv --font Roboto-Regular.ttf -r 0x20-0x7F --font FontAwesome.ttf -r 0xFE00=\u003e0x81 --size 16 --format bin --bpp 3 --no-compress -o output.font`\n\nMerge english \u0026 russian from Roboto Regular, and show debug info:\n\n`env DEBUG=* lv_font_conv --font Roboto-Regular.ttf -r 0x20-0x7F -r 0x401,0x410-0x44F,0x451 --size 16 --format bin --bpp 3 --no-compress -o output.font`\n\nDump all Roboto glyphs to inspect icons and font details:\n\n`lv_font_conv --font Roboto-Regular.ttf -r 0x20-0x7F --size 16 --format dump --bpp 3 -o ./dump`\n\n**Note**. Option `--no-compress` exists temporary, to avoid confusion until LVGL\nadds compression support.\n\n\n## Technical notes\n\n### Supported output formats\n\n1. **bin** - universal binary format, as described in https://github.com/lvgl/lv_font_conv/tree/master/doc.\n2. **lvgl** - format for LVGL, C file. Has minor limitations and a bit\n   bigger size, because C does not allow to effectively define relative offsets\n   in data blocks.\n3. **dump** - create folder with each glyph in separate image, and other font\n   data as `json`. Useful for debug.\n\n### Merged font metrics\n\nWhen multiple fonts merged into one, sources can have different metrics. Result\nwill follow principles below:\n\n1. No scaling. Glyphs will have exactly the same size, as intended by font authors.\n2. The same baseline.\n3. `OS/2` metrics (`sTypoAscender`, `sTypoDescender`, `sTypoLineGap`) will be\n   used from the first font in list.\n4. `hhea`  metrics (`ascender`, `descender`), defined as max/min point of all\n   font glyphs, are recalculated, according to new glyphs set.\n\n\n## Development\n\nCurrent package includes WebAssembly build of FreeType with some helper\nfunctions. Everything is wrapped into Docker and requires zero knowledge about\nadditional tools install. See `package.json` for additional commands. You may\nneed those if decide to upgrade FreeType or update helpers.\n\nThis builds image with emscripten \u0026 freetype, usually should be done only once:\n\n```\nnpm run build:dockerimage\n```\n\nThis compiles helpers and creates WebAssembly files:\n\n```\nnpm run build:freetype\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flvgl%2Flv_font_conv","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flvgl%2Flv_font_conv","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flvgl%2Flv_font_conv/lists"}