Skip to content

MCU: Add support for font rendering from TrueType fonts loaded from memory #4250

@tronical

Description

@tronical

A few times in the past the desire has come up to be able to support a wider range of languages with Slint on MCUs, without pre-rendering a large amount of glyphs ahead of time or embedding an entire TrueType font in regular flash space (most recently in #4149 ).

We could add a feature among the following lines to address this:

  • Add a slint/sdcard-fonts feature that enables dependencies to embedded_sdmmc and fat32 (or similar crates)
  • When this feature is enabled, we also enable dependencies to fontdue or some other rasteriser, and ttf-parser.
  • Finally, at run-time we could look for the first .ttf file on an SD card (if inserted), read the cmap/hmtx/os2/etc. tables to cache basic font metrics, and then on a per-glyph basis cache glyph metrics and renderered glyphs on the heap on-demand.

On MCUs that are equipped with enough RAM, like an STM32H7 for example, this might be a reasonable solution to better support multiple languages.

In the same context, it might make sense to add the ability to load translations off of the same SD-Card - see also #3715

Metadata

Metadata

Assignees

No one assigned

    Labels

    a:textText rendering, fonts, Text input (mS,bF)rfcRequest for comments: proposals for changes

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions