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

Feature Request: Allow "FPDF.add_font" to accept a bytes/buffer object #172

Closed
EmperorArthur opened this issue Jun 23, 2021 · 5 comments
Closed
Labels
enhancement font hacktoberfest research needed too complicated to implement without careful study of official specifications up-for-grabs

Comments

@EmperorArthur
Copy link

EmperorArthur commented Jun 23, 2021

Hello,

This is more of a nice to have than anything, but in playing around, I found this pymupdf-fontsconvenient package. and thought it would be great if it could be loaded into the code without an extra step.

In addition, accepting bytes or buffers would allow for use with setuptools Resource Manager API when using this as part of a larger project.

@Lucas-C
Copy link
Member

Lucas-C commented Jun 23, 2021

Interesting!

I'll try to check out soon how fpdf2 could work along this pymupdf-fonts library

@Lucas-C
Copy link
Member

Lucas-C commented Jul 15, 2021

Just a quick heads-up: I haven't been able to install pymupdf on my laptop (the required steps are a bit convoluted) so I haven't been able to progress on this subject yet.

Anyone is very welcome to have a look a it!

@EmperorArthur
Copy link
Author

Oh, I didn't bother with that. I just installed the fonts package. https://pypi.org/project/pymupdf-fonts/

I believe they're ignoring the whole api I was talking about and just base64 encoding the data.

@Lucas-C
Copy link
Member

Lucas-C commented Jul 16, 2021

Alright, but the code to parse & load those font buffers are defined in MuPDF:
https://github.com/kobolabs/mupdf/blob/master/include/mupdf/fitz/font.h#L81

Without PyMuPDF, it will be difficult to extract those fonts...

@Lucas-C Lucas-C added the research needed too complicated to implement without careful study of official specifications label Jul 16, 2021
@Lucas-C Lucas-C added the font label Nov 15, 2021
@Lucas-C
Copy link
Member

Lucas-C commented Jun 17, 2022

On a related note, we plan to move to fonttools: #418

I'm not sure this will solve this initial request here, but I'm going to close this issue for now

@Lucas-C Lucas-C closed this as completed Jun 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement font hacktoberfest research needed too complicated to implement without careful study of official specifications up-for-grabs
Projects
None yet
Development

No branches or pull requests

2 participants