Skip to content

Fix not specifying a default PDF font - #442

Open
stuij wants to merge 1 commit into
ARM-software:mainfrom
stuij:fix-glyphs
Open

stuij wants to merge 1 commit into
ARM-software:mainfrom
stuij:fix-glyphs

Conversation

@stuij

@stuij stuij commented Oct 20, 2026

Copy link
Copy Markdown
Member

We currently don't specify what font we should use for the PDF documents, and so we use a fallback font. But it depends on your specific environment which font is picked.

This doesn't just impact the look of the text. Some fonts don't have glyphs for certain characters. For example Verdana on MacOs doesn't have glyphs for →, ⊂ and ⊆.

This was because stdFont and stdBold were not defined in the stylesheet. So we set those to DejaVu Sans, which is what we use in CI, which fixes the above problems.

@smithp35 smithp35 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One small comment on validating the path, but otherwise LGTM. Our SVG files look to be using DejaVuSans.

# Use matplotlib's bundled font dir as we can't trust the standard host paths
# to contain the font we want.
FONT_DIR="$(python3 -c 'from pathlib import Path; import matplotlib; print(Path(matplotlib.get_data_path()) / "fonts" / "ttf")')"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Although I wouldn't expect the /fonts/ttf dir to change. It could be worth a test that the directory in ${FONT_DIR} exists and exit with an error message if it doesn't. May save us some time debugging if anything goes wrong.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fair enough. done!

We currently don't specify what font we should use for the PDF documents, and so
we use a fallback font. But it depends on your specific environment which font
is picked.

This doesn't just impact the look of the text. Some fonts don't have glyphs for
certain characters. For example Verdana on MacOs doesn't have glyphs for →, ⊂
and ⊆.

This was because stdFont and stdBold were not defined in the stylesheet. So we
set those to DejaVu Sans, which is what we use in CI, which fixes the above
problems.

@smithp35 smithp35 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

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