Repository navigation
Fix Source Sans 3 semibold text rendering at regular weight in HTML reports - #8
Merged
Merged
Conversation
…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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What was wrong
Every generated HTML report embeds Source Sans 3 as a static Regular (400) file, but the
@font-facerule declared it as covering weights400 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 at400only, 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.400 700range was already correct.package-dataalready ships*.woff2fromdatascope.reports.fonts, so the new file goes out with the package.SOURCE_DATE_EPOCH. Only the@font-facerules change.How it was checked
pytest: 388 passed.test_samples_fidelityfails after the first commit, as expected, and passes after the regenerated samples.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