Skip to content

feat: add Font Awesome Free icons + Google Fonts resolver preset; fix… - #5

Merged
eigger merged 1 commit into
mainfrom
feat/fontawesome-icons-and-license-fix
Jul 1, 2026
Merged

feat: add Font Awesome Free icons + Google Fonts resolver preset; fix…#5
eigger merged 1 commit into
mainfrom
feat/fontawesome-icons-and-license-fix

Conversation

@eigger

@eigger eigger commented Jul 1, 2026

Copy link
Copy Markdown
Owner

… third-party licensing

Licensing fixes (see conversation review)

  • Remove fonts/ppb.ttf: origin/license could not be verified, a real risk for a font shipped in a published PyPI package.
  • Add NOTICE + LICENSE-APACHE-2.0: the rendering engine (registry dispatch + element handlers) was originally adapted from OpenEPaperLink's Home Assistant Integration (imagegen module, Apache-2.0) and has since been substantially rewritten/extended. Apache-2.0 Section 4 requires this attribution to travel with derivative works, regardless of how much the code has since changed.
  • pyproject license -> "MIT AND Apache-2.0" (SPDX expression, PEP 639); the wheel now ships LICENSE/LICENSE-APACHE-2.0/NOTICE under dist-info/licenses, verified by a CI build-step assertion.
  • Document bundled-asset licenses (MDI: Apache-2.0, Noto Sans KR: OFL-1.1) with full license texts co-located next to each asset.

New: Font Awesome Free as a second icon set

  • icon/rich_text/legend now accept "fa:name" (auto solid > regular > brands), or a forced style via "fas:"/"far:"/"fab:" — alongside the existing "mdi:" default (unchanged, backward compatible).
  • Bundled: fontawesome-free-{solid,regular,brands}.otf + a metadata file trimmed from upstream's icons.json (name/codepoint/styles/aliases only; 149 KB vs the 4.5 MB raw file) via the new scripts/build_fontawesome_assets.py (dev tool, not shipped). Only Free-tier icons are included.
  • Licensed under SIL OFL 1.1 (fonts) / CC BY 4.0 (icons); full text bundled at icons/LICENSE-FONTAWESOME and referenced from NOTICE.
  • media.py gains a single resolve_icon(value, icons_dir, size) dispatcher used by icon/rich_text/legend, replacing three separate mdi_char/mdi_font call sites.

New: google_fonts_resolver preset in imagespec.resolvers

  • A caching_resolver preset over GOOGLE_FONTS_SOURCES — verified OFL-1.1 download URLs (google/fonts repo's ofl/ directory) for scripts the bundled Noto Sans KR doesn't cover: Japanese, Simplified/Traditional Chinese, Arabic, Thai, plus a broader Latin/Cyrillic/Greek family. Downloads once, caches to disk, same as caching_resolver — avoids bundling more fonts by default (keeps the wheel lean, avoids re-litigating font licenses per addition).

Tests: 128 passing (was 97) — new coverage for FA icon resolution (auto-style, forced-style, aliases, error paths), resolver presets, and existing regression tests updated to not depend on the removed ppb.ttf.

Verified: full wheel build inspected directly — new assets and license files land in the right places (dist-info/licenses/ vs package data), scripts/ ships in the sdist only (dev tool, not installed), twine check passes.

… third-party licensing

Licensing fixes (see conversation review)
- Remove fonts/ppb.ttf: origin/license could not be verified, a real risk for
  a font shipped in a published PyPI package.
- Add NOTICE + LICENSE-APACHE-2.0: the rendering engine (registry dispatch +
  element handlers) was originally adapted from OpenEPaperLink's Home
  Assistant Integration (imagegen module, Apache-2.0) and has since been
  substantially rewritten/extended. Apache-2.0 Section 4 requires this
  attribution to travel with derivative works, regardless of how much the
  code has since changed.
- pyproject `license` -> "MIT AND Apache-2.0" (SPDX expression, PEP 639); the
  wheel now ships LICENSE/LICENSE-APACHE-2.0/NOTICE under dist-info/licenses,
  verified by a CI build-step assertion.
- Document bundled-asset licenses (MDI: Apache-2.0, Noto Sans KR: OFL-1.1)
  with full license texts co-located next to each asset.

New: Font Awesome Free as a second icon set
- icon/rich_text/legend now accept "fa:name" (auto solid > regular > brands),
  or a forced style via "fas:"/"far:"/"fab:" — alongside the existing "mdi:"
  default (unchanged, backward compatible).
- Bundled: fontawesome-free-{solid,regular,brands}.otf + a metadata file
  trimmed from upstream's icons.json (name/codepoint/styles/aliases only;
  149 KB vs the 4.5 MB raw file) via the new scripts/build_fontawesome_assets.py
  (dev tool, not shipped). Only Free-tier icons are included.
- Licensed under SIL OFL 1.1 (fonts) / CC BY 4.0 (icons); full text bundled
  at icons/LICENSE-FONTAWESOME and referenced from NOTICE.
- media.py gains a single resolve_icon(value, icons_dir, size) dispatcher used
  by icon/rich_text/legend, replacing three separate mdi_char/mdi_font call
  sites.

New: google_fonts_resolver preset in imagespec.resolvers
- A caching_resolver preset over GOOGLE_FONTS_SOURCES — verified OFL-1.1
  download URLs (google/fonts repo's ofl/ directory) for scripts the bundled
  Noto Sans KR doesn't cover: Japanese, Simplified/Traditional Chinese,
  Arabic, Thai, plus a broader Latin/Cyrillic/Greek family. Downloads once,
  caches to disk, same as caching_resolver — avoids bundling more fonts by
  default (keeps the wheel lean, avoids re-litigating font licenses per addition).

Tests: 128 passing (was 97) — new coverage for FA icon resolution (auto-style,
forced-style, aliases, error paths), resolver presets, and existing regression
tests updated to not depend on the removed ppb.ttf.

Verified: full wheel build inspected directly — new assets and license files
land in the right places (dist-info/licenses/ vs package data), scripts/ ships
in the sdist only (dev tool, not installed), twine check passes.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@eigger
eigger merged commit e3ee30c into main Jul 1, 2026
5 checks passed
@eigger
eigger deleted the feat/fontawesome-icons-and-license-fix branch July 1, 2026 00:09
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.

1 participant