pyfpdf icon indicating copy to clipboard operation
pyfpdf copied to clipboard

User defined path to font is ignored

Open Xitroy opened this issue 5 years ago • 1 comments
trafficstars

When you want to add_font from a custom path it is impossible to do, because add_font() function will get 'ttffile' from Fontfile.ttf, which is ususally ./fonts/Fontfile.ttf

Instead, you should define self.fonts[fontkey] = { ... 'ttffile': font_dict['ttffile'], ... } like in following snippet: self.fonts[fontkey] = { ... 'ttffile': ttffilename ... }, what will really refer on custom path to user font file.

Actually, even the original solution could work if you put your fonts into: ./fonts/Fontfile.ttf But it is not expected behavior (i guess) if your custom path will be redirected in further logic.

Xitroy avatar Oct 31 '20 18:10 Xitroy

FYI, this was fixed in fpdf2: https://alexanderankin.github.io/pyfpdf/

Lucas-C avatar Jan 09 '21 13:01 Lucas-C