Skip to content

Commit b9cba45

Browse files
committed
Ensuring the unicode mapping as well as the encoding to glyph mapping use similar code paths for Type1 fonts.
1 parent 60033fc commit b9cba45

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

src/PDFonts.jl

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -160,11 +160,13 @@ function update_glyph_id_std_14(cosdoc, cosfont,
160160
glyph_name_to_cid, cid_to_glyph_name)
161161
basefont = cosDocGetObject(cosdoc, cosfont, cn"BaseFont")
162162
basefont === CosNull && return false
163-
String(basefont) in ADOBE_STD_14 || return false
163+
basefont_with_subset = CDTextString(basefont)
164+
basefont_str = String(rsplit(basefont_with_subset, '+';limit=2)[end])
165+
basefont_str in ADOBE_STD_14 || return false
164166
gn2cid, cid2gn =
165-
basefont === cn"Symbol" ?
167+
basefont_str == "Symbol" ?
166168
(GlyphName_to_SYMEncoding, SYMEncoding_to_GlyphName) :
167-
basefont === cn"ZapfDingbats" ?
169+
basefont_str == "ZapfDingbats" ?
168170
(GlyphName_to_ZAPEncoding, ZAPEncoding_to_GlyphName) :
169171
(GlyphName_to_STDEncoding, STDEncoding_to_GlyphName)
170172
merge!(glyph_name_to_cid, gn2cid)
@@ -179,10 +181,7 @@ function get_glyph_id_mapping(cosdoc::CosDoc, cosfont::IDD{CosDict})
179181
subtype = cosDocGetObject(cosdoc, cosfont, cn"Subtype")
180182
subtype === cn"Type0" && return glyph_name_to_cid, cid_to_glyph_name
181183

182-
update_glyph_id_std_14(cosdoc, cosfont,
183-
glyph_name_to_cid,
184-
cid_to_glyph_name) &&
185-
return glyph_name_to_cid, cid_to_glyph_name
184+
update_glyph_id_std_14(cosdoc, cosfont, glyph_name_to_cid, cid_to_glyph_name)
186185

187186
encoding = cosDocGetObject(cosdoc, cosfont, cn"Encoding")
188187
encoding === CosNull && return glyph_name_to_cid, cid_to_glyph_name

0 commit comments

Comments
 (0)