lib/pdf/reader/cmap.rb in pdf-reader-2.6.0 vs lib/pdf/reader/cmap.rb in pdf-reader-2.7.0

- old
+ new

@@ -1,6 +1,7 @@ # coding: utf-8 +# typed: false # frozen_string_literal: true ################################################################################ # # Copyright (C) 2008 James Healy (jimmy@deefa.com) @@ -30,10 +31,11 @@ # wraps a string containing a PDF CMap and provides convenience methods for # extracting various useful information. # class CMap # :nodoc: + CMAP_KEYWORDS = { "begincodespacerange" => 1, "endcodespacerange" => 1, "beginbfchar" => 1, "endbfchar" => 1, @@ -51,25 +53,25 @@ process_data(data) end def process_data(data) parser = build_parser(data) - mode = nil + mode = :none instructions = [] while token = parser.parse_token(CMAP_KEYWORDS) if token == "beginbfchar" mode = :char elsif token == "endbfchar" process_bfchar_instructions(instructions) instructions = [] - mode = nil + mode = :none elsif token == "beginbfrange" mode = :range elsif token == "endbfrange" process_bfrange_instructions(instructions) instructions = [] - mode = nil + mode = :none elsif mode == :char || mode == :range instructions << token end end end