Repository navigation
Vendor Liberation Sans as the default figure font - #1
Merged
Merged
Conversation
…fonts Publication figures should not depend on the commercial, Mac-only Barthel brand fonts (Basic Sans / Bicyclette): they can't be redistributed with the repo or the manuscript, and off the author's Mac they silently fell back to DejaVu Sans, so the 'official' figure and any reproduced figure differed. Ship a free, embeddable, Arial-metric font instead: Liberation Sans (SIL OFL 1.1) now lives in karyoplot/data/fonts and is registered from package data via core.fonts.register_vendored_fonts(), so every consumer renders identically on any host. mpl.style.apply_default_style sets font.family = ['Liberation Sans', 'DejaVu Sans'] (DejaVu kept for Greek/subscript glyphs), and pil_font defaults to it for raster output. The Barthel fonts remain an explicit opt-in via register_fonts (with a $BARTHEL_FONT_DIR override) but are no longer the default. pyproject force-includes the ttf/txt so they ship in the wheel (verified). Adds tests for vendored registration, packaging, pil_font, and the style default. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
Why
Publication figures shouldn't depend on the commercial, Mac-only Barthel brand fonts (Basic Sans / Bicyclette): they can't be redistributed with the repo or the manuscript, and off the author's Mac they silently fell back to DejaVu Sans — so the "official" figure and any reproduced figure differed. That undercuts the manuscript-reproducibility goal.
What
src/karyoplot/data/fonts/(4 TTFs + LICENSE + AUTHORS).core.fonts.register_vendored_fonts()registers it from package data → identical rendering on any host.mpl.style.apply_default_style→font.family = ["Liberation Sans", "DejaVu Sans"](DejaVu kept for Greek/subscript glyphs);pil_fontdefaults to Liberation Sans for raster output.register_fonts(with a$BARTHEL_FONT_DIRoverride), just no longer the default.pyproject.tomlforce-includes the font files — verified present in a built wheel.Tests
148 pass (new tests: vendored registration, package-data presence,
pil_fontdefault,apply_default_stylefamily); ruff clean.🤖 Generated with Claude Code