pymupdf / PyMuPDF

PyMuPDF is a high performance Python library for data extraction, analysis, conversion & manipulation of PDF (and other) documents.
https://pymupdf.readthedocs.io
GNU Affero General Public License v3.0
4.49k stars 443 forks source link

Cannot replace fonts #3639

Closed exander77 closed 1 day ago

exander77 commented 2 days ago

Description of the bug

When I try to replace fonts by using insert_font, not only that font doesn't have name and instead (null) is show when listing fonts, it does not replace my fonts:

name                                 type              encoding         emb sub uni object ID
------------------------------------ ----------------- ---------------- --- --- --- ---------
NYKVRD+F2_CIDFont                    CID TrueType      Identity-H       yes yes no      16  0
EGWOZQ+F1_CIDFont                    CID TrueType      Identity-H       yes yes no      12  0
XEQFJF+F0_CIDFont                    CID TrueType      Identity-H       yes yes no       8  0
(null)                               CID TrueType      Identity-H       yes no  yes    189  0
(null)                               CID TrueType      Identity-H       yes no  yes    195  0
(null)                               CID TrueType      Identity-H       yes no  yes    201  0
SGODJB+F1_CIDFont                    CID TrueType      Identity-H       yes yes no      28  0
(null)                               CID TrueType      Identity-H       yes no  yes    207  0
AEPIOR+F2_CIDFont                    CID TrueType      Identity-H       yes yes no     172  0
(null)                               CID TrueType      Identity-H       yes no  yes    213  0

How to reproduce the bug

Try to insert font into pdf and save it.

PyMuPDF version

1.24.0

Operating system

Linux

Python version

3.8

JorjMcKie commented 2 days ago

Information is insufficient for this post to be acceptable as a bug report. At a minimum a reproducing file is required. In your case we also need your code snippet, because your description is confusing.

For example, insert_font() can never be used to replace another font (which, by the way is impossible by any other means, too).

Also, a font not having a name is completely legal. If you were providing the font then talk to someone from where you got it.

JorjMcKie commented 1 day ago

Closing this as the user has asked this also on StackOverflow, where we have answered that request.