This lite plugin provides a system to load multiple fonts to render different glyphs. As an example, you may specify a CJK-compatible font as fallback to render CJK characters.
This plugin only covers basic codepoints from U+0000 to U+FFFF, other codepoints are not and will not be supported. This is sufficient for most use cases.
From GitHub Actions
- Clone the repository
- run
./build.sh
(Similiar to lite) - mkdir
data/plugins/fallbackfonts
- copy
utfhelper.lua
,init.lua
and executable generated by./build.sh
to that folder
This plugin introduces a table config.fallback_fonts
that can be set in data/user/init.lua
.
config.fallback_fonts.enable = false
config.fallback_fonts.preload_range = { lower = 0, upper = 0xFF }
config.fallback_fonts.fontmap_file = path(PLUGINDIR .. "/fontmap.bin")
config.fallback_fonts.fonts = {
{ path = path(EXEDIR .. "/data/fonts/monospace.ttf"), size = 13.5 },
}
key | Usage |
---|---|
config.fallback_fonts.enable |
Self explanatory |
config.fallback_fonts.preload_range |
The range of fontmap loaded when lite starts. Defaults to the first 256 characters |
config.fallback_fonts.fontmap_file |
Where to store the fontmap file. |
config.fallback_fonts.fonts |
Table of fonts. Must contain path (path to font file) and either size (size in pt) or pixel_size (size in pixels). The plugin tries the fonts from the end of table to the start; the first font is the fallback. |
- On first launch, you will be prompted to generate a fontmap. Generate it.
Make sure you don't generate fontmap on multiple lite instances - that will most likely corrupt the fontmap.
- You are good to go.
Caret and selection don't work. I may consider working on them but it won't be that easy.fixed.IME selection box does not show up. This is a bug from lite and should be worked on there instead.A bug with SDL2.Anything related to mouse does not work correctly.fixed.- The caret just doesn't want to work properly with multi-byte sequences. It just doesn't like it. I need help fixing this.