diff --git a/lib/prawn/fonts/to_unicode_cmap.rb b/lib/prawn/fonts/to_unicode_cmap.rb index 84e856d4a..0549e10c4 100644 --- a/lib/prawn/fonts/to_unicode_cmap.rb +++ b/lib/prawn/fonts/to_unicode_cmap.rb @@ -78,7 +78,7 @@ def generate "<%0#{code_space_size * 2}X><%0#{code_space_size * 2}X>[%s]", span.first[0], span.last[0], - span.map { |_, cid| "<#{cid.chr(::Encoding::UTF_16BE).unpack1('H*')}>" }.join(''), + span.map { |_, cid| "<#{cid.map {|c| "#{c.chr(::Encoding::UTF_16BE).unpack1('H*')}"}.join(',')}>" }.join(''), ) end # rubocop: enable Lint/FormatParameterMismatch diff --git a/lib/prawn/fonts/ttf.rb b/lib/prawn/fonts/ttf.rb index 0abf5b742..6262ee2bc 100644 --- a/lib/prawn/fonts/ttf.rb +++ b/lib/prawn/fonts/ttf.rb @@ -230,7 +230,7 @@ def encode_text(text, options = {}) end end else - @subsets.encode(text.unpack('U*')) + @subsets.encode(text.each_grapheme_cluster.map(&:codepoints)) end end