Skip to content

Commit 5309322

Browse files
committed
pdf: Fix first-block characters using multiple glyph representations
If mixing languages, sometimes a single character may use different glyphs in one document. In that case, we need to give it a new character code in the next subset, since subset 0 is preserving character codes.
1 parent f0666b3 commit 5309322

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

lib/matplotlib/backends/_backend_pdf_ps.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,10 @@ def track_glyph(
209209
# ASCII (for Type 3) or the Basic Multilingual Plane (for Type 42).
210210
if charcode >= self.subset_size:
211211
use_next_charmap = True
212+
# Or, use a new subset if the character code is already mapped for the first
213+
# block. This means it's using an alternate glyph.
214+
elif charcode in subset_maps[0]:
215+
use_next_charmap = True
212216
if use_next_charmap:
213217
if len(subset_maps) == 1 or len(subset_maps[-1]) == self.subset_size:
214218
subset_maps.append({})

0 commit comments

Comments
 (0)