Skip to content

Commit

Permalink
[font] Add documentation for glyphsets (#4245)
Browse files Browse the repository at this point in the history
  • Loading branch information
paravoid authored Oct 31, 2024
1 parent 4f3a859 commit 593f745
Showing 1 changed file with 31 additions and 3 deletions.
34 changes: 31 additions & 3 deletions components/font.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 <https://github.com/googlefonts/glyphsets/blob/main/GLYPHSETS.md>`_
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.
Expand Down Expand Up @@ -159,4 +186,5 @@ See Also
- :doc:`/components/lvgl/index`
- `MDI cheatsheet <https://pictogrammers.com/library/mdi/>`_
- `MDI font repository <https://github.com/Pictogrammers/pictogrammers.github.io/tree/main/%40mdi/font/>`_
- `Google Fonts Glyphsets <https://github.com/googlefonts/glyphsets/blob/main/GLYPHSETS.md>`_
- :ghedit:`Edit`

0 comments on commit 593f745

Please sign in to comment.