lite-xl does not provide a convenient way to use fonts on the system. There is literally _different APIs for the each platforms we support (Windows, Linux and Mac). This is where fontconfig comes to our rescue. fontconfig is installable on a lot of OSes.
lite-xl has a fontconfig plugin that we can use to find system fonts.
mingw-w64-fontconfig provides a build that can be used directly on Windows. Download the file, extract it to somewhere and (optionally) add it to the PATH.
Check your distro-specific instructions.
# ubuntu / debian apt install fontconfig # arch pacman -Su fontconfig # fedora dnf install fontconfig ...
brew install fontconfig
local fontconfig = require "plugins.fontconfig" fontconfig.use { font = { name = "sans", size = 13 * SCALE }, code_font = { name = "monospace", size = 13 * SCALE } }
"sans"
and "monospace"
can be any fontconfig syntax. (check "Font Names")
Note that the font might not load immediately (because we need to wait for fc-match
to return.
If you want that, replace fontconfig.use
with fontconfig.use_blocking
. Doing this will force
lite-xl to wait for fc-match
, which can be much slower.