From 593f745c0169128ed72c5effaf9aa4d65f3f1b2d Mon Sep 17 00:00:00 2001 From: Faidon Liambotis Date: Thu, 31 Oct 2024 05:36:26 +0200 Subject: [PATCH] [font] Add documentation for glyphsets (#4245) --- components/font.rst | 34 +++++++++++++++++++++++++++++++--- 1 file changed, 31 insertions(+), 3 deletions(-) diff --git a/components/font.rst b/components/font.rst index 1a800bdb1f..7de652a6b5 100644 --- a/components/font.rst +++ b/components/font.rst @@ -71,6 +71,16 @@ Next, create a ``font:`` section in your configuration: "\U000F05D4", # mdi-airplane-landing ] + - file: + type: gfonts + family: Roboto + id: roboto_european_core + size: 16 + glyphsets: + - GF_Latin_Core + - GF_Greek_Core + - GF_Cyrillic_Core + - file: "https://github.com/IdreesInc/Monocraft/releases/download/v3.0/Monocraft.ttf" id: web_font size: 20 @@ -124,9 +134,26 @@ Configuration variables: If you want to use the same font in different sizes, create two font objects. Note: *size* is ignored by bitmap fonts. Defaults to ``20``. - **bpp** (*Optional*, int): The bit depth of the rendered font from OpenType/TrueType, for anti-aliasing. Can be ``1``, ``2``, ``4``, ``8``. Defaults to ``1``. -- **glyphs** (*Optional*, list): A list of characters you plan to use. Only the characters you specify - here will be compiled into the binary. Adjust this if you need some special characters or want to - reduce the size of the binary if you don't plan to use some glyphs. You can also specify glyphs by their codepoint (see below). Defaults to ``!"%()+=,-_.:°/?0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz``. +- **glyphsets** (*Optional*, list): A list of glyphsets you plan to use. Defaults to + ``GF_Latin_Kernel``, which contains the basic characters and necessary punctuation and symbols for + the English language. ``GF_Latin_Core`` is a more extended set that includes glyphs for the + languages of Europe and the Americas with over 5 million speakers. Other options include + ``GF_Arabic_Core``, ``GF_Cyrillic_Core``, ``GF_Greek_Core``, their ``Plus`` variants, as well as + ``GF_Latin_African``, ``GF_Latin_PriAfrican`` and ``GF_Latin_Vietnamese``. + See the `Google Fonts Glyphset documentation `_ + for an extensive list of all possible sets, along with their names and the languages supported by + each of those sets. Note that ``GF_Latin_Kernel`` may need to be included for glyphs for basic + characters such as numbers (0-9) and whitespace to be present. +- **glyphs** (*Optional*, list): A list of characters you plan to use, in addition to the characters + defined by the **glyphsets** option above. Adjust this list if you need some special characters or + want to reduce the size of the binary if you don't plan to use certain glyphs. Both single + characters (``a, b, c``) or strings of characters (``abc, def``) are acceptable options. You can + also specify glyphs by their codepoint (see below). +- **ignore_missing_glyphs** (*Optional*, boolean): By default, warnings are generated for any glyph + that is included in the defined **glyphsets** but not present in the configured font. Use this + setting to suppress those warnings. Please note that the absence of any manually defined glyphs + (specified via the **glyphs** option) will always be treated as an error and will not be influenced + by this setting. - **extras** (*Optional*, enum): A list of font glyph configurations you'd like to include within this font, from other OpenType/TrueType files (eg. icons from other font, but at the same size as the main font): - **file** (**Required**, string): The path of the font file with the extra glyphs. @@ -159,4 +186,5 @@ See Also - :doc:`/components/lvgl/index` - `MDI cheatsheet `_ - `MDI font repository `_ +- `Google Fonts Glyphsets `_ - :ghedit:`Edit`