Class: Fontisan::Stitcher::Selector::Codepoints

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

Overview

Include an explicit list of codepoints.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(codepoints) ⇒ Codepoints

Returns a new instance of Codepoints.



10
11
12
# File 'lib/fontisan/stitcher/selector/codepoints.rb', line 10

def initialize(codepoints)
  @codepoints = codepoints
end

Instance Attribute Details

#codepointsObject (readonly)

Returns the value of attribute codepoints.



8
9
10
# File 'lib/fontisan/stitcher/selector/codepoints.rb', line 8

def codepoints
  @codepoints
end

Instance Method Details

#apply(source, bindings) ⇒ Object



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

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

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