Module: Fontisan::Ufo::Compile::Hhea
- Defined in:
- lib/fontisan/ufo/compile/hhea.rb
Overview
Builds the OpenType hhea (horizontal header) table.
Constant Summary collapse
- VERSION_1_0 =
0x00010000
Class Method Summary collapse
Class Method Details
.build(font, glyphs:) ⇒ Fontisan::Tables::Hhea
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/fontisan/ufo/compile/hhea.rb', line 14 def self.build(font, glyphs:) info = font.info widths = glyphs.map { |g| g.width.to_i } Fontisan::Tables::Hhea.new( version_raw: VERSION_1_0, ascent: info.ascender || 800, descent: info.descender || -200, line_gap: info.open_type_hhea_line_gap || 0, advance_width_max: widths.max || 0, min_left_side_bearing: 0, min_right_side_bearing: 0, x_max_extent: widths.max || 0, caret_slope_rise: 1, caret_slope_run: 0, caret_offset: 0, metric_data_format: 0, number_of_h_metrics: glyphs.size, ) end |