Fonts#
EG-Overlay uses FreeType2 to render font glyphs on screen. This means that any font that FreeType2 supports can be used, however, module authors are encouraged to use the default fonts detailed below.
Fonts can be accessed using the getfont() function in the
ui module.
Default Fonts#
EG-Overlay comes with 4 default fonts:
Regular and Italic: Inter
Monospace: Cascadia Code
Each of the above fonts are initialized with default values and can be accessed
in a fonts table on the ui module as regular,
monospace, and icon.
local ui = require 'ui'
local regfont = ui.fonts.regular
local italfont = ui.fonts.italic
local monofont = ui.fonts.monospace
local iconfont = ui.fonts.icon
Functions#
- ui.getfont(path, size[, vars])#
Get a font.
If the font hasn’t been loaded yet, it will be initialized first.
- Parameters:
- Return type:
Example#local ui = require 'ui' local bold = ui.getfont('path/to/font.tff', 14, {wght = 900})
Note
Variables supported will differ for each font. Some fonts will not support variables at all.
Unspecified, unsupported font variables or invalid values will be ignored and be given default values.
Inter, the regular default font supports the following variables:
slnt: slantwght: weight
CascadeCode, the monospace default font supports the following variables:
wght: weight
Google Material Design Icons, the icon default font supports the following variables:
FILL:0for outlined or1for filled iconsGRAD: grade, similar towghtopsz: optical sizewght: weight
Version History
Version
Notes
0.3.0
Added
Classes#
- class ui.uifont#
A font with a unique combination of size and font variables.
A font is used to render text within the overlay and is most commonly used with
uitextelements.- path()#
Return the path of the font file this font was created from.
This exists mostly for debugging purposes.
- Return type:
Version History
Version
Notes
0.3.0
Added
- tosize(newsize)#
Create a new
uifontbased on this font with a different size.Version History
Version
Notes
0.3.0
Added