Module: Fontisan::Ufo::Compile::Avar
- Defined in:
- lib/fontisan/ufo/compile/avar.rb
Overview
Builds the OpenType avar (Axis Variation) table.
avar defines non-linear interpolation curves for each axis. For axes with linear interpolation (the common case), each axis gets 3 default maps: (-1→-1, 0→0, 1→1).
Class Method Summary collapse
-
.build(axes:) ⇒ String
Avar table bytes.
Class Method Details
.build(axes:) ⇒ String
Returns avar table bytes.
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/fontisan/ufo/compile/avar.rb', line 16 def self.build(axes:) return nil if axes.nil? || axes.empty? io = +"" io << [0x00010000].pack("N") # version 1.0 io << [0].pack("n") # reserved io << [axes.size].pack("n") # axisCount axes.each do |axis| maps = axis[:maps] || default_maps io << [maps.size].pack("n") maps.each do |from, to| io << [f2dot14(from), f2dot14(to)].pack("nn") end end io end |