module HexaPDF::Font::TrueType::Table::CmapSubtable::Format10
Cmap
format 10
Public Class Methods
parse(io, length) → code_map
click to toggle source
Parses the format 10 cmap subtable from the given IO at the current position and returns the contained code map.
It is assumed that the first twelve bytes of the subtable have already been consumed.
# File lib/hexapdf/font/true_type/table/cmap_subtable.rb, line 344 def self.parse(io, _length) first_code, entry_count = io.read(8).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