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

[font] Add support for "glyphsets" (#7429)

Co-authored-by: clydebarrow <2366188+clydebarrow@users.noreply.github.com>
This commit is contained in:
Faidon Liambotis
2024-10-31 05:36:23 +02:00
committed by GitHub
parent 8b7e061f3a
commit a043022444
10 changed files with 7771 additions and 129 deletions

2
tests/components/font/.gitattributes vendored Normal file
View File

@@ -0,0 +1,2 @@
*.pcf -text

File diff suppressed because it is too large Load Diff

View File

@@ -1,4 +1,12 @@
font:
- file:
type: gfonts
family: "Roboto"
weight: bold
italic: true
size: 32
id: roboto32
- file: "gfonts://Roboto"
id: roboto
size: 20
@@ -9,6 +17,10 @@ font:
- file: "gfonts://Roboto"
id: roboto_web
size: 20
- file: "gfonts://Roboto"
id: roboto_greek
size: 20
glyphs: ["\u0300", "\u00C5", "\U000000C7"]
- file: "https://github.com/IdreesInc/Monocraft/releases/download/v3.0/Monocraft.ttf"
id: monocraft
size: 20
@@ -20,6 +32,17 @@ font:
- file: $component_dir/Monocraft.ttf
id: monocraft3
size: 28
- file: $component_dir/MatrixChunky8X.bdf
id: special_font
glyphs:
- '"'
- "'"
- '#$%&()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz°'
- file: $component_dir/MatrixChunky8X.bdf
id: default_font
- file: $component_dir/x11.pcf
id: pcf_font
i2c:
scl: ${i2c_scl}
@@ -36,3 +59,4 @@ display:
it.print(0, 40, id(monocraft), "Hello, World!");
it.print(0, 60, id(monocraft2), "Hello, World!");
it.print(0, 80, id(monocraft3), "Hello, World!");
it.print(0, 100, id(roboto_greek), "Hello κόσμε!");

View File

@@ -1,4 +1,12 @@
font:
- file:
type: gfonts
family: "Roboto"
weight: bold
italic: true
size: 32
id: roboto32
- file: "gfonts://Roboto"
id: roboto
size: 20
@@ -9,6 +17,10 @@ font:
- file: "gfonts://Roboto"
id: roboto_web
size: 20
- file: "gfonts://Roboto"
id: roboto_greek
size: 20
glyphs: ["\u0300", "\u00C5", "\U000000C7"]
- file: "https://github.com/IdreesInc/Monocraft/releases/download/v3.0/Monocraft.ttf"
id: monocraft
size: 20
@@ -20,4 +32,26 @@ font:
- file: $component_dir/Monocraft.ttf
id: monocraft3
size: 28
- file: $component_dir/MatrixChunky8X.bdf
id: special_font
glyphs:
- '"'
- "'"
- '#$%&()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz°'
- file: $component_dir/MatrixChunky8X.bdf
id: default_font
display:
- platform: sdl
id: sdl_display
dimensions:
width: 800
height: 600
lambda: |-
it.print(0, 0, id(roboto), "Hello, World!");
it.print(0, 20, id(roboto_web), "Hello, World!");
it.print(0, 40, id(roboto_greek), "Hello κόσμε!");
it.print(0, 60, id(monocraft), "Hello, World!");
it.print(0, 80, id(monocraft2), "Hello, World!");
it.print(0, 100, id(monocraft3), "Hello, World!");

Binary file not shown.