Skip to content

PDF: Started building system to allow custom DOMPDF font loading#6109

Open
ssddanbrown wants to merge 1 commit intodevelopmentfrom
dompdf_font_loading
Open

PDF: Started building system to allow custom DOMPDF font loading#6109
ssddanbrown wants to merge 1 commit intodevelopmentfrom
dompdf_font_loading

Conversation

@ssddanbrown
Copy link
Copy Markdown
Member

Adds a way for custom fonts to be loaded for use with DomPDF.

On export, BookStack scans the storage/fonts/dompdf folder for *.ttf font files, then for each attempts to build the required .ufm (font-metrics) file where they don't already exist.
Then it auto-converts the naming scheme to suit dompdf.

Considerations

This is just one side of things, making the font available. It would also need to be used in styles. We could attempt to auto-inject styles, but then things may get complex with factors like font ordering, different fonts for different uses etc...

Might be best, at least for now, if we provide guidance (alongside guidance for this system) on how to set the relevant styles (via custom HTML head content).

Todo

  • Cover with testing
  • Consider potential breaks due to new storage/fonts sub-folders.

Docs Updates

  • Upgrade advisory: Due to some changes in how fonts are used for exports, you may need to ensure that the storage/fonts folder (and all folders within that) are accessible & writable to the web-server.

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.

1 participant