From 89fbe2c616898de9b37961f4f0bb7e3851ebaf4b Mon Sep 17 00:00:00 2001 From: Thomas Leitner Date: Tue, 5 Nov 2024 00:13:07 +0100 Subject: [PATCH] Fix order of dictionary type entry for /CIDToGIDMap for CID fonts The DictionaryConverter module uses the first entry in the type array as the type class for the conversion. Since the converter is invoked for /CIDToGIDMap due to 'Stream' being in the type array, it use 'Symbol' as type class which is invalid. --- CHANGELOG.md | 1 + lib/hexapdf/type/cid_font.rb | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 650f44ab..7ca9f152 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ### Fixed * Checksum calculation for TrueType tables +* Automatic wrapping of dictionary entry /CIDToGIDMap for CID fonts ## 1.0.1 - 2024-11-04 diff --git a/lib/hexapdf/type/cid_font.rb b/lib/hexapdf/type/cid_font.rb index 832ac59d..fd1b9ab9 100644 --- a/lib/hexapdf/type/cid_font.rb +++ b/lib/hexapdf/type/cid_font.rb @@ -70,7 +70,7 @@ class CIDSystemInfo < Dictionary define_field :W, type: PDFArray define_field :DW2, type: PDFArray, default: [880, -1100] define_field :W2, type: PDFArray - define_field :CIDToGIDMap, type: [Symbol, Stream] + define_field :CIDToGIDMap, type: [Stream, Symbol] # Returns the unscaled width of the given CID in glyph units, or 0 if the width for the CID is # missing.