Skip to content

Vendor Liberation Sans as the default figure font - #1

Merged
tbenavi1 merged 1 commit into
mainfrom
vendored-liberation-sans-font
Jul 24, 2026
Merged

tbenavi1 merged 1 commit into
mainfrom
vendored-liberation-sans-font

Conversation

@tbenavi1

Copy link
Copy Markdown
Member

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

  • Vendor Liberation Sans (SIL OFL 1.1, metric-compatible with Arial) into 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_font defaults to Liberation Sans for raster output.
  • Barthel fonts remain an explicit opt-in via register_fonts (with a $BARTHEL_FONT_DIR override), just no longer the default.
  • pyproject.toml force-includes the font files — verified present in a built wheel.

Tests

148 pass (new tests: vendored registration, package-data presence, pil_font default, apply_default_style family); ruff clean.

🤖 Generated with Claude Code

…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>
@tbenavi1
tbenavi1 merged commit f59c5fd into main Jul 24, 2026
8 of 9 checks passed
@tbenavi1
tbenavi1 deleted the vendored-liberation-sans-font branch July 24, 2026 16:49
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