From bbe13830cab89da4ff49bcb97b776f7e1fecfb8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=2E=20Neusch=C3=A4fer?= Date: Thu, 21 Mar 2024 10:58:25 +0100 Subject: [PATCH 1/3] web/content.html: Add 'const' to suggested declaration --- web/content.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/content.html b/web/content.html index 7dcfaa8..d9cb7ed 100644 --- a/web/content.html +++ b/web/content.html @@ -20,7 +20,7 @@

How to use the font converter?

How to use the generated fonts in LVGL?

  1. Copy the result C file into your LVGL project
  2. -
  3. In a C file of your application declare the font as: extern lv_font_t my_font_name; +
  4. In a C file of your application declare the font as: extern const lv_font_t my_font_name; or simply LV_FONT_DECLARE(my_font_name);
  5. Set the font in a style: style.text.font = &my_font_name;
From 65a2cedfc215e845d4590454bd929f9ad14c699c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=2E=20Neusch=C3=A4fer?= Date: Thu, 21 Mar 2024 10:57:26 +0100 Subject: [PATCH 2/3] Fix a few typos --- README.md | 2 +- doc/font_spec.md | 4 ++-- lib/font/compress.js | 4 ++-- web/content.html | 6 +++--- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index fea2803..7e74ddc 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ npx lv_font_conv -h npx github:lvgl/lv_font_conv -h ``` -Note, runing via `npx` may take some time until modules installed, be patient. +Note, running via `npx` may take some time until modules installed, be patient. ## CLI params diff --git a/doc/font_spec.md b/doc/font_spec.md index a8357b9..91a7863 100644 --- a/doc/font_spec.md +++ b/doc/font_spec.md @@ -302,7 +302,7 @@ spec. Glyph data uses modified RLE compression - [I3BN](https://thesai.org/Downloads/Volume7No7/Paper_34-New_modified_RLE_algorithms.pdf), with prefilter and tuned options. Everything works with "pixels" (groups of 2, 3, 4 or 8 bits). That will not work -for bitonal fonts, but those are small enougth. +for bitonal fonts, but those are small enough. Notable compression gain starts with ~30px sizes. That's explained by 2 moments: @@ -326,7 +326,7 @@ enough and more effective than diff: That helps to pass anti-aliasing pixels without size increase. 2. First 10 repeats are replaced with `1` bit (`0` - end). 3. Next (11-th) is followed by 6-bit counter. If counter overflows, max possible - value used, and process starts from begining (1). + value used, and process starts from beginning (1). See [I3BN](https://thesai.org/Downloads/Volume7No7/Paper_34-New_modified_RLE_algorithms.pdf) for initial idea and images. diff --git a/lib/font/compress.js b/lib/font/compress.js index aa30a3a..2bf2bd8 100644 --- a/lib/font/compress.js +++ b/lib/font/compress.js @@ -15,7 +15,7 @@ function count_same(arr, offset) { } // -// Compress pixels with RLE-like algorythm (modified I3BN) +// Compress pixels with RLE-like algorithm (modified I3BN) // // 1. Require minimal repeat count (1) to enter I3BN mode // 2. Increased 1-bit-replaced repeat limit (2 => 10) @@ -35,7 +35,7 @@ module.exports = function compress(bitStream, pixels, options) { const RLE_COUNTER_BITS = 6; // (2^bits - 1) - max value const RLE_COUNTER_MAX = (1 << RLE_COUNTER_BITS) - 1; - // Force flush if counter dencity exceeded. + // Force flush if counter density exceeded. const RLE_MAX_REPEATS = RLE_COUNTER_MAX + RLE_BIT_COLLAPSED_COUNT + 1; //let bits_start_offset = bitStream.index; diff --git a/web/content.html b/web/content.html index d9cb7ed..81faf6f 100644 --- a/web/content.html +++ b/web/content.html @@ -1,6 +1,6 @@
-

With this free online font converter tool you can create C array from any TTF or WOFF font. You can select ranges of Unicode characters and speficy the bpp (bit-per-pixel).

+

With this free online font converter tool you can create C array from any TTF or WOFF font. You can select ranges of Unicode characters and specify the bpp (bit-per-pixel).

The font converter is designed to be compatible with LVGL but with minor modification you can make it compatible with other graphics libraries.

@@ -13,7 +13,7 @@

How to use the font converter?

  • Set the bpp (bit-per-piel). Higher value results smoother (anti-aliased) font
  • Choose a TTF or WOFF font
  • Set a range of Unicode character to include in your font or list the characters in the Symbols field
  • -
  • Optionally choose and other font too and specify the ranges and/or symbols for it as well. The characters will be merged into the final C file.
  • +
  • Optionally choose another font too and specify the ranges and/or symbols for it as well. The characters will be merged into the final C file.
  • Click the Convert button to download the result C file.
  • @@ -31,7 +31,7 @@

    How to use the generated fonts in LVGL?

    - +
    From bc784327d73c99133b1972416b80f9c132592575 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=2E=20Neusch=C3=A4fer?= Date: Sat, 23 Mar 2024 08:00:44 +0100 Subject: [PATCH 3/3] Change remaining instances of "LittlevGL" to "LVGL" --- README.md | 4 ++-- lib/writers/lvgl/lv_font.js | 2 +- web/index.html | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 7e74ddc..92f4094 100644 --- a/README.md +++ b/README.md @@ -49,7 +49,7 @@ Common: - `--format` - output format. - `--format dump` - dump glyph images and font info, useful for debug. - `--format bin` - dump font in binary form (as described in [spec](https://github.com/lvgl/lv_font_conv/blob/master/doc/font_spec.md)). - - `--format lvgl` - dump font in [LittlevGL](https://github.com/lvgl/lvgl) format. + - `--format lvgl` - dump font in [LVGL](https://github.com/lvgl/lvgl) format. - `--force-fast-kern-format` - always use more fast kering storage format, at cost of some size. If size difference appears, it will be displayed. - `--lcd` - generate bitmaps with 3x horizontal resolution, for subpixel @@ -111,7 +111,7 @@ adds compression support. ### Supported output formats 1. **bin** - universal binary format, as described in https://github.com/lvgl/lv_font_conv/tree/master/doc. -2. **lvgl** - format for LittlevGL, C file. Has minor limitations and a bit +2. **lvgl** - format for LVGL, C file. Has minor limitations and a bit bigger size, because C does not allow to effectively define relative offsets in data blocks. 3. **dump** - create folder with each glyph in separate image, and other font diff --git a/lib/writers/lvgl/lv_font.js b/lib/writers/lvgl/lv_font.js index 8a14620..9d64622 100644 --- a/lib/writers/lvgl/lv_font.js +++ b/lib/writers/lvgl/lv_font.js @@ -30,7 +30,7 @@ class LvFont extends Font { } if (options.bpp === 3 & options.no_compress) { - throw new AppError('LittlevGL supports "--bpp 3" with compression only'); + throw new AppError('LVGL supports "--bpp 3" with compression only'); } } diff --git a/web/index.html b/web/index.html index 45e3aab..edf2b44 100644 --- a/web/index.html +++ b/web/index.html @@ -3,7 +3,7 @@ - LittlevGL font converter + LVGL font converter