Skip to content

replace the embedded font by just replacing the whole font contents directly #918

Answered by JorjMcKie
JackieFei asked this question in Q&A
Discussion options

You must be logged in to vote

No, this is impossible - meaning it cannot ever work. Not even if you wanted to replace a sans font by some other sans font.

There are several reasons for this, here are just two:

  • every single glyph has its own metrics (at least for proportional fonts), e.g. an "a" in Palatino has a different width than in Arial. In addition the relative width within a font is different from that of another font.
  • Text in a PDF is encoded with a glyph number per unicode. This number is in general not equal to the unicode number and it is font-specific. So if text is not rewritten with the new font, the result would be unreadable.

The next version will however contain a new Document.subset_fonts() that re…

Replies: 2 comments 5 replies

Comment options

You must be logged in to vote
5 replies
@JorjMcKie
Comment options

@JackieFei
Comment options

@JorjMcKie
Comment options

@JorjMcKie
Comment options

@JorjMcKie
Comment options

Answer selected by JorjMcKie
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants