Initial work of ESM transformation
This commit is contained in:
parent
2472c9cff2
commit
b8205a63aa
303 changed files with 1959 additions and 2450 deletions
|
@ -1,5 +1,5 @@
|
|||
import [Glyph] from '../support/glyph'
|
||||
import [Transform] from '../support/geometry/transform'
|
||||
import [Glyph] from"../support/glyph/index.mjs"
|
||||
import [Transform] from"../support/geometry/transform.mjs"
|
||||
|
||||
define GDEF_SIMPLE 1
|
||||
define GDEF_LIGATURE 2
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import [add-common-feature add-feature add-lookup] from "./table-util"
|
||||
import [AddCommonFeature AddFeature AddLookup] from"./table-util.mjs"
|
||||
extern Set
|
||||
|
||||
define MarkClasses {
|
||||
|
@ -9,10 +9,10 @@ define MarkClasses {
|
|||
}
|
||||
|
||||
export : define [buildMarkMkmk sink glyphStore] : begin
|
||||
define mark : add-feature sink 'mark'
|
||||
define mkmk : add-feature sink 'mkmk'
|
||||
add-common-feature sink mark
|
||||
add-common-feature sink mkmk
|
||||
define mark : AddFeature sink 'mark'
|
||||
define mkmk : AddFeature sink 'mkmk'
|
||||
AddCommonFeature sink mark
|
||||
AddCommonFeature sink mkmk
|
||||
|
||||
local markLookupNames {}
|
||||
local mkmkLookupNames {}
|
||||
|
@ -20,12 +20,12 @@ export : define [buildMarkMkmk sink glyphStore] : begin
|
|||
foreach markCls [items-of MarkClasses] : begin
|
||||
local [object markLookup mkmkLookup] : createMTLookups glyphStore { markCls }
|
||||
if ([objectIsNotEmpty markLookup.marks] && [objectIsNotEmpty markLookup.bases]) : begin
|
||||
local lidMark : add-lookup sink markLookup
|
||||
local lidMark : AddLookup sink markLookup
|
||||
mark.lookups.push lidMark
|
||||
markLookupNames.push lidMark
|
||||
|
||||
if ([objectIsNotEmpty mkmkLookup.marks] && [objectIsNotEmpty mkmkLookup.bases]) : begin
|
||||
local lidMkmk : add-lookup sink mkmkLookup
|
||||
local lidMkmk : AddLookup sink mkmkLookup
|
||||
mkmk.lookups.push lidMkmk
|
||||
mkmkLookupNames.push lidMkmk
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import [add-common-feature add-feature add-lookup add-feature-lookup ChainRuleBuilder BeginLookupBlock EndLookupBlock UkMapToLookup UkMap2ToLookup] from "./table-util"
|
||||
import [AnyCv Dotless TieMark TieGlyph CcmpDecompose] from "../support/gr"
|
||||
import as UnicodeKnowledge from "../meta/unicode-knowledge"
|
||||
import [AddCommonFeature AddFeature AddLookup AdeFeatureLookup ChainRuleBuilder BeginLookupBlock EndLookupBlock UkMapToLookup UkMap2ToLookup] from"./table-util.mjs"
|
||||
import [AnyCv Dotless TieMark TieGlyph CcmpDecompose] from"../support/gr.mjs"
|
||||
import as UnicodeKnowledge from"../meta/unicode-knowledge.mjs"
|
||||
|
||||
extern Set
|
||||
|
||||
|
@ -10,7 +10,7 @@ define-operator "~>" 880 'right' : syntax-rules
|
|||
export : define [buildCCMP sink glyphStore markGlyphs] : begin
|
||||
local rec : BeginLookupBlock sink
|
||||
|
||||
define ccmp : add-feature sink 'ccmp'
|
||||
define ccmp : AddFeature sink 'ccmp'
|
||||
define {chain-rule} : ChainRuleBuilder sink
|
||||
|
||||
define groupGrekUpperTonos {}
|
||||
|
@ -102,7 +102,7 @@ export : define [buildCCMP sink glyphStore markGlyphs] : begin
|
|||
e.push ('toneSandhiMid' + toneStart + toneMid + toneEnd)
|
||||
return (f ~> e)
|
||||
|
||||
define lookupMarks1 : add-lookup sink : object
|
||||
define lookupMarks1 : AddLookup sink : object
|
||||
.type 'gsub_chaining'
|
||||
.rules : list
|
||||
# Dot removal (max 6 middle marks are supported)
|
||||
|
@ -131,22 +131,22 @@ export : define [buildCCMP sink glyphStore markGlyphs] : begin
|
|||
chain-rule groupTR markGlyphs.all markGlyphs.all markGlyphs.all markGlyphs.all markGlyphs.all [OgonekTrailing]
|
||||
chain-rule groupTR markGlyphs.all markGlyphs.all markGlyphs.all markGlyphs.all markGlyphs.all markGlyphs.all [OgonekTrailing]
|
||||
|
||||
define lookupMarks2 : add-lookup sink : object
|
||||
define lookupMarks2 : AddLookup sink : object
|
||||
.type 'gsub_ligature'
|
||||
.substitutions : UkMap2ToLookup UnicodeKnowledge.markCompositionTf
|
||||
|
||||
define lookupMarks3 : add-lookup sink : object
|
||||
define lookupMarks3 : AddLookup sink : object
|
||||
.type 'gsub_chaining'
|
||||
.rules : list
|
||||
chain-rule groupGrekUpperTonos [GrekUpperTonosTf]
|
||||
|
||||
define lookupCcmp-TieMarkLigature : add-lookup sink : object
|
||||
define lookupCcmp-TieMarkLigature : AddLookup sink : object
|
||||
.type 'gsub_ligature'
|
||||
.substitutions : {}.concat
|
||||
TieMarkFrom.map : lambda [gnFrom idx]
|
||||
object [from {'cgj' gnFrom}] [to TieMarkTo.(idx)]
|
||||
|
||||
define lookupTieMarkContextual : add-lookup sink : object
|
||||
define lookupTieMarkContextual : AddLookup sink : object
|
||||
.type 'gsub_chaining'
|
||||
.rules : list : object
|
||||
match {[TieGlyphs.concat TieMarkTo] {'cgj'} TieMarkFrom}
|
||||
|
@ -154,7 +154,7 @@ export : define [buildCCMP sink glyphStore markGlyphs] : begin
|
|||
inputEnds 3
|
||||
apply {{.at 1 .lookup lookupCcmp-TieMarkLigature}}
|
||||
|
||||
define lookupToneStart : add-lookup sink : object
|
||||
define lookupToneStart : AddLookup sink : object
|
||||
.type 'gsub_chaining'
|
||||
.rules : list
|
||||
chain-rule [ToneToToneStart 0] {'tone0'}
|
||||
|
@ -163,7 +163,7 @@ export : define [buildCCMP sink glyphStore markGlyphs] : begin
|
|||
chain-rule [ToneToToneStart 3] {'tone3'}
|
||||
chain-rule [ToneToToneStart 4] {'tone4'}
|
||||
|
||||
define lookupToneMid : add-lookup sink : object
|
||||
define lookupToneMid : AddLookup sink : object
|
||||
.type 'gsub_chaining'
|
||||
.rules : list
|
||||
chain-rule [ToneStartOrMidAt 0] [ToneStartToToneMid 0]
|
||||
|
@ -172,7 +172,7 @@ export : define [buildCCMP sink glyphStore markGlyphs] : begin
|
|||
chain-rule [ToneStartOrMidAt 3] [ToneStartToToneMid 3]
|
||||
chain-rule [ToneStartOrMidAt 4] [ToneStartToToneMid 4]
|
||||
|
||||
define lookupToneEnd : add-lookup sink : object
|
||||
define lookupToneEnd : AddLookup sink : object
|
||||
.type 'gsub_chaining'
|
||||
.rules : list
|
||||
chain-rule [ToneStartOrMidAt 0] [ToneToToneEnd 0]
|
||||
|
@ -181,7 +181,7 @@ export : define [buildCCMP sink glyphStore markGlyphs] : begin
|
|||
chain-rule [ToneStartOrMidAt 3] [ToneToToneEnd 3]
|
||||
chain-rule [ToneStartOrMidAt 4] [ToneToToneEnd 4]
|
||||
|
||||
define lookupToneSandhiStart : add-lookup sink : object
|
||||
define lookupToneSandhiStart : AddLookup sink : object
|
||||
.type 'gsub_chaining'
|
||||
.rules : list
|
||||
chain-rule [ToneSandhiToToneStart 0] {'toneSandhi0'}
|
||||
|
@ -190,7 +190,7 @@ export : define [buildCCMP sink glyphStore markGlyphs] : begin
|
|||
chain-rule [ToneSandhiToToneStart 3] {'toneSandhi3'}
|
||||
chain-rule [ToneSandhiToToneStart 4] {'toneSandhi4'}
|
||||
|
||||
define lookupToneSandhiMid : add-lookup sink : object
|
||||
define lookupToneSandhiMid : AddLookup sink : object
|
||||
.type 'gsub_chaining'
|
||||
.rules : list
|
||||
chain-rule [ToneSandhiStartOrMidAt 0] [ToneSandhiStartToToneMid 0]
|
||||
|
@ -199,7 +199,7 @@ export : define [buildCCMP sink glyphStore markGlyphs] : begin
|
|||
chain-rule [ToneSandhiStartOrMidAt 3] [ToneSandhiStartToToneMid 3]
|
||||
chain-rule [ToneSandhiStartOrMidAt 4] [ToneSandhiStartToToneMid 4]
|
||||
|
||||
define lookupToneSandhiEnd : add-lookup sink : object
|
||||
define lookupToneSandhiEnd : AddLookup sink : object
|
||||
.type 'gsub_chaining'
|
||||
.rules : list
|
||||
chain-rule [ToneSandhiStartOrMidAt 0] [ToneSandhiToToneEnd 0]
|
||||
|
@ -227,12 +227,12 @@ export : define [buildCCMP sink glyphStore markGlyphs] : begin
|
|||
if (parts && parts.length) : set decompositions.(gid) parts
|
||||
|
||||
if [objectIsNotEmpty decompositions] : begin
|
||||
define lookupCcmp-Decompose : add-lookup sink : object
|
||||
define lookupCcmp-Decompose : AddLookup sink : object
|
||||
.type 'gsub_multiple'
|
||||
.substitutions decompositions
|
||||
add-feature-lookup ccmp lookupCcmp-Decompose
|
||||
AdeFeatureLookup ccmp lookupCcmp-Decompose
|
||||
|
||||
add-common-feature sink ccmp
|
||||
AddCommonFeature sink ccmp
|
||||
EndLookupBlock rec sink
|
||||
|
||||
define [objectIsNotEmpty obj] : obj && [Object.keys obj].length
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import [add-lookup add-common-feature pick-feature add-feature-lookup pick-lookup BeginLookupBlock EndLookupBlock ChainRuleBuilder] from "./table-util"
|
||||
import [Cv AnyCv CvDecompose RightDependentLink RightDependentTrigger] from "../support/gr"
|
||||
import [AddLookup AddCommonFeature PickFeature AdeFeatureLookup PickLookup BeginLookupBlock EndLookupBlock ChainRuleBuilder] from"./table-util.mjs"
|
||||
import [Cv AnyCv CvDecompose RightDependentLink RightDependentTrigger] from"../support/gr.mjs"
|
||||
|
||||
extern Map
|
||||
extern Set
|
||||
|
@ -26,17 +26,17 @@ export : define [buildCVSS sink para glyphStore] : begin
|
|||
local parts : CvDecompose.get g
|
||||
if (parts && parts.length) : set decompositions.(gid) parts
|
||||
|
||||
define lookupNameCvDecompose : add-lookup sink : object
|
||||
define lookupNameCvDecompose : AddLookup sink : object
|
||||
.type 'gsub_multiple'
|
||||
.substitutions decompositions
|
||||
|
||||
define [addFeatureAndLookup tag lookupName init] : begin
|
||||
define feature : pick-feature sink [FeatureName tag]
|
||||
add-common-feature sink feature
|
||||
define feature : PickFeature sink [FeatureName tag]
|
||||
AddCommonFeature sink feature
|
||||
|
||||
define lookup : pick-lookup sink lookupName init
|
||||
add-feature-lookup feature lookupNameCvDecompose
|
||||
add-feature-lookup feature lookupName
|
||||
define lookup : PickLookup sink lookupName init
|
||||
AdeFeatureLookup feature lookupNameCvDecompose
|
||||
AdeFeatureLookup feature lookupName
|
||||
sink.lookupDep.push { lookupNameCvDecompose lookupName }
|
||||
cvLookupNameSet.add lookupName
|
||||
|
||||
|
@ -49,7 +49,7 @@ export : define [buildCVSS sink para glyphStore] : begin
|
|||
addFeatureAndLookup gr.tag lookupName {.type 'gsub_alternate' .substitutions {.}}
|
||||
cvLookupNameSet.add lookupName
|
||||
|
||||
local st [pick-lookup sink lookupName].substitutions
|
||||
local st [PickLookup sink lookupName].substitutions
|
||||
if [not st.(gn)] : set st.(gn) { }
|
||||
set st.(gn).(gr.rank - 1) : glyphStore.ensureExists : gr.get glyph
|
||||
|
||||
|
@ -60,7 +60,7 @@ export : define [buildCVSS sink para glyphStore] : begin
|
|||
addFeatureAndLookup composition.tag lookupName {.type 'gsub_single' .substitutions {.}}
|
||||
cvLookupNameSet.add lookupName
|
||||
|
||||
define st [pick-lookup sink lookupName].substitutions
|
||||
define st [PickLookup sink lookupName].substitutions
|
||||
define decomp : composition.decompose para para.variants.selectorTree
|
||||
foreach { prime pv } [items-of decomp] : if (pv.tag && pv.rank) : begin
|
||||
local gr : Cv pv.tag pv.rank
|
||||
|
@ -70,7 +70,7 @@ export : define [buildCVSS sink para glyphStore] : begin
|
|||
|
||||
# If there are holes in the alternates list, fill them
|
||||
foreach lutn cvLookupNameSet : begin
|
||||
local st [pick-lookup sink lutn].substitutions
|
||||
local st [PickLookup sink lutn].substitutions
|
||||
foreach { k v } [pairs-of st] : foreach idx [range 0 v.length] : if [not v.(idx)]
|
||||
set v.(idx) k
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import [add-common-feature add-feature add-lookup BeginLookupBlock EndLookupBlock ChainRuleBuilder] from "./table-util"
|
||||
import [NumeratorForm DenominatorForm] from "../support/gr"
|
||||
import [AddCommonFeature AddFeature AddLookup BeginLookupBlock EndLookupBlock ChainRuleBuilder] from"./table-util.mjs"
|
||||
import [NumeratorForm DenominatorForm] from"../support/gr.mjs"
|
||||
|
||||
define-operator "~>" 880 'right' : syntax-rules
|
||||
`(@l ~> @r) `{.left @l .right @r}
|
||||
|
@ -8,10 +8,10 @@ define-operator "~>" 880 'right' : syntax-rules
|
|||
export : define [buildFrac sink glyphStore] : begin
|
||||
local rec : BeginLookupBlock sink
|
||||
|
||||
define frac : add-feature sink 'frac'
|
||||
define frac : AddFeature sink 'frac'
|
||||
define { chain-rule reverse-rule } : ChainRuleBuilder sink
|
||||
|
||||
define subSolidus : add-lookup sink : object
|
||||
define subSolidus : AddLookup sink : object
|
||||
.type 'gsub_single'
|
||||
.substitutions : object ['solidus' 'fractionBar'] ['slash' 'fractionBar']
|
||||
|
||||
|
@ -27,12 +27,12 @@ export : define [buildFrac sink glyphStore] : begin
|
|||
numSet.push numForm
|
||||
denSet.push denForm
|
||||
|
||||
define subDen : add-lookup sink : object
|
||||
define subDen : AddLookup sink : object
|
||||
.type 'gsub_chaining'
|
||||
.rules : list
|
||||
chain-rule [{'fractionBar'}.concat denSet] [digitSet ~> denSet]
|
||||
|
||||
define subNum : add-lookup sink : object
|
||||
define subNum : AddLookup sink : object
|
||||
.type 'gsub_reverse'
|
||||
.rules : list
|
||||
reverse-rule [digitSet ~> numSet] [{'fractionBar'}.concat numSet]
|
||||
|
@ -43,7 +43,7 @@ export : define [buildFrac sink glyphStore] : begin
|
|||
sink.lookupDep.push {subSolidus subDen}
|
||||
sink.lookupDep.push {subSolidus subNum}
|
||||
|
||||
add-common-feature sink frac
|
||||
AddCommonFeature sink frac
|
||||
|
||||
EndLookupBlock rec sink
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import [add-common-feature add-feature add-lookup BeginLookupBlock EndLookupBlock] from "./table-util"
|
||||
import [AddCommonFeature AddFeature AddLookup BeginLookupBlock EndLookupBlock] from"./table-util.mjs"
|
||||
|
||||
# Name-driven feature pairs
|
||||
export : define [buildGrFeature sink glyphStore gr] : begin
|
||||
|
@ -12,10 +12,10 @@ export : define [buildGrFeature sink glyphStore gr] : begin
|
|||
set mapping.(gnSrc) gnDst
|
||||
|
||||
if [objectIsNotEmpty mapping] : begin
|
||||
define lookup1 : add-lookup sink {.type 'gsub_single' .substitutions mapping}
|
||||
define feature1 : add-feature sink gr.otlTag
|
||||
define lookup1 : AddLookup sink {.type 'gsub_single' .substitutions mapping}
|
||||
define feature1 : AddFeature sink gr.otlTag
|
||||
feature1.lookups.push lookup1
|
||||
add-common-feature sink feature1
|
||||
AddCommonFeature sink feature1
|
||||
|
||||
EndLookupBlock rec sink
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import [add-common-feature add-feature ChainRuleBuilder BeginLookupBlock EndLookupBlock] from "./table-util"
|
||||
import [AddCommonFeature AddFeature ChainRuleBuilder BeginLookupBlock EndLookupBlock] from"./table-util.mjs"
|
||||
extern Set
|
||||
|
||||
define-operator "~>" 880 'right' : syntax-rules
|
||||
|
@ -54,7 +54,7 @@ define [buildLigationsImpl sink para featureName mappedFeature rankedLookups] :
|
|||
|
||||
define [hasLG ln] : [mappedFeature.indexOf ln] >= 0
|
||||
|
||||
define feature : add-common-feature sink : add-feature sink featureName
|
||||
define feature : AddCommonFeature sink : AddFeature sink featureName
|
||||
|
||||
local lastLookupName null
|
||||
local lookupRank 0
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
import [copy-language add-feature add-lookup BeginLookupBlock EndLookupBlock] from "./table-util"
|
||||
import [CopyLanguage AddFeature AddLookup BeginLookupBlock EndLookupBlock] from"./table-util.mjs"
|
||||
|
||||
export : define [buildLOCL sink para glyphStore] : begin
|
||||
local rec : BeginLookupBlock sink
|
||||
|
||||
define cyrlSRB : copy-language sink 'cyrl_SRB ' 'cyrl_DFLT'
|
||||
define cyrlMKD : copy-language sink 'cyrl_MKD ' 'cyrl_DFLT'
|
||||
define cyrlBGR : copy-language sink 'cyrl_BGR ' 'cyrl_DFLT'
|
||||
define cyrlSRB : CopyLanguage sink 'cyrl_SRB ' 'cyrl_DFLT'
|
||||
define cyrlMKD : CopyLanguage sink 'cyrl_MKD ' 'cyrl_DFLT'
|
||||
define cyrlBGR : CopyLanguage sink 'cyrl_BGR ' 'cyrl_DFLT'
|
||||
|
||||
# SRB
|
||||
define loclSRB : add-feature sink 'locl'
|
||||
define loclSRB : AddFeature sink 'locl'
|
||||
cyrlSRB.features.unshift loclSRB.name
|
||||
cyrlMKD.features.unshift loclSRB.name
|
||||
loclSRB.lookups.push : add-lookup sink : object
|
||||
loclSRB.lookups.push : AddLookup sink : object
|
||||
type 'gsub_single'
|
||||
substitutions : if para.isItalic
|
||||
object
|
||||
|
@ -25,9 +25,9 @@ export : define [buildLOCL sink para glyphStore] : begin
|
|||
'cyrl/be' : glyphStore.ensureExists 'cyrl/be.SRB'
|
||||
|
||||
# BGR
|
||||
define loclBGR : add-feature sink 'locl'
|
||||
define loclBGR : AddFeature sink 'locl'
|
||||
cyrlBGR.features.unshift loclBGR.name
|
||||
loclBGR.lookups.push : add-lookup sink : object
|
||||
loclBGR.lookups.push : AddLookup sink : object
|
||||
type 'gsub_single'
|
||||
substitutions : object
|
||||
'cyrl/ve' : glyphStore.ensureExists 'cyrl/ve.BGR'
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import [add-common-feature add-feature add-lookup ChainRuleBuilder query-related-glyphs BeginLookupBlock EndLookupBlock] from "./table-util"
|
||||
import [AddCommonFeature AddFeature AddLookup ChainRuleBuilder QueryRelatedGlyphs BeginLookupBlock EndLookupBlock] from"./table-util.mjs"
|
||||
|
||||
define-operator "~>" 880 'right' : syntax-rules
|
||||
`(@l ~> @r) `{.left @l .right @r}
|
||||
|
@ -6,7 +6,7 @@ define-operator "~>" 880 'right' : syntax-rules
|
|||
export : define [buildGsubThousands sink para] : begin
|
||||
local rec : BeginLookupBlock sink
|
||||
|
||||
define Thousand : add-feature sink 'THND'
|
||||
define Thousand : AddFeature sink 'THND'
|
||||
define {chain-rule reverse-rule} : ChainRuleBuilder sink
|
||||
define numberGlyphIDs {
|
||||
'zero.lnum' 'one.lnum' 'two.lnum' 'three.lnum' 'four.lnum'
|
||||
|
@ -15,7 +15,7 @@ export : define [buildGsubThousands sink para] : begin
|
|||
|
||||
define [nd s] : numberGlyphIDs.map : lambda [x] "\(x).nd\(s)"
|
||||
|
||||
define lookupThousand1 : add-lookup sink : object
|
||||
define lookupThousand1 : AddLookup sink : object
|
||||
.type 'gsub_chaining'
|
||||
.rules : list
|
||||
chain-rule ({'period'} ~> null) (numberGlyphIDs ~> [nd 2]) (numberGlyphIDs ~> null) (numberGlyphIDs ~> null)
|
||||
|
@ -26,13 +26,13 @@ export : define [buildGsubThousands sink para] : begin
|
|||
chain-rule ([nd 4] ~> null) (numberGlyphIDs ~> [nd 3])
|
||||
chain-rule ([nd 3] ~> null) (numberGlyphIDs ~> [nd 2])
|
||||
|
||||
define lookupThousand2 : add-lookup sink : object
|
||||
define lookupThousand2 : AddLookup sink : object
|
||||
.type 'gsub_chaining'
|
||||
.rules : list
|
||||
chain-rule (numberGlyphIDs ~> [nd 0]) (numberGlyphIDs ~> null) (numberGlyphIDs ~> null) (numberGlyphIDs ~> null)
|
||||
chain-rule ([nd 0] ~> null) (numberGlyphIDs ~> [nd 0])
|
||||
|
||||
define lookupThousand3 : add-lookup sink : object
|
||||
define lookupThousand3 : AddLookup sink : object
|
||||
.type 'gsub_reverse'
|
||||
.rules : list
|
||||
reverse-rule ([nd 0] ~> [nd 1]) ([nd 0] ~> null)
|
||||
|
@ -45,5 +45,5 @@ export : define [buildGsubThousands sink para] : begin
|
|||
|
||||
|
||||
Thousand.lookups.push lookupThousand1 lookupThousand2 lookupThousand3
|
||||
add-common-feature sink Thousand
|
||||
AddCommonFeature sink Thousand
|
||||
EndLookupBlock rec sink
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
import as toposort from 'toposort'
|
||||
import as Gr from '../support/gr'
|
||||
import as Gr from"../support/gr.mjs"
|
||||
|
||||
import [CreateEmptyTable finalizeTable MoveBackUtilityLookups] from "./table-util"
|
||||
import [CreateEmptyTable FinalizeTable MoveBackUtilityLookups] from"./table-util.mjs"
|
||||
|
||||
import [buildLigations] from './gsub-ligation'
|
||||
import [buildCCMP] from './gsub-ccmp'
|
||||
import [buildGrFeature] from './gsub-gr'
|
||||
import [buildFrac] from './gsub-frac'
|
||||
import [buildCVSS] from './gsub-cv-ss'
|
||||
import [buildLOCL] from './gsub-locl'
|
||||
import [buildGsubThousands] from './gsub-thousands'
|
||||
import [buildMarkMkmk] from "./gpos-mark-mkmk"
|
||||
import [BuildCompatLigatures] from './compat-ligature'
|
||||
import [buildLigations] from"./gsub-ligation.mjs"
|
||||
import [buildCCMP] from"./gsub-ccmp.mjs"
|
||||
import [buildGrFeature] from"./gsub-gr.mjs"
|
||||
import [buildFrac] from"./gsub-frac.mjs"
|
||||
import [buildCVSS] from"./gsub-cv-ss.mjs"
|
||||
import [buildLOCL] from"./gsub-locl.mjs"
|
||||
import [buildGsubThousands] from"./gsub-thousands.mjs"
|
||||
import [buildMarkMkmk] from"./gpos-mark-mkmk.mjs"
|
||||
import [BuildCompatLigatures] from"./compat-ligature.mjs"
|
||||
|
||||
define GDEF_SIMPLE 1
|
||||
define GDEF_LIGATURE 2
|
||||
|
@ -61,14 +61,14 @@ define [buildGSUB para glyphStore markGlyphs] : begin
|
|||
buildLOCL gsub para glyphStore
|
||||
|
||||
MoveBackUtilityLookups gsub
|
||||
finalizeTable gsub
|
||||
FinalizeTable gsub
|
||||
return gsub
|
||||
|
||||
# GPOS
|
||||
define [buildGPOS para glyphStore markGlyphs] : begin
|
||||
define gpos : CreateEmptyTable
|
||||
buildMarkMkmk gpos glyphStore
|
||||
finalizeTable gpos
|
||||
FinalizeTable gpos
|
||||
return gpos
|
||||
|
||||
# GDEF
|
||||
|
|
|
@ -1,27 +1,27 @@
|
|||
import as toposort from 'toposort'
|
||||
import [AnyCv] from "../support/gr"
|
||||
import toposort from 'toposort'
|
||||
import [AnyCv] from"../support/gr.mjs"
|
||||
|
||||
export : define [CreateEmptyTable] {.languages {.} .features {.} .lookups {.} .lookupDep {}}
|
||||
extern Map
|
||||
extern Set
|
||||
|
||||
export : define [pick-language sink tag] : begin
|
||||
export : define [PickLanguage sink tag] : begin
|
||||
if sink.languages.(tag) : return sink.languages.(tag)
|
||||
define lang {.features {}}
|
||||
set sink.languages.(tag) lang
|
||||
return lang
|
||||
|
||||
export : define [copy-language sink tag tagFrom] : begin
|
||||
define langFrom : pick-language sink tagFrom
|
||||
define langTo : pick-language sink tag
|
||||
export : define [CopyLanguage sink tag tagFrom] : begin
|
||||
define langFrom : PickLanguage sink tagFrom
|
||||
define langTo : PickLanguage sink tag
|
||||
foreach [feat : items-of langFrom.features] : langTo.features.push feat
|
||||
return langTo
|
||||
|
||||
export : define [add-lang-feature lang fea] : begin
|
||||
export : define [AddLangFeature lang fea] : begin
|
||||
define index : lang.features.indexOf fea.name
|
||||
if (index < 0) : lang.features.push fea.name
|
||||
|
||||
export : define [add-feature sink tag] : begin
|
||||
export : define [AddFeature sink tag] : begin
|
||||
define lookupArray {}
|
||||
local n 0
|
||||
while true : begin
|
||||
|
@ -30,17 +30,17 @@ export : define [add-feature sink tag] : begin
|
|||
return {.name (tag + '_' + n) .lookups lookupArray}
|
||||
set n : n + 1
|
||||
|
||||
export : define [pick-feature sink name] : begin
|
||||
export : define [PickFeature sink name] : begin
|
||||
if sink.features.(name) : return { .name name .lookups sink.features.(name) }
|
||||
define featObj { .name name .lookups {} }
|
||||
set sink.features.(name) featObj.lookups
|
||||
return featObj
|
||||
|
||||
export : define [add-feature-lookup fea lookupName] : begin
|
||||
export : define [AdeFeatureLookup fea lookupName] : begin
|
||||
define index : fea.lookups.indexOf lookupName
|
||||
if (index < 0) : fea.lookups.push lookupName
|
||||
|
||||
export : define [add-lookup sink data _prefix] : begin
|
||||
export : define [AddLookup sink data _prefix] : begin
|
||||
local prefix : _prefix || '_lut_'
|
||||
local n 0
|
||||
while true : begin
|
||||
|
@ -49,21 +49,21 @@ export : define [add-lookup sink data _prefix] : begin
|
|||
return (prefix + n)
|
||||
set n : n + 1
|
||||
|
||||
export : define [pick-lookup sink name fallback] : begin
|
||||
export : define [PickLookup sink name fallback] : begin
|
||||
if sink.lookups.(name) : return sink.lookups.(name)
|
||||
set sink.lookups.(name) fallback
|
||||
return sink.lookups.(name)
|
||||
|
||||
export : define [add-common-feature sink fea] : begin
|
||||
define dfltDflt : pick-language sink 'DFLT_DFLT'
|
||||
define latnDflt : pick-language sink 'latn_DFLT'
|
||||
define grekDflt : pick-language sink 'grek_DFLT'
|
||||
define cyrlDflt : pick-language sink 'cyrl_DFLT'
|
||||
export : define [AddCommonFeature sink fea] : begin
|
||||
define dfltDflt : PickLanguage sink 'DFLT_DFLT'
|
||||
define latnDflt : PickLanguage sink 'latn_DFLT'
|
||||
define grekDflt : PickLanguage sink 'grek_DFLT'
|
||||
define cyrlDflt : PickLanguage sink 'cyrl_DFLT'
|
||||
|
||||
add-lang-feature dfltDflt fea
|
||||
add-lang-feature latnDflt fea
|
||||
add-lang-feature grekDflt fea
|
||||
add-lang-feature cyrlDflt fea
|
||||
AddLangFeature dfltDflt fea
|
||||
AddLangFeature latnDflt fea
|
||||
AddLangFeature grekDflt fea
|
||||
AddLangFeature cyrlDflt fea
|
||||
|
||||
return fea
|
||||
|
||||
|
@ -97,7 +97,7 @@ export : define [ChainRuleBuilder sink] : begin
|
|||
define [createNewLookup f t] : begin
|
||||
local subst {.}
|
||||
foreach [j : range 0 f.length] : set subst.(f.(j)) t.(j)
|
||||
return : add-lookup sink {.type 'gsub_single' .substitutions subst} UtilityLookupPrefix
|
||||
return : AddLookup sink {.type 'gsub_single' .substitutions subst} UtilityLookupPrefix
|
||||
|
||||
define [getSubLookup left right] : piecewise
|
||||
[not right] null
|
||||
|
@ -172,7 +172,7 @@ export : define [ChainRuleBuilder sink] : begin
|
|||
|
||||
return {chain-rule reverse-rule}
|
||||
|
||||
export : define [query-related-glyphs glyphs para entries] : begin
|
||||
export : define [QueryRelatedGlyphs glyphs para entries] : begin
|
||||
define sink {}
|
||||
foreach [gid : items-of entries] : if glyphs.(gid) : begin
|
||||
sink.push gid
|
||||
|
@ -180,7 +180,7 @@ export : define [query-related-glyphs glyphs para entries] : begin
|
|||
sink.push : gr.get glyphs.(gid)
|
||||
return sink
|
||||
|
||||
export : define [finalizeTable table] : begin
|
||||
export : define [FinalizeTable table] : begin
|
||||
set table.lookupOrder : toposort table.lookupDep
|
||||
foreach [{key lang} : pairs-of table.languages] : begin
|
||||
if lang.features : lang.features.sort
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue