Fix PDF export heading font fallback #6069
No reviewers
Labels
No labels
Focus: A11y
Focus: Admin/Meta
Focus: Authentication
Focus: Back-End
Focus: Database
Focus: Design & UX
Focus: Editor - Markdown
Focus: Editor - WYSIWYG
Focus: Export System
Focus: Front-End
Focus: Translations
Focus: View Customization
Is: Docs Update
Is: Enhancement
Is: Priority
Is: Security
Is: Upstream
Status
Blocked
Status
Open to discussion
Status
Out of scope
Status
Pending Validation
Type
API Request
Type
Bug Report
Type
Feature Request
Type
Happy feedback
Type
Maintenance
Type
Question
Type
Support
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
bookstack/bookstack!6069
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/pdf-export-heading-fonts"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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


After


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.cssfile:Removing
.dummy-style{color:red}makes Polish characters in PDF headers correct again.@janusz-net Removing .dummy-style{color:red} would likely reintroduce the earlier BOM-related issue tracked in https://github.com/sass/dart-sass/issues/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.
Thanks @alexwoo-awso, now merged. I did make a slight change afterwards in
4f370ccddbto set this for all exports so that it's aligned with what we're doing for fonts on other text.