Class: Fontisan::Stitcher::Selector::Range

Inherits:
Object
  • Object
show all
Defined in:
lib/fontisan/stitcher/selector/range.rb

Overview

Include every codepoint in a Range (e.g. 0x41..0x5A = A-Z). Glyphs missing from the source are silently skipped.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(range) ⇒ Range

Returns a new instance of Range.



11
12
13
# File 'lib/fontisan/stitcher/selector/range.rb', line 11

def initialize(range)
  @range = range
end

Instance Attribute Details

#rangeObject (readonly)

Returns the value of attribute range.



9
10
11
# File 'lib/fontisan/stitcher/selector/range.rb', line 9

def range
  @range
end

Instance Method Details

#apply(source, bindings) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/fontisan/stitcher/selector/range.rb', line 15

def apply(source, bindings)
  @range.each do |cp|
    gid = source.gid_for_codepoint(cp)
    next unless gid

    bindings << {
      codepoint: cp,
      source: source,
      donor_gid: gid,
    }
  end
end