Skip to content

Compute glyph widths similarly in Type 42 as in Type 3 #7961

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

Merged
merged 3 commits into from
Jan 29, 2017
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Compute glyph widths similarly in Type 42 as in Type 3
  • Loading branch information
jkseppan committed Jan 27, 2017
commit e76763bd7c8c9df546812855b58aa831461d79b7
4 changes: 2 additions & 2 deletions lib/matplotlib/backends/backend_pdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -1040,8 +1040,8 @@ def embedTTFType42(font, characters, descriptor):
for c in characters:
ccode = c
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only suggestion I have is to clean this up; ccode can just be the name at the beginning of the loop.

gind = font.get_char_index(ccode)
glyph = font.load_char(ccode, flags=LOAD_NO_HINTING)
widths.append((ccode, glyph.horiAdvance / 6))
glyph = font.load_char(ccode, flags=LOAD_NO_SCALE|LOAD_NO_HINTING)
widths.append((ccode, cvt(glyph.horiAdvance)))
if ccode < 65536:
cid_to_gid_map[ccode] = unichr(gind)
max_ccode = max(ccode, max_ccode)
Expand Down