Skip to content

R15: serve the brand's Arabic and figure fonts from the agent (Dubai left out: its licence forbids it) - #68

Merged
kaboomAE merged 6 commits into
mainfrom
claude/friendly-kepler-db1a51
Sep 25, 2026
Merged

kaboomAE merged 6 commits into
mainfrom
claude/friendly-kepler-db1a51

Conversation

@kaboomAE

Copy link
Copy Markdown
Owner

Closes #59 (R15), with the owner's condition applied: Dubai's licence was read first, and it does not allow this. The agent ships Lateef and IBM Plex Mono only.

Dubai: the licence, and why it is left out

The web files in smarthome-planner/assets/fonts/dartec-dubai-*.woff2 are Monotype's Dubai W23 build: name table "Copyright © 2017 Dubai Executive Council. All rights reserved", with no licence URL. I did not use the copies in C:\Windows\Fonts. Their licence is the End User Licence Agreement – Dubai Font from The Executive Council of Dubai ("TEC"). I read the full text as published at fontsquirrel.com/license/dubai; dubaifont.com has no licence page of its own. The relevant clauses:

  • Redistribution: not permitted.
    • 2.2 grants "a limited, non-exclusive, non-transferable, non-sublicensable, non-assignable and revocable licence … for the Licensee's own personal or internal business purposes only".
    • 3.1(d): "not to rent, lease, sub-license, loan, translate, merge, adapt, vary, alter, modify, commercially exploit or further distribute (whether commercially or otherwise), the whole or any part of the Font Software".
    • 3.1(i): "not to provide, or otherwise make available, the Font Software in any form, in whole or in part … to any person without the prior written consent of TEC".
  • Embedding in software: only in a secure form that cannot be extracted.
    • 2.2(c) covers Applications: "in a secure manner which does not allow an End User to access the Font Software outside of the Application or permit the extraction or installation of the embedded Font Software". It also excludes "any Application that is a server component in a client/server architecture".
    • 2.2(e) covers websites ("Digital Products"): "in a secure manner which does not allow an End User to access the Font Software outside of the Digital Product".
  • Modification, subsetting included: not permitted. 3.1(d) above ("adapt, vary, alter, modify"), and 3.1(f): no "derivative works based on the whole or any part of the Font Software".
  • 8.7: TEC may change the terms at any time, and they take effect when published on the Dubai Font website.

A public repository publishes the files to anyone, so Dubai is out.

What Dubai would need: TEC's written consent under 3.1(i), requested per clause 8.1 at info@dubaifont.com, covering redistribution in a public repository and delivery to customers' browsers as a web font. Serving it from the private manager instead doesn't clearly avoid the problem: a font file sent to a browser can be saved, which 2.2(e) doesn't allow.

What ships

File Weight Source Licence
Lateef-Regular/Medium/Bold.woff2 400 / 500 / 600–700 SIL Lateef 4.400, byte-identical to google/fonts ofl/lateef OFL-Lateef.txt
IBMPlexMono-Medium-Latin1.woff2 500 IBM's own file, @ibm/plex-mono 2.5.0 (matches the npm tarball's sha512) OFL-IBMPlexMono.txt

About 290 KB, in www/fonts/, served from the existing /dartec_branding static path.

I did not use the planner's web files for these fonts either. Both licences reserve names: Lateef reserves "Lateef" and "SIL", and IBM reserves "Plex". Under OFL condition 3, "No Modified Version of the Font Software may use the Reserved Font Name(s)". OFL FAQ 2.6 answers "Is subsetting a webfont considered modification?" with "Yes".

  • The storefront's dartec-lateef-*-ar.woff2 are subsets Dartec made (1,386 of 1,830 glyphs).
  • dartec-plex-mono.woff2 is a 280-glyph subset matching none of IBM's builds.
  • Both keep the reserved names.

The agent ships unmodified fonts instead:

  • Lateef: SIL's TTFs compressed to WOFF2 and nothing else, which OFL FAQ 2.2.1 allows under the original name. Decompressed again, every table is identical except head, where WOFF2 itself sets flag bit 11 ("lossless transformation") and the checksum.
  • Plex Mono: IBM's own web file.

Provenance and hashes are in www/fonts/README.md.

Code

  • dashboard-fix.js declares the faces on the document using the bench rules from dartec-variants/README.md#fonts, verbatim except for Dubai.
    • Lateef: size-adjust: 150% and unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF.
    • Plex Mono: weight 500.
    • It is a separate IIFE and does nothing if it fails. A browser only fetches these fonts when a theme names the families, and Lateef only when there is Arabic on the page.
  • branding.py registers dashboard-fix.js?v=<content hash>. The static path is served with max-age=2678400 (31 days), so until now a new version of this module could take a month to reach an open browser. That applied to the Dwains fixes too.
  • Tests:
    • tests/test_fonts.py pins each file to its recorded hash and licence, pins the 150% and Arabic-only rules, and fails if any Dubai font file appears in the repository. I confirmed that last check trips when such a file is present.
    • run_live_dwains.py gains check_fonts: in real HA, each file must be served byte-identical as font/woff2, and in Firefox and Chromium, Lateef 400/700 and Plex Mono 500 must load, with Lateef Arabic-only at 150% and no Dubai face. Its fix-blocking route now matches the ?v= URL.
    • Locally: 729 unit tests pass, and run_live_dwains.py 2026.9.3 passed in 401 s.

For the theme (kaboomAE/dartec-theme, not changed here)

Once this is released, the Dartec themes should set:

ha-font-family-body: "'Dartec Lateef', system-ui, Roboto, sans-serif"
ha-font-family-heading: "'Dartec Lateef', system-ui, Roboto, sans-serif"
ha-font-family-code: "'Dartec Plex Mono', 'IBM Plex Mono', ui-monospace, monospace"

The drafts name 'Dartec Dubai' first. That's harmless, since browsers skip an undeclared face, but it names a font that won't exist without TEC's consent.

Bench proof (BENCH Pi 192.168.1.51, location "TEST", HA 2026.9.3)

  • Method: the corrected Dartec theme draft with the stack above, applied in the test browser only (as bench-tools/vshot.py does). The only thing that changed between runs was the agent:
    • Before: v0.23.0, as found.
    • After: this branch at commit e95f7bd, installed through HACS by exact ref, then an HA restart.
  • Result: Arabic pages fetched Lateef-Regular.woff2 and Lateef-Medium.woff2 from the agent (200, font/woff2) and both loaded. English pages, and a dashboard with no Arabic text, fetched nothing.
  • Restored: the agent went back to v0.23.0 with another restart.
    • HACS reports v0.23.0 installed.
    • dashboard-fix.js is served without ?v=.
    • /dartec_branding/fonts/ returns 404.
    • Every call is logged in bench-tools/changes.jsonl.
  • The theme picker reads "Dartec" only in the after shots. Another session's theme test set that account's theme preference between my runs. Both runs render the same in-browser theme.

Arabic detail, before (system Arabic) and after (Lateef at 150%):
Arabic detail

Profile page, tablet, English and Arabic, light and dark:
Profile

Bedroom dashboard, phone:
Bedroom

Not in this PR

No version bump and no release. Agent changes reach homes only through a HACS release with guarded rollout, and that needs the owner's OK.

🤖 Generated with Claude Code

R15 (#59), approved on condition that Dubai's licence allows it. It does
not: TEC's EULA licenses Dubai for internal use only and forbids further
distribution or making it available to anyone without TEC's written
consent (2.2, 3.1(d), 3.1(i)), and this repository is public. So the
agent ships Lateef and IBM Plex Mono only.

Both are unmodified, because both reserve their names and the OFL does
not let a subset keep one. Lateef is SIL's 4.400 TTF (byte-identical to
google/fonts) compressed to WOFF2 and nothing else; Plex Mono is IBM's
own Latin-1 web file from @ibm/plex-mono 2.5.0. Each ships with its OFL.
The storefront's subsets are not used.

dashboard-fix.js declares the faces on the document with the rules
proven on the bench: Lateef Arabic only at size-adjust 150%, Plex Mono
500. A browser fetches them only where a theme names these families.

dashboard-fix.js is now registered with a content-hash cache buster: the
static path is cached for 31 days, so an update could otherwise take a
month to reach an open browser.

tests/test_fonts.py pins the shipped files to their recorded hashes and
licences and fails if a Dubai file appears; the live Dwains runner checks
the fonts load in Firefox and Chromium in real Home Assistant.
@kaboomAE
kaboomAE merged commit 96bd529 into main Sep 25, 2026
30 checks passed
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.

Dashboards R15: Serve Dartec's brand fonts from the agent: Lateef for Arabic, Dubai for Latin, Plex Mono

1 participant