Skip to content

Fix Source Sans 3 semibold text rendering at regular weight in HTML reports - #8

Merged
MsShawnP merged 2 commits into
mainfrom
fix/source-sans-semibold
Oct 2, 2026
Merged

MsShawnP merged 2 commits into
mainfrom
fix/source-sans-semibold

Conversation

@MsShawnP

@MsShawnP MsShawnP commented Oct 2, 2026

Copy link
Copy Markdown
Collaborator

What was wrong

Every generated HTML report embeds Source Sans 3 as a static Regular (400) file, but the @font-face rule declared it as covering weights 400 700. The browser drew 600 and 700 text with the Regular letters, with no bolding, so every semibold and bold label in the report rendered at regular weight.

The fix

  • datascope/reports/html.py: declare the Regular file at 400 only, and embed a real SemiBold (600) file (Source Sans 3 latin subset from Fontsource 5.3.0, OFL-1.1). Requests for 700 now resolve to SemiBold.
  • Playfair Display is untouched. It's a variable font covering 400–900, so its 400 700 range was already correct.
  • package-data already ships *.woff2 from datascope.reports.fonts, so the new file goes out with the package.
  • Second commit: the two HTML samples, regenerated with the pinned SOURCE_DATE_EPOCH. Only the @font-face rules change.

How it was checked

  • pytest: 388 passed. test_samples_fidelity fails after the first commit, as expected, and passes after the regenerated samples.
  • Chromium, opening the committed sample report before and after:
Weight Before After
400 348 px 348 px
600 348 px 358.7 px
700 348 px 358.7 px

Each report gets about 21 KB bigger from the embedded SemiBold file. PyPI users get the fix with the next release.

Same bug as lailarallc/gtin-validator#15.

🤖 Generated with Claude Code

https://claude.ai/code/session_01TUVDB6LFekgeeT15QWuQYW


Generated by Claude Code

claude added 2 commits October 2, 2026 21:37
…eports

The embedded Source Sans 3 font is a static Regular (400) file, but the
@font-face rule declared it as covering weights 400-700. Browsers then drew
600 and 700 text with the Regular glyphs and no bolding, so every semibold
and bold label in a generated HTML report rendered at 400.

Declare the Regular file at 400 only and embed a real SemiBold (600) file
(Source Sans 3 latin subset from Fontsource 5.3.0, OFL-1.1). Requests for
700 now resolve to SemiBold. Playfair Display is a variable font covering
400-900, so its 400-700 range is unchanged. package-data already ships
*.woff2 from datascope.reports.fonts.

The committed HTML samples are regenerated in the next commit.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TUVDB6LFekgeeT15QWuQYW
Regenerated with SOURCE_DATE_EPOCH=1790726400, the value in
scripts/regenerate_samples.sh, so only the @font-face rules change. Only the
two HTML samples are affected: the PDF and annotated Excel outputs don't use
the HTML font rules. test_samples_fidelity passes again (388 passed).

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TUVDB6LFekgeeT15QWuQYW
@MsShawnP
MsShawnP merged commit 1c7d2e0 into main Oct 2, 2026
3 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.

2 participants