lib/pdf/reader/cmap.rb in pdf-reader-2.11.0 vs lib/pdf/reader/cmap.rb in pdf-reader-2.12.0

- old
+ new

@@ -1,7 +1,7 @@ # coding: utf-8 -# typed: strict +# typed: true # frozen_string_literal: true ################################################################################ # # Copyright (C) 2008 James Healy (jimmy@deefa.com) @@ -116,11 +116,11 @@ str.unpack("n*") end result = [] while unpacked_string.any? do if unpacked_string.size >= 2 && - unpacked_string.first.to_i > 0xD800 && - unpacked_string.first.to_i < 0xDBFF + unpacked_string.first.to_i >= 0xD800 && + unpacked_string.first.to_i <= 0xDBFF # this is a Unicode UTF-16 "Surrogate Pair" see Unicode Spec. Chapter 3.7 # lets convert to a UTF-32. (the high bit is between 0xD800-0xDBFF, the # low bit is between 0xDC00-0xDFFF) for example: U+1D44E (U+D835 U+DC4E) point_one = unpacked_string.shift.to_i point_two = unpacked_string.shift.to_i