Skip to content
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

Unsupport upper case font file name #638

Closed
CY-Qiu opened this issue Dec 22, 2022 · 3 comments · Fixed by #648
Closed

Unsupport upper case font file name #638

CY-Qiu opened this issue Dec 22, 2022 · 3 comments · Fixed by #648

Comments

@CY-Qiu
Copy link

CY-Qiu commented Dec 22, 2022

Error details
ValueError: Unsupported font file extension: .TTF. add_font() used to accept .pkl file as input, but for security reasons this feature is deprecated since v2.5.1 and has been removed in v2.5.3.

Minimal code

from fpdf import FPDF

pdf = FPDF()
pdf.add_font("simsun", fname="fonts/SIMSUN.TTF", uni=True)

Environment
fpdf2 version 2.6.0

fix way
I checked fpdf.py, line 1701 should be changed to the following code ,then this bug can be fixed.

ext = splitext(str(fname))[1].lower()
@CY-Qiu CY-Qiu added the bug label Dec 22, 2022
@Lucas-C
Copy link
Member

Lucas-C commented Dec 22, 2022

Thank you for the report @CY-Qiu!

This is indeed a bug.

Would you like to submit a PR to fix this? 😊

@Lucas-C
Copy link
Member

Lucas-C commented Dec 22, 2022

@allcontributors please add @CY-Qiu for bug

@allcontributors
Copy link

@Lucas-C

I've put up a pull request to add @CY-Qiu! 🎉

Lucas-C pushed a commit that referenced this issue Dec 28, 2022
Co-authored-by: qiuchengyu.cd <qiuchengyu.cd@ccbft.com>
Co-authored-by: Lucas Cimon <925560+Lucas-C@users.noreply.github.com>
Fixes #638
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants