Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A bunch of typo fixes and similar stuff #105

Merged
merged 3 commits into from
Mar 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions doc/font_spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand All @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions lib/font/compress.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion lib/writers/lvgl/lv_font.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}
}

Expand Down
8 changes: 4 additions & 4 deletions web/content.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div class="row" style="margin-bottom:48px;">
<div class="col-md-8 col-md-offset-2">
<p>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).</p>
<p>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).</p>

<p>The font converter is designed to be compatible with <a href="https://lvgl.io" title="Open-source Embedded GUI Library">LVGL</a> but with minor modification you can make it compatible with other graphics libraries.</p>

Expand All @@ -13,14 +13,14 @@ <h3>How to use the font converter?</h3>
<li>Set the <strong>bpp</strong> (bit-per-piel). Higher value results smoother (anti-aliased) font</li>
<li>Choose a <strong>TTF or WOFF font</strong></li>
<li>Set a <strong>range</strong> of Unicode character to include in your font or list the characters in the <strong>Symbols</strong> field</li>
<li>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.</li>
<li>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.</li>
<li>Click the <strong>Convert</strong> button to download the result C file.</li>
</ol>

<h3>How to use the generated fonts in LVGL?</h3>
<ol>
<li>Copy the result C file into your LVGL project</li>
<li>In a C file of your application declare the font as: <code class="code-inline">extern lv_font_t my_font_name;</code>
<li>In a C file of your application declare the font as: <code class="code-inline">extern const lv_font_t my_font_name;</code>
or simply <code class="code-inline">LV_FONT_DECLARE(my_font_name);</code></li>
<li>Set the font in a style: <code class="code-inline">style.text.font = &amp;my_font_name;</code> </li>
</ol>
Expand All @@ -31,7 +31,7 @@ <h3>How to use the generated fonts in LVGL?</h3>
<div class="col-md-9 col-md-offset-2">
<form id="converterForm" enctype="multipart/form-data" name="font_conv" style="padding:12px; border-radius:4px; border-style:solid; border-width:2px; border-color:#7babda">

<!-- GENERAL PARAMTERS -->
<!-- GENERAL PARAMETERS -->

<div class="form-group row">
<label for="name" class="form-label col-md-2">Name</label>
Expand Down
2 changes: 1 addition & 1 deletion web/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>LittlevGL font converter</title>
<title>LVGL font converter</title>
<script
src="https://code.jquery.com/jquery-3.4.1.min.js"
integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo="
Expand Down
Loading