Home

Awesome

fallbackfonts

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.

Get this plugin

From GitHub Actions

Installation

  1. Clone the repository
  2. run ./build.sh (Similiar to lite)
  3. mkdir data/plugins/fallbackfonts
  4. copy utfhelper.lua, init.lua and executable generated by ./build.sh to that folder

Configuration

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 },
}
keyUsage
config.fallback_fonts.enableSelf explanatory
config.fallback_fonts.preload_rangeThe range of fontmap loaded when lite starts. Defaults to the first 256 characters
config.fallback_fonts.fontmap_fileWhere to store the fontmap file.
config.fallback_fonts.fontsTable 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.

Usage

Make sure you don't generate fontmap on multiple lite instances - that will most likely corrupt the fontmap.

Known issues