forked from reingart/pyfpdf
-
Notifications
You must be signed in to change notification settings - Fork 323
Open
Description
When adding C:/windows/fonts/symbol.ttf, fpdf throws as it assumes all fonts have a cmap, but symbol.ttf doesn't. Perhaps there are other fonts without cmap subtables, I'm not sure.
I'm not allowed to attach .ttf files to the issue, also may be legal issues with that? A quick google search brought up this site(lol) with a font exhibiting the same issue
Error details
Traceback (most recent call last):
File "C:\code\fpdf2_fork\test.py", line 2, in <module>
FPDF().add_font(
File "C:\code\fpdf2_fork\fpdf\fpdf.py", line 2144, in add_font
self.fonts[fontkey] = TTFFont(self, font_file_path, fontkey, style)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\code\fpdf2_fork\fpdf\fonts.py", line 363, in __init__
for char in self.cmap:
TypeError: 'NoneType' object is not iterable
Minimal code
Please include some minimal Python code reproducing your issue:
from fpdf import FPDF
FPDF().add_font(
family="symbol_notcore",
fname="C:/Windows/fonts/symbol.ttf",
)Environment
Please provide the following information:
- Operating System: Windows
- Python version: 3.12.2
-
fpdf2version used: 2.8.2