Skip to content

Fix weather icons and emoji not rendering on e-ink device (#23)#24

Open
mochlast wants to merge 2 commits into
usetrmnl:mainfrom
mochlast:fix/eink-weather-icons-and-emoji
Open

Fix weather icons and emoji not rendering on e-ink device (#23)#24
mochlast wants to merge 2 commits into
usetrmnl:mainfrom
mochlast:fix/eink-weather-icons-and-emoji

Conversation

@mochlast

@mochlast mochlast commented Jun 11, 2026

Copy link
Copy Markdown

Fixes the weather icons (and, while at it, emoji) being invisible on the physical e-ink device although they show correctly in the designer preview. Reported in #23 (firmware 1.7.8, v0.4.0). Both issues are verified fixed on a real device.

1. Weather icons missing on device

generateWeatherContent() embedded the raw SVG primitives returned by getWeatherIconSvg() (<circle>, <ellipse>, <line>, …) directly into an HTML <div>, without an enclosing <svg> element. Browsers only render SVG primitives inside an <svg>, so on the Puppeteer device-render path the icon produced no pixels — while the frontend designer preview (WidgetRenderer.tsx's WeatherIcon, which uses a proper <svg> wrapper) showed it fine. The sibling battery/wifi widgets already wrap their icons correctly; weather was the outlier.

  • Wrap the icon markup in a sized <svg ... viewBox> element (matching the battery/wifi pattern).
  • Add font-family to the snow glyph <text> elements for robust rendering.

2. Emoji vanish on device

Color emoji (e.g. via fonts-noto-color-emoji) render bright/yellow, which the grayscale + Floyd-Steinberg pass pushes above the white threshold (140) → they turn white and disappear on the device, while showing in the browser preview.

  • Swap the color emoji font for the monochrome Symbola font (fonts-symbola, the monochrome emoji/symbol font available in Debian trixie) and list it as a per-glyph fallback in mapFontFamily(), so emoji render as black glyphs that survive dithering. No widget-content changes needed.
  • Trade-off: emoji are now rendered monochrome instead of in color — which is the desired behaviour for a 1-bit e-ink display anyway.

Testing

Built and deployed to a real TRMNL device (firmware 1.7.8): the weather forecast icons now render, and the in a text/custom widget now shows as a black glyph.

image

Closes #23

🤖 Generated with Claude Code

mochlast and others added 2 commits June 11, 2026 14:17
The device render path (renderDesignAsHtml -> Puppeteer ->
generateWeatherContent) embedded the raw SVG primitives returned by
getWeatherIconSvg() directly into an HTML <div>, without an enclosing
<svg> element. Browsers only render SVG primitives inside an <svg>, so
the weather icon was invisible on the device while still showing in the
frontend designer preview (which uses a proper <svg> wrapper).

Wrap the icon markup in a sized <svg> element (matching the existing
battery/wifi widget pattern) and add font-family to the snow glyphs for
robust text rendering.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Color emoji (e.g. ⚡ rendered via fonts-noto-color-emoji) turn bright in
the grayscale + Floyd-Steinberg pass and end up above the white threshold,
so they vanish on the device while showing in the browser preview.

Swap the color emoji font for the monochrome Symbola font and list it as a
per-glyph fallback in mapFontFamily, so emoji render as black glyphs that
survive dithering. No widget content changes needed.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Weather icons not showing on actual device

1 participant