-
Notifications
You must be signed in to change notification settings - Fork 250
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
.add_font() -- AttributeError: 'table__n_a_m_e' object has no attribute 'getBestFullName' #524
Comments
Hi and thanks for reporting this @guillaume-dotcom I'm sorry but I couldn't reproduce your issue, neither under Linux (Ubuntu) nor Windows (10) Note also that your sample code is not fully correct. from fpdf import FPDF
from pathlib import Path
fontfolder = Path('test/fonts/')
pdf = FPDF()
pdf.add_page()
pdf.add_font('DejaVuSans', '', fontfolder/'DejaVuSans.ttf')
pdf.set_font('DejaVuSans', size=14) |
Hi @Lucas-C and thanks for the swift reply, Point taken. Apologies for leaving one the It is odd. Changing the interpreter to a previous version of fpdf2 worked just fine then. I wonder what could trigger this message. I also tried to reproduce your code (exactly) and get the same error.
|
You don't seem to have a recent enough version of fonttools installed.
That's easy to explain, since fpdf2 only started to use fonttools with release 2.5.7 published just yesterday. |
Hey @gmischler, That did the trick. thanks. :) @Lucas-C, shouldn't we have an updated fonttools requirement in setup.py to ensure this is not a recurring issue? |
Yes, setting a minimum version might be useful for several dependencies. We've had similar questions about Pillow in the past. Some people even reccommend to pin all dependencies to a fixed version that has been checked and tested, in order to prevent supply chain attacks. |
I agree! Would you like to submit a PR introducing a minimum version for |
Yes @Lucas-C. I will submit a PR. |
When updating to latest release (v2.5.7) and checking out if my older scripts were compatible, I discovered that the add_font created an attribute error and seems to me like a bug.
With code below on Windows assuming that the font file is accessible and all works just fine with fpdf2 v2.4.6.
I get the following error:
Thanks.
The text was updated successfully, but these errors were encountered: