lcd.font¶
since 1.1.0
Get / Set the current font.
Parameters¶
| Name | Type | Required | Description |
|---|---|---|---|
font |
integer | yes | one of the available fonts (FONT_M, FONT_M_BOLD, FONT_M_ITALIC, FONT_XS, FONT_XS_BOLD, FONT_S, FONT_L, FONT_L_BOLD, FONT_XL, FONT_XXL) |
Returns¶
font (integer)
Examples¶
Pick a font from the widget's height so it scales across screen layouts:
local function fontFor(h)
if h >= 120 then return FONT_XXL elseif h >= 70 then return FONT_XL
elseif h >= 40 then return FONT_L else return FONT_S end
end
local function paint(widget)
local w, h = lcd.getWindowSize()
lcd.font(fontFor(h))
-- ...
end
All font constants are under Fonts.
Used in¶
- Battery gauge widget
- Timer control
- Telemetry value widget
- lazy-loading
- widget-flvss
- widget-gauge
- widget-jet
- widget-lcddemo
- widget-rssi
- xxxxl
Real-world usage¶
Called 323 times across 11 open-source Ethos Lua projects. A few short excerpts: