Recent

Author Topic: fpPDF and Fonts  (Read 607 times)

dbannon

  • Hero Member
  • *****
  • Posts: 2778
    • tomboy-ng, a rewrite of the classic Tomboy
fpPDF and Fonts
« on: February 11, 2023, 06:48:33 am »
I have had a little play with fpPDF and it works beautifully except, one needs to select fonts carefully. And I am unsure of exactly how to select them !

I note here https://gitlab.com/freepascal.org/fpc/source/-/issues/30116  that fpPDF will work only with TTFonts and I can live with that but I find there appears to be, from fpPDF's point of view two types of TTF -

1. Fonts that have multiple files, eg, for the base font, the Bold version, the Italics version.
2. Fonts that have just one file but still show, for example, in the Lazarus Font Dialog or my OS (Ubuntu Mate) font dialog with bold and Italics, presumably generated on the fly.

Now, fpPDF is fine with (1) above but fails with (2) because it wants to open the font with fpttf's gTTFontCache and use the information so gained to calculate the space some text will take up. The rest of my application works fine with any installed font, displays on screen, scales onto a Printer canvas etc.

Is my assessment correct ?  Or have I overlooked something ?

I guess I can find a way to only allow end users to select fonts I know will work with the fpPDF but that seems a bit of a cop out and probably means making my own TFontDialog. All for the occasional PDF export.

Thoughts ?

Davo
Lazarus 2, Linux (and reluctantly Win10, OSX)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

 

TinyPortal © 2005-2018