class HexaPDF::Type::CIDFont
def widths
Note that the hash is cached internally when accessed the first time.
Returns a hash mapping CIDs to their respective width.
def widths cache(:widths) do result = {} index = 0 array = self[:W] || [] while index < array.size entry = array[index] value = array[index + 1] if value.kind_of?(Array) value.each_with_index {|width, i| result[entry + i] = width } index += 2 else width = array[index + 2] entry.upto(value) {|cid| result[cid] = width } index += 3 end end result end end