1
0
mirror of https://github.com/esphome/esphome.git synced 2025-09-02 03:12:20 +01:00

font: add anti-aliasing and other features (#6198)

* Pack glyph bits

* Use unsigned chars for unicode strings.

* Implement multi-bit glyphs

* clang-format

* Allow extra glyphs to be added to a font

* Allow .otf and .woff file extensions

* Add printf versions with background color;
Add tests

* Whitespace...

* Move font test to new framework

* CI fix

* CI fix

* CODEOWNERS

* File extensions tested as case-insensitive
This commit is contained in:
Clyde Stubbs
2024-03-11 20:03:39 +11:00
committed by GitHub
parent 11b31483c3
commit e4df422798
8 changed files with 282 additions and 113 deletions

View File

@@ -0,0 +1,27 @@
font:
- file: "gfonts://Roboto"
id: roboto
size: 20
glyphs: "0123456789."
extras:
- file: "gfonts://Roboto"
glyphs: ["\u00C4", "\u00C5", "\U000000C7"]
spi:
clk_pin: 14
mosi_pin: 13
display:
- id: my_display
platform: ili9xxx
dimensions: 480x320
model: ST7796
cs_pin: 15
dc_pin: 21
reset_pin: 22
transform:
swap_xy: true
mirror_x: true
mirror_y: true
auto_clear_enabled: false

View File

@@ -52,6 +52,11 @@ spi_device:
mode: 3
bit_order: lsb_first
font:
- file: "gfonts://Roboto"
id: roboto
size: 20
display:
- platform: ili9xxx
id: displ8
@@ -61,6 +66,8 @@ display:
reset_pin:
number: GPIO48
allow_other_uses: true
lambda: |-
it.printf(10, 100, id(roboto), Color(0x123456), COLOR_OFF, display::TextAlign::BASELINE, "%f", id(heap_free).state);
i2c:
scl: GPIO18
@@ -85,6 +92,7 @@ binary_sensor:
sensor:
- platform: debug
free:
id: heap_free
name: "Heap Free"
block:
name: "Max Block Free"