Module: Fontisan::Ufo::Compile::Hmtx
- Defined in:
- lib/fontisan/ufo/compile/hmtx.rb
Overview
Builds the OpenType hmtx (horizontal metrics) table.
One LongHorMetric per glyph (4 bytes each):
uint16 advanceWidth, int16 lsb
No trailing "leftSideBearing" array (use numberOfHMetrics = numGlyphs).
Class Method Summary collapse
-
.build(_font, glyphs:) ⇒ String
Hmtx table bytes.
Class Method Details
.build(_font, glyphs:) ⇒ String
Returns hmtx table bytes.
15 16 17 18 19 20 21 22 23 |
# File 'lib/fontisan/ufo/compile/hmtx.rb', line 15 def self.build(_font, glyphs:) data = +"" glyphs.each do |glyph| bbox = glyph.bbox lsb = bbox ? bbox.x_min.to_i : 0 data << [glyph.width.to_i, lsb].pack("nn") end data end |