module HexaPDF::Font::TrueType::Table::CmapSubtable::Format6
Cmap
format 6
Public Class Methods
parse(io, length) → code_map
click to toggle source
Parses the format 6 cmap subtable from the given IO at the current position and returns the contained code map.
It is assumed that the first six bytes of the subtable have already been consumed.
# File lib/hexapdf/font/true_type/table/cmap_subtable.rb, line 321 def self.parse(io, _length) first_code, entry_count = io.read(4).unpack('n2') code_map = io.read(2 * entry_count).unpack('n*') gid_map = {} code_map = code_map.each_with_index.with_object({}) do |(g, i), hash| hash[first_code + i] = g gid_map[g] = first_code + i end [code_map, gid_map] end