Add ligation for chained hyphens and tildes (#893).

This commit is contained in:
be5invis 2021-02-22 23:31:01 -08:00
parent 66b43126f3
commit ba6e5c5b58
4 changed files with 126 additions and 52 deletions

View file

@ -25,7 +25,7 @@ define [buildLigationsImpl sink para featureName mappedFeature rankedLookups] :
define [stickClass style] : [lsx style] {'hyphen' 'equal'}
define [stickTf style] : {'hyphen' 'equal'} ~> [lsx style]
define anyWave {'asciiTilde' 'asciiTilde.low' 'asciiTilde.high'}
define [waveClass cl] : [just ('wave.' + cl)] anyWave
define [waveClass cl] : [just ('wave.lig.' + cl)] anyWave
define [waveTf cl] : anyWave ~> [waveClass cl]
define less {'less'}
@ -240,45 +240,6 @@ define [buildLigationsImpl sink para featureName mappedFeature rankedLookups] :
dRight ~> dRightHalf
dLeft ~> dLeftHalf
do "Plus chains" : if [hasLG 'plusplus'] : begin
CreateLigationLookup : list
# +++++++++
chain-rule
{'plus.lig.cr' 'plus.lig.jr'} ~> look-around
{'plus'} ~> [lsx 'jr']
chain-rule
{'plus'} ~> [lsx 'lc']
{'plus'} ~> [lsx 'cc']
{'plus'} ~> [lsx 'cc']
{'plus'} ~> [lsx 'cr']
chain-rule
{'plus'} ~> [lsx 'lc']
{'plus'} ~> [lsx 'cc']
{'plus'} ~> [lsx 'cr']
chain-rule
{'plus'} ~> [lsx 'lc']
{'plus'} ~> [lsx 'cr']
CreateLigationLookup : list
chain-rule # +++
{'plus.lig.lc'} ~> {'plus.lig.lc.s'}
{'plus.lig.cc'} ~> look-around
{'plus.lig.cr'} ~> {'plus.lig.cr.s'}
chain-rule # ++
{'plus.lig.lc'} ~> {'plus.lig.lc.s'}
{'plus.lig.cr'} ~> {'plus.lig.cr.s'}
do "Underscore chains" : if [hasLG 'connected-underscore'] : begin
CreateLigationLookup : list
chain-rule
{'underscore' 'underscore.jr'} ~> look-around
{'underscore'} ~> {'underscore.jr'}
do "Number sign chains" : if [hasLG 'connected-number-sign'] : begin
CreateLigationLookup : list
chain-rule
{'numberSign' 'numberSign.jr'} ~> look-around
{'numberSign'} ~> {'numberSign.jr'}
do "triangles" : if [hasLG 'trig'] : begin
CreateLigationLookup : list
chain-rule # <|
@ -387,7 +348,7 @@ define [buildLigationsImpl sink para featureName mappedFeature rankedLookups] :
define [CBarSingular k] : begin
local hyphenSet : new Set hyphen
local fHyphen : lsx k
local fWave : just "wave.\(k)"
local fWave : just "wave.lig.\(k)"
return : lambda [t] : begin
local hyphenResults : fHyphen t
local waveResults : fWave t
@ -403,7 +364,7 @@ define [buildLigationsImpl sink para featureName mappedFeature rankedLookups] :
# rod FBarCls
list equal lsx
list hyphen lsx
list anyWave [lambda [k] [just "wave.\(k)"]]
list anyWave [lambda [k] [just "wave.lig.\(k)"]]
foreach [{barCls dbl ltgt CBar} : items-of ArrowFormationConfig] : do
define heads {}
@ -918,3 +879,92 @@ define [buildLigationsImpl sink para featureName mappedFeature rankedLookups] :
chain-rule
{'bar'} ~> {'ligBarInsideBracketRight'}
{'braceRight'} ~> {'ligExtBraceRight'}
do "Plus chains" : if [hasLG 'plusplus'] : begin
CreateLigationLookup : list
# +++++++++
chain-rule
{'plus.lig.cf' 'plus.lig.zf'} ~> look-around
{'plus'} ~> [lsx 'zf']
chain-rule
{'plus'} ~> [lsx 'fc']
{'plus'} ~> [lsx 'cc']
{'plus'} ~> [lsx 'cc']
{'plus'} ~> [lsx 'cf']
chain-rule
{'plus'} ~> [lsx 'fc']
{'plus'} ~> [lsx 'cc']
{'plus'} ~> [lsx 'cf']
chain-rule
{'plus'} ~> [lsx 'fc']
{'plus'} ~> [lsx 'cf']
CreateLigationLookup : list
chain-rule # +++
{'plus.lig.fc'} ~> {'plus.lig.fc.s'}
{'plus.lig.cc'} ~> look-around
{'plus.lig.cf'} ~> {'plus.lig.cf.s'}
chain-rule # ++
{'plus.lig.fc'} ~> {'plus.lig.fc.s'}
{'plus.lig.cf'} ~> {'plus.lig.cf.s'}
do "Underscore chains" : if [hasLG 'connected-underscore'] : begin
CreateLigationLookup : list
chain-rule
{'underscore' 'underscore.jr'} ~> look-around
{'underscore'} ~> {'underscore.jr'}
do "Tilde chains" : if [hasLG 'connected-tilde-as-wave'] : begin
CreateLigationLookup : list
chain-rule
{'wave.lig.cf' 'wave.lig.zf'} ~> look-around
{'asciiTilde'} ~> {'wave.lig.zf'}
chain-rule
{'asciiTilde'} ~> {"wave.lig.fc"}
{'asciiTilde'} ~> {"wave.lig.cf"}
do "Hyphen chains" : if [hasLG 'connected-hyphen-as-solid-line'] : begin
CreateLigationLookup : list
chain-rule
{'hyphen.lig.zf'} ~> look-around
{'hyphen'} ~> {'hyphen.lig.zf'}
chain-rule
{'hyphen'} ~> {"hyphen.lig.fc"}
{'hyphen'} ~> {"hyphen.lig.zf"}
CreateLigationLookup : list
chain-rule
{'hyphen.lig.jf'} ~> {'hyphen.lig.jc'}
{'hyphen'} ~> {'hyphen.lig.cc'}
{'hyphen.lig.fj'} ~> {'hyphen.lig.cj'}
chain-rule
{'hyphen.lig.jf'} ~> {'hyphen.lig.jc'}
{'hyphen.lig.fc'} ~> {'hyphen.lig.cc'}
chain-rule
{'hyphen.lig.zf'} ~> {'hyphen.lig.zc'}
{'hyphen.lig.fj'} ~> {'hyphen.lig.cj'}
do "Hyphen chains" : if [hasLG 'connected-hyphen-as-semi-dashed-line'] : begin
CreateLigationLookup : list
chain-rule
{'hyphen.lig.zf.notched'} ~> look-around
{'hyphen'} ~> {'hyphen.lig.zf.notched'}
chain-rule
{'hyphen'} ~> {"hyphen.lig.fc.notched"}
{'hyphen'} ~> {"hyphen.lig.zf.notched"}
CreateLigationLookup : list
chain-rule
{'hyphen.lig.jf'} ~> {'hyphen.lig.jc.notched'}
{'hyphen'} ~> {'hyphen.lig.cc.notched'}
{'hyphen.lig.fj'} ~> {'hyphen.lig.cj.notched'}
chain-rule
{'hyphen.lig.jf'} ~> {'hyphen.lig.jc.notched'}
{'hyphen.lig.fc.notched'} ~> {'hyphen.lig.cc.notched'}
chain-rule
{'hyphen.lig.zf.notched'} ~> {'hyphen.lig.zc.notched'}
{'hyphen.lig.fj'} ~> {'hyphen.lig.cj.notched'}
do "Number sign chains" : if [hasLG 'connected-number-sign'] : begin
CreateLigationLookup : list
chain-rule
{'numberSign' 'numberSign.jr'} ~> look-around
{'numberSign'} ~> {'numberSign.jr'}