Skip to content

Fix PDF export heading font fallback#6069

Merged
ssddanbrown merged 1 commit intoBookStackApp:developmentfrom
alexwoo-awso:fix/pdf-export-heading-fonts
Apr 20, 2026
Merged

Fix PDF export heading font fallback#6069
ssddanbrown merged 1 commit intoBookStackApp:developmentfrom
alexwoo-awso:fix/pdf-export-heading-fonts

Conversation

@alexwoo-awso
Copy link
Copy Markdown
Contributor

@alexwoo-awso alexwoo-awso commented Mar 25, 2026

PDF exports used the heading font var which in DOMPDF fell back to base fonts lacking Polish glyphs, causing ? in titles. This PR adds a PDF-only heading font fallback to DejaVu Sans for h1-h6. Tested by exporting a page with a Polish title; characters render correctly.

Before
image
image

After
image
image

@janusz-net
Copy link
Copy Markdown

The problem lies elsewhere. The last version that didn't have a problem with Polish characters in headers was v25.02.2. After updating to v25.02.3, "zażółć gęśli jaźń" -> "za?ół?? g??l? ja??.". The only change that causes this error is at the very beginning of the public/dist/export-styles.css file:

.dummy-style{color:red}:root{--font-body:...

Removing .dummy-style{color:red} makes Polish characters in PDF headers correct again.

@alexwoo-awso
Copy link
Copy Markdown
Contributor Author

@janusz-net Removing .dummy-style{color:red} would likely reintroduce the earlier BOM-related issue tracked in sass/dart-sass#472.

Your observation is still useful though, since it shows the PDF export path is sensitive to the first rule in the inlined export-styles.css; this PR aims to fix that without regressing the earlier workaround.

ssddanbrown added a commit that referenced this pull request Apr 20, 2026
@ssddanbrown ssddanbrown merged commit 743a21a into BookStackApp:development Apr 20, 2026
@ssddanbrown
Copy link
Copy Markdown
Member

Thanks @alexwoo-awso, now merged. I did make a slight change afterwards in 4f370cc to set this for all exports so that it's aligned with what we're doing for fonts on other text.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

3 participants