19 lines
706 B
Text
19 lines
706 B
Text
# Name-driven feature pairs
|
|
export : define [buildGrFeature gsub glyphStore gr] : begin
|
|
local rec : gsub.beginBlock
|
|
|
|
local mapping {.}
|
|
foreach { gnSrc glyph } [glyphStore.namedEntries] : begin
|
|
local gnDst : gr.get glyph
|
|
local glyphDst : glyphStore.queryByName gnDst
|
|
if (glyphDst && ([glyphStore.queryUnicodeOf glyph] || [glyphStore.queryUnicodeOf glyphDst]))
|
|
set mapping.(gnSrc) gnDst
|
|
|
|
if [objectIsNotEmpty mapping] : begin
|
|
define lookup1 : gsub.createLookup {.type 'gsub_single' .substitutions mapping}
|
|
define feature1 : gsub.addCommonFeature : gsub.createFeature gr.otlTag
|
|
feature1.addLookup lookup1
|
|
|
|
gsub.endBlock rec
|
|
|
|
define [objectIsNotEmpty obj] : obj && [Object.keys obj].length
|