Skip to content

Commit d03ec3e

Browse files
committed
Specify font number for TTC fonts
1 parent 1d12973 commit d03ec3e

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

lib/matplotlib/backends/_backend_pdf_ps.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
Common functionality between the PDF and PS backends.
33
"""
44

5+
import os
56
from io import BytesIO
67
import functools
78

@@ -37,7 +38,11 @@ def get_glyphs_subset(fontfile, characters):
3738
options = subset.Options(glyph_names=True, recommended_glyphs=True)
3839

3940
# prevent subsetting FontForge Timestamp and other tables
40-
options.drop_tables += ['FFTM', 'PfEd']
41+
options.drop_tables += ['FFTM', 'PfEd', 'BDF']
42+
43+
# if fontfile is a ttc, specify font number
44+
if os.path.splitext(fontfile)[1] == ".ttc":
45+
options.font_number = 0
4146

4247
with subset.load_font(fontfile, options) as font:
4348
subsetter = subset.Subsetter(options=options)

0 commit comments

Comments
 (0)