[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 16:36:23 +13:00
committed by GitHub
co-authored by clydebarrow
parent 8b7e061f3a
commit a043022444
10 changed files with 7771 additions and 129 deletions
+42 -28
View File
@@ -40,25 +40,6 @@ RUN \
libcairo2=1.16.0-7 \
libmagic1=1:5.44-3 \
patch=2.7.6-7 \
&& ( \
( \
[ "$TARGETARCH$TARGETVARIANT" = "armv7" ] && \
apt-get install -y --no-install-recommends \
build-essential=12.9 \
python3-dev=3.11.2-1+b1 \
zlib1g-dev=1:1.2.13.dfsg-1 \
libjpeg-dev=1:2.1.5-2 \
libfreetype-dev=2.12.1+dfsg-5+deb12u3 \
libssl-dev=3.0.14-1~deb12u2 \
libffi-dev=3.4.4-1 \
libopenjp2-7=2.5.0-2 \
libtiff6=4.5.0-6+deb12u1 \
cargo=0.66.0+ds1-1 \
pkg-config=1.8.1-1 \
gcc-arm-linux-gnueabihf=4:12.2.0-3 \
) \
|| [ "$TARGETARCH$TARGETVARIANT" != "armv7" ] \
) \
&& rm -rf \
/tmp/* \
/var/{cache,log}/* \
@@ -97,15 +78,48 @@ RUN \
# tmpfs is for https://github.com/rust-lang/cargo/issues/8719
COPY requirements.txt requirements_optional.txt /
RUN --mount=type=tmpfs,target=/root/.cargo if [ "$TARGETARCH$TARGETVARIANT" = "armv7" ]; then \
curl -L https://www.piwheels.org/cp311/cryptography-43.0.0-cp37-abi3-linux_armv7l.whl -o /tmp/cryptography-43.0.0-cp37-abi3-linux_armv7l.whl \
&& pip3 install --break-system-packages --no-cache-dir /tmp/cryptography-43.0.0-cp37-abi3-linux_armv7l.whl \
&& rm /tmp/cryptography-43.0.0-cp37-abi3-linux_armv7l.whl \
&& export PIP_EXTRA_INDEX_URL="https://www.piwheels.org/simple"; \
fi; \
CARGO_REGISTRIES_CRATES_IO_PROTOCOL=sparse CARGO_HOME=/root/.cargo \
pip3 install \
--break-system-packages --no-cache-dir -r /requirements.txt -r /requirements_optional.txt
RUN --mount=type=tmpfs,target=/root/.cargo <<END-OF-RUN
# Fail on any non-zero status
set -e
if [ "$TARGETARCH$TARGETVARIANT" = "armv7" ]
then
curl -L https://www.piwheels.org/cp311/cryptography-43.0.0-cp37-abi3-linux_armv7l.whl -o /tmp/cryptography-43.0.0-cp37-abi3-linux_armv7l.whl
pip3 install --break-system-packages --no-cache-dir /tmp/cryptography-43.0.0-cp37-abi3-linux_armv7l.whl
rm /tmp/cryptography-43.0.0-cp37-abi3-linux_armv7l.whl
export PIP_EXTRA_INDEX_URL="https://www.piwheels.org/simple";
fi
# install build tools in case wheels are not available
BUILD_DEPS="
build-essential=12.9
python3-dev=3.11.2-1+b1
zlib1g-dev=1:1.2.13.dfsg-1
libjpeg-dev=1:2.1.5-2
libfreetype-dev=2.12.1+dfsg-5+deb12u3
libssl-dev=3.0.14-1~deb12u2
libffi-dev=3.4.4-1
libopenjp2-7=2.5.0-2
libtiff6=4.5.0-6+deb12u1
cargo=0.66.0+ds1-1
pkg-config=1.8.1-1
"
if [ "$TARGETARCH$TARGETVARIANT" = "arm64" ] || [ "$TARGETARCH$TARGETVARIANT" = "armv7" ]
then
apt-get update
apt-get install -y --no-install-recommends $BUILD_DEPS
fi
CARGO_REGISTRIES_CRATES_IO_PROTOCOL=sparse CARGO_HOME=/root/.cargo
pip3 install --break-system-packages --no-cache-dir -r /requirements.txt -r /requirements_optional.txt
if [ "$TARGETARCH$TARGETVARIANT" = "arm64" ] || [ "$TARGETARCH$TARGETVARIANT" = "armv7" ]
then
apt-get remove -y --purge --auto-remove $BUILD_DEPS
rm -rf /tmp/* /var/{cache,log}/* /var/lib/apt/lists/*
fi
END-OF-RUN
COPY script/platformio_install_deps.py platformio.ini /
RUN /platformio_install_deps.py /platformio.ini --libraries
File diff suppressed because it is too large Load Diff
+3
View File
@@ -17,6 +17,9 @@ aioesphomeapi==24.6.2
zeroconf==0.132.2
puremagic==1.27
ruamel.yaml==0.18.6 # dashboard_import
glyphsets==1.0.0
pillow==10.4.0
freetype-py==2.5.1
# esp-idf requires this, but doesn't bundle it by default
# https://github.com/espressif/esp-idf/blob/220590d599e134d7a5e7f1e683cc4550349ffbf8/requirements.txt#L24
-1
View File
@@ -1,2 +1 @@
pillow==10.4.0
cairosvg==2.7.1
+1 -1
View File
@@ -58,7 +58,7 @@ file_types = (
)
cpp_include = ("*.h", "*.c", "*.cpp", "*.tcc")
py_include = ("*.py",)
ignore_types = (".ico", ".png", ".woff", ".woff2", "", ".ttf", ".otf")
ignore_types = (".ico", ".png", ".woff", ".woff2", "", ".ttf", ".otf", ".pcf")
LINT_FILE_CHECKS = []
LINT_CONTENT_CHECKS = []
+2
View File
@@ -0,0 +1,2 @@
*.pcf -text
File diff suppressed because it is too large Load Diff
+24
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 κόσμε!");
+34
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.