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
eg-overlay-ui
module.
Default Fonts#
EG-Overlay comes with 3 default fonts:
Regular: Inter
Monospace: Cascadia Code
Each of the above fonts are initialized with default values and can be accessed
in a fonts
table on the eg-overlay-ui
module as regular
,
monospace
, and icon
.
local ui = require 'eg-overlay-ui'
local regfont = ui.fonts.regular
local monofont = ui.fonts.monospace
local iconfont = ui.fonts.icon
Functions#
- eg-overlay-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 'eg-overlay-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
:0
for outlined or1
for filled iconsGRAD
: grade, similar towght
opsz
: optical sizewght
: weight
Version History
Version
Notes
0.3.0
Added
Classes#
- class eg-overlay-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
uitext
elements.- 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
uifont
based on this font with a different size.Version History
Version
Notes
0.3.0
Added