Skip to content
Discussion options

You must be logged in to vote

My original requirement is, how to get the correct font size as per Adobe illustrator or Adobe acrobat.

You could do this:
extract the text after executing fitz.TOOLS.set_small_glyph_heights(True). Then

  • The standard character width in a font is called "glyph_advance". For example font.glyph_advance(ord("1")) = 0.55615234375 for character "1".
  • For this character with a horizontal scale of 0.5, the character dictionary (extracted with option "rawdict") is this:
{'bbox': (18.8164005279541,
          19.041404724121094,
          20.2067813873291,
          22.57693862915039),
 'c': '1',
 'origin': (18.8164005279541, 21.906299591064453)}
  • so the width w = 20.2067813873291 - 18.81640052795…

Replies: 4 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by murlai
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants