Parent

Methods

TTFunk::Table::Hmtx

Constants

HorizontalMetric

Attributes

left_side_bearings[R]
metrics[R]
widths[R]

Public Class Methods

encode(hmtx, mapping) click to toggle source
# File lib/ttfunk/table/hmtx.rb, line 10
def self.encode(hmtx, mapping)
  metrics = mapping.keys.sort.map do |new_id|
    metric = hmtx.for(mapping[new_id])
    [metric.advance_width, metric.left_side_bearing]
  end

  { :number_of_metrics => metrics.length,
    :table => metrics.flatten.pack("n*") }
end

Public Instance Methods

for(glyph_id) click to toggle source
# File lib/ttfunk/table/hmtx.rb, line 22
def for(glyph_id)
  @metrics[glyph_id] ||
    HorizontalMetric.new(@metrics.last.advance_width,
      @left_side_bearings[glyph_id - @metrics.length])
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.