100 lines
3.8 KiB
Text
100 lines
3.8 KiB
Text
$$include '../meta/macros.ptl'
|
|
|
|
import [CopyLanguage AddFeature AddLookup BeginLookupBlock EndLookupBlock ChainRuleBuilder] from"./table-util.mjs"
|
|
import [CvDecompose] from"../support/gr.mjs"
|
|
|
|
extern Set
|
|
|
|
export : define [buildLOCL sink para glyphStore] : begin
|
|
local rec : BeginLookupBlock sink
|
|
|
|
define { chain-rule } : ChainRuleBuilder sink
|
|
|
|
define cyrlSRB : CopyLanguage sink 'cyrl_SRB ' 'cyrl_DFLT'
|
|
define cyrlMKD : CopyLanguage sink 'cyrl_MKD ' 'cyrl_DFLT'
|
|
define cyrlBGR : CopyLanguage sink 'cyrl_BGR ' 'cyrl_DFLT'
|
|
define latnVIT : CopyLanguage sink 'latn_VIT ' 'latn_DFLT'
|
|
|
|
# SRB
|
|
define loclSRB : AddFeature sink 'locl'
|
|
cyrlSRB.features.unshift loclSRB.name
|
|
cyrlMKD.features.unshift loclSRB.name
|
|
loclSRB.lookups.push : AddLookup sink : object
|
|
type 'gsub_single'
|
|
substitutions : if para.isItalic
|
|
object
|
|
'cyrl/be' : glyphStore.ensureExists 'cyrl/be.SRB'
|
|
'cyrl/ghe' : glyphStore.ensureExists 'cyrl/ghe.SRB'
|
|
'cyrl/de' : glyphStore.ensureExists 'cyrl/de.SRB'
|
|
'cyrl/gje' : glyphStore.ensureExists 'cyrl/gje.SRB'
|
|
'cyrl/pe' : glyphStore.ensureExists 'cyrl/pe.SRB'
|
|
'cyrl/te' : glyphStore.ensureExists 'cyrl/te.SRB'
|
|
object
|
|
'cyrl/be' : glyphStore.ensureExists 'cyrl/be.SRB'
|
|
|
|
# BGR
|
|
define loclBGR : AddFeature sink 'locl'
|
|
cyrlBGR.features.unshift loclBGR.name
|
|
loclBGR.lookups.push : AddLookup sink : object
|
|
type 'gsub_single'
|
|
substitutions : object
|
|
'cyrl/ve' : glyphStore.ensureExists 'cyrl/ve.BGR'
|
|
'cyrl/ghe' : glyphStore.ensureExists 'cyrl/ghe.italic'
|
|
'cyrl/De' : glyphStore.ensureExists 'cyrl/De.BGR'
|
|
'cyrl/de' : glyphStore.ensureExists 'cyrl/de.BGR'
|
|
'cyrl/zhe' : glyphStore.ensureExists 'cyrl/zhe.BGR'
|
|
'cyrl/ze' : glyphStore.ensureExists 'cyrl/ze.BGR'
|
|
'cyrl/i' : glyphStore.ensureExists 'cyrl/i.BGR'
|
|
'cyrl/ibreve' : glyphStore.ensureExists 'cyrl/ibreve.BGR'
|
|
'cyrl/igrave' : glyphStore.ensureExists 'cyrl/igrave.BGR'
|
|
'cyrl/ka' : glyphStore.ensureExists 'cyrl/ka.BGR'
|
|
'cyrl/El' : glyphStore.ensureExists 'cyrl/El.BGR'
|
|
'cyrl/el' : glyphStore.ensureExists 'cyrl/el.BGR'
|
|
'cyrl/en' : glyphStore.ensureExists 'cyrl/en.BGR'
|
|
'cyrl/pe' : glyphStore.ensureExists 'cyrl/pe.BGR'
|
|
'cyrl/te' : glyphStore.ensureExists 'cyrl/te.BGR'
|
|
'cyrl/che' : glyphStore.ensureExists 'cyrl/che.BGR'
|
|
'cyrl/sha' : glyphStore.ensureExists 'cyrl/sha.BGR'
|
|
'cyrl/shcha' : glyphStore.ensureExists 'cyrl/shcha.BGR'
|
|
'cyrl/yu' : glyphStore.ensureExists 'cyrl/yu.BGR'
|
|
'cyrl/tse' : glyphStore.ensureExists 'cyrl/tse.BGR'
|
|
'cyrl/yer' : glyphStore.ensureExists 'cyrl/yer.BGR'
|
|
'cyrl/yeri' : glyphStore.ensureExists 'cyrl/yeri.BGR'
|
|
|
|
# VIT
|
|
define loclVIT : AddFeature sink 'locl'
|
|
latnVIT.features.unshift loclVIT.name
|
|
|
|
define [sx s] : lambda [t] : t.map : lambda [x] "\(x)/\(s)"
|
|
|
|
do "Decompose Vietnamese glyphs"
|
|
|
|
local decompositionSubstitutions {.}
|
|
loclVIT.lookups.push : AddLookup sink
|
|
.type 'gsub_multiple'
|
|
.substitutions decompositionSubstitutions
|
|
|
|
local viCircumflex 'ẦẤẨỀẾỂỒỐỔầấẩềếểồốổ'
|
|
local viBreve 'ẮẰẲằắẳ'
|
|
local viShiftableMarks { 'acuteAbove' 'graveAbove' 'hookAbove' }
|
|
|
|
foreach ch (viCircumflex + viBreve) : begin
|
|
local u : ch.codePointAt 0
|
|
local gn : glyphStore.queryNameByUnicode u
|
|
local g : glyphStore.queryByNameEnsured gn
|
|
local decomp : CvDecompose.get g
|
|
set decompositionSubstitutions.(gn) decomp
|
|
|
|
loclVIT.lookups.push : AddLookup sink
|
|
.type 'gsub_chaining'
|
|
.rules : list
|
|
chain-rule
|
|
{'A' 'a' 'E' 'e' 'O' 'o'} ~> nothing
|
|
{'circumflexAbove'} ~> nothing
|
|
viShiftableMarks ~> [sx 'viSide']
|
|
chain-rule
|
|
{'A' 'a'} ~> nothing
|
|
{'breveAbove'} ~> nothing
|
|
viShiftableMarks ~> [sx 'viCenter']
|
|
|
|
EndLookupBlock.Front rec sink
|