Improve ligation set for logical operators; Add bar kerning to match JetBrains Mono (#1192).
This commit is contained in:
parent
5ec1291c65
commit
5e7a32a86c
6 changed files with 227 additions and 138 deletions
|
@ -32,6 +32,7 @@ define [buildLigationsImpl sink para featureName mappedFeature rankedLookups] :
|
|||
define lessAndEquiv {'less' 'less.lig.shift0' 'less.lig.shift0.anti'}
|
||||
define hyphen {'hyphen'}
|
||||
define equal {'equal'}
|
||||
define anyStraightRod { 'hyphen' 'equal' }
|
||||
define exclam {'exclam'}
|
||||
define greater {'greater'}
|
||||
define greaterAndEquiv {'greater' 'greater.lig.shift0' 'greater.lig.shift0.anti'}
|
||||
|
@ -39,6 +40,7 @@ define [buildLigationsImpl sink para featureName mappedFeature rankedLookups] :
|
|||
define slash {'slash'}
|
||||
define backslash {'backslash'}
|
||||
define bar {'bar'}
|
||||
define underscore {'underscore'}
|
||||
define regexLookAround [less.concat hyphen equal exclam greater anyBar]
|
||||
|
||||
define [acops] {'less' 'greater' 'hyphen' 'equal' 'plus'}
|
||||
|
@ -195,8 +197,8 @@ define [buildLigationsImpl sink para featureName mappedFeature rankedLookups] :
|
|||
|
||||
foreach { dpShort dpTall } [items-of dottyPunctuationSets] : begin
|
||||
define dp : {}.concat dpShort dpTall
|
||||
define dLeft : [lsx 'dLeftHalf'] dp
|
||||
define dRight : [lsx 'dRightHalf'] dp
|
||||
define dLeft : [lsx 'dLeft'] dp
|
||||
define dRight : [lsx 'dRight'] dp
|
||||
define dLeftHalf : [lsx 'dLeftHalf'] dp
|
||||
define dRightHalf : [lsx 'dRightHalf'] dp
|
||||
define dMid : [lsx 'dMid'] dp
|
||||
|
@ -236,6 +238,19 @@ define [buildLigationsImpl sink para featureName mappedFeature rankedLookups] :
|
|||
boundary ~> look-around
|
||||
|
||||
CreateLigationLookup : list
|
||||
chain-rule
|
||||
dRight ~> look-around
|
||||
dMid ~> dRightHalf
|
||||
dMid ~> dLeftHalf
|
||||
dLeft ~> look-around
|
||||
chain-rule
|
||||
dRight ~> look-around
|
||||
dMid ~> dRightHalf
|
||||
dMid ~> look-around
|
||||
chain-rule
|
||||
dMid ~> look-around
|
||||
dMid ~> dLeftHalf
|
||||
dLeft ~> look-around
|
||||
chain-rule
|
||||
dRight ~> dRightHalf
|
||||
dLeft ~> dLeftHalf
|
||||
|
@ -366,7 +381,7 @@ define [buildLigationsImpl sink para featureName mappedFeature rankedLookups] :
|
|||
list hyphen lsx
|
||||
list anyWave [lambda [k] [just "wave.lig.\(k)"]]
|
||||
|
||||
foreach [{barCls dbl ltgt CBar} : items-of ArrowFormationConfig] : do
|
||||
foreach [{rodCls dbl ltgt CRod} : items-of ArrowFormationConfig] : do
|
||||
define heads {}
|
||||
define rods {}
|
||||
|
||||
|
@ -418,211 +433,209 @@ define [buildLigationsImpl sink para featureName mappedFeature rankedLookups] :
|
|||
# Arrow head identifier
|
||||
begin "Central"
|
||||
heads.push : chain-rule # = > > =
|
||||
barCls ~> look-around
|
||||
rodCls ~> look-around
|
||||
greater ~> [TJoinHeadForceShift1]
|
||||
greater ~> [TAntiHeadForce]
|
||||
barCls ~> look-around
|
||||
rodCls ~> look-around
|
||||
heads.push : chain-rule # = < < =
|
||||
barCls ~> look-around
|
||||
rodCls ~> look-around
|
||||
less ~> [TAntiHeadForce]
|
||||
less ~> [TJoinHeadForceShift1]
|
||||
barCls ~> look-around
|
||||
rodCls ~> look-around
|
||||
heads.push : chain-rule # = > < =
|
||||
barCls ~> look-around
|
||||
rodCls ~> look-around
|
||||
greater ~> [TJoinHeadForce]
|
||||
less ~> [TJoinHeadForce]
|
||||
barCls ~> look-around
|
||||
rodCls ~> look-around
|
||||
heads.push : chain-rule # = < > =
|
||||
barCls ~> look-around
|
||||
rodCls ~> look-around
|
||||
less ~> [TAntiHeadForce]
|
||||
greater ~> [TAntiHeadForce]
|
||||
barCls ~> look-around
|
||||
rodCls ~> look-around
|
||||
heads.push : chain-rule # = > =
|
||||
barCls ~> look-around
|
||||
rodCls ~> look-around
|
||||
greater ~> [TMiddleHead]
|
||||
barCls ~> look-around
|
||||
rodCls ~> look-around
|
||||
heads.push : chain-rule # = < =
|
||||
barCls ~> look-around
|
||||
rodCls ~> look-around
|
||||
less ~> [TMiddleHead]
|
||||
barCls ~> look-around
|
||||
rodCls ~> look-around
|
||||
begin "Boundary"
|
||||
heads.push : chain-rule # = > >
|
||||
barCls ~> look-around
|
||||
rodCls ~> look-around
|
||||
greater ~> [TJoinHeadForceShift1]
|
||||
greater ~> look-around
|
||||
heads.push : chain-rule # = < <
|
||||
barCls ~> look-around
|
||||
rodCls ~> look-around
|
||||
less ~> [TAntiHeadForceShiftN1]
|
||||
less ~> look-around
|
||||
heads.push : chain-rule # > > =
|
||||
greater ~> look-around
|
||||
greater ~> [TAntiHeadForceShiftN1]
|
||||
barCls ~> look-around
|
||||
rodCls ~> look-around
|
||||
heads.push : chain-rule # < < =
|
||||
less ~> look-around
|
||||
less ~> [TJoinHeadForceShift1]
|
||||
barCls ~> look-around
|
||||
rodCls ~> look-around
|
||||
heads.push : chain-rule # = = >
|
||||
barCls ~> look-around
|
||||
barCls ~> look-around
|
||||
rodCls ~> look-around
|
||||
rodCls ~> look-around
|
||||
greater ~> [TJoinHeadForce]
|
||||
heads.push : chain-rule # = = <
|
||||
barCls ~> look-around
|
||||
barCls ~> look-around
|
||||
rodCls ~> look-around
|
||||
rodCls ~> look-around
|
||||
less ~> [TAntiHeadForce]
|
||||
heads.push : chain-rule # > = =
|
||||
greater ~> [TAntiHeadForce]
|
||||
barCls ~> look-around
|
||||
barCls ~> look-around
|
||||
rodCls ~> look-around
|
||||
rodCls ~> look-around
|
||||
heads.push : chain-rule # < = =
|
||||
less ~> [TJoinHeadForce]
|
||||
barCls ~> look-around
|
||||
barCls ~> look-around
|
||||
rodCls ~> look-around
|
||||
rodCls ~> look-around
|
||||
heads.push : chain-rule # * = >
|
||||
arrowIndicator ~> look-around
|
||||
barCls ~> look-around
|
||||
rodCls ~> look-around
|
||||
greater ~> [TJoinHeadForce]
|
||||
heads.push : chain-rule # * = <
|
||||
arrowIndicator ~> look-around
|
||||
barCls ~> look-around
|
||||
rodCls ~> look-around
|
||||
less ~> [TAntiHeadForce]
|
||||
heads.push : chain-rule # > = *
|
||||
greater ~> [TAntiHeadForce]
|
||||
barCls ~> look-around
|
||||
rodCls ~> look-around
|
||||
arrowIndicator ~> look-around
|
||||
heads.push : chain-rule # < = *
|
||||
less ~> [TJoinHeadForce]
|
||||
barCls ~> look-around
|
||||
rodCls ~> look-around
|
||||
arrowIndicator ~> look-around
|
||||
begin "Ambiguous"
|
||||
heads.push : chain-rule # = >
|
||||
barCls ~> look-around
|
||||
rodCls ~> look-around
|
||||
greater ~> [TJoinHeadAmbig]
|
||||
heads.push : chain-rule # = <
|
||||
barCls ~> look-around
|
||||
rodCls ~> look-around
|
||||
less ~> [TAntiHeadAmbig]
|
||||
heads.push : chain-rule # > =
|
||||
greater ~> [TAntiHeadAmbig]
|
||||
barCls ~> look-around
|
||||
rodCls ~> look-around
|
||||
heads.push : chain-rule # < =
|
||||
less ~> [TJoinHeadAmbig]
|
||||
barCls ~> look-around
|
||||
rodCls ~> look-around
|
||||
|
||||
# Rod transformer
|
||||
define kindLeftMid : list
|
||||
list false 'l' : CollectApply less : list CJoinHeadForce CJoinHeadMid
|
||||
list false 'l1' : CollectApply less : list CJoinHeadForceShift1
|
||||
list false 'j' : CollectApply greater : list CAntiHeadForce CJoinHeadMid
|
||||
list true 'j' anyBar
|
||||
list true 'm' anyBar
|
||||
list false 'j1' : CollectApply greater : list CAntiHeadForceShiftN1
|
||||
define kindRightMid : list
|
||||
list false 'r' : CollectApply greater : list CJoinHeadForce CJoinHeadMid
|
||||
list false 'r1' : CollectApply greater : list CJoinHeadForceShift1
|
||||
list false 'j' : CollectApply less : list CAntiHeadForce CJoinHeadMid
|
||||
list true 'j' anyBar
|
||||
list true 'm' anyBar
|
||||
list false 'j1' : CollectApply less : list CAntiHeadForceShiftN1
|
||||
|
||||
# console.log featureName barCls kindLeftMid kindRightMid
|
||||
# console.log featureName rodCls kindLeftMid kindRightMid
|
||||
|
||||
foreach [{ lBar kl envL } : items-of kindLeftMid] : begin
|
||||
foreach [{ rBar kr envR } : items-of kindRightMid] : begin
|
||||
if (!lBar || !rBar) : begin
|
||||
rods.push : chain-rule # < - >
|
||||
envL ~> look-around
|
||||
barCls ~> [CBar "\(kl)\(kr)"]
|
||||
rodCls ~> [CRod "\(kl)\(kr)"]
|
||||
envR ~> look-around
|
||||
|
||||
foreach [{ lBar kl envL } : items-of kindLeftMid] : begin
|
||||
if (!lBar) : begin
|
||||
rods.push : chain-rule # < -
|
||||
envL ~> look-around
|
||||
barCls ~> [CBar "\(kl)f"]
|
||||
rodCls ~> [CRod "\(kl)f"]
|
||||
|
||||
foreach [{ rBar kr envR } : items-of kindRightMid] : begin
|
||||
if (!rBar) : begin
|
||||
rods.push : chain-rule # - >
|
||||
barCls ~> [CBar "f\(kr)"]
|
||||
rodCls ~> [CRod "f\(kr)"]
|
||||
envR ~> look-around
|
||||
|
||||
CreateLigationLookup heads
|
||||
CreateLigationLookup rods
|
||||
|
||||
foreach [{barCls CBar} : items-of ArrowExtensionConfig] : do
|
||||
do "Extended arrow sticks"
|
||||
# Extension
|
||||
local stickTermLeft {}
|
||||
local stickConnLeft {}
|
||||
foreach [lc : items-of {'l' 'l1' 'j' 'j1' 'c' 'z'}] : begin
|
||||
set stickTermLeft : stickTermLeft.concat : [CBar "\(lc)f"] barCls
|
||||
set stickConnLeft : stickConnLeft.concat : [CBar "\(lc)c"] barCls
|
||||
foreach [{rodCls CRod} : items-of ArrowExtensionConfig] : do "Extended arrow sticks"
|
||||
# Extension
|
||||
local rodTermLeft {}
|
||||
local rodConnLeft {}
|
||||
foreach [lc : items-of {'l' 'l1' 'j' 'j1' 'c' 'z' 'm'}] : begin
|
||||
set rodTermLeft : rodTermLeft.concat : [CRod "\(lc)f"] rodCls
|
||||
set rodConnLeft : rodConnLeft.concat : [CRod "\(lc)c"] rodCls
|
||||
|
||||
local stickTermRight {}
|
||||
local stickConnRight {}
|
||||
foreach [rc : items-of {'r' 'r1' 'j' 'j1' 'c' 'z'}] : begin
|
||||
set stickTermRight : stickTermRight.concat : [CBar "f\(rc)"] barCls
|
||||
set stickConnRight : stickConnRight.concat : [CBar "c\(rc)"] barCls
|
||||
local rodTermRight {}
|
||||
local rodConnRight {}
|
||||
foreach [rc : items-of {'r' 'r1' 'j' 'j1' 'c' 'z' 'm'}] : begin
|
||||
set rodTermRight : rodTermRight.concat : [CRod "f\(rc)"] rodCls
|
||||
set rodConnRight : rodConnRight.concat : [CRod "c\(rc)"] rodCls
|
||||
|
||||
CreateLigationLookup : list
|
||||
chain-rule
|
||||
stickTermLeft ~> look-around
|
||||
barCls ~> [CBar 'zf']
|
||||
CreateLigationLookup : list
|
||||
chain-rule
|
||||
rodTermLeft ~> look-around
|
||||
rodCls ~> [CRod 'zf']
|
||||
|
||||
CreateReverseLigationLookup : list
|
||||
reverse-rule
|
||||
barCls ~> [CBar 'fz']
|
||||
stickTermRight ~> look-around
|
||||
CreateReverseLigationLookup : list
|
||||
reverse-rule
|
||||
rodCls ~> [CRod 'fz']
|
||||
rodTermRight ~> look-around
|
||||
|
||||
# Fix for Apple : arrow bar at line start won't join with the rest (#548)
|
||||
CreateLigationLookup : list
|
||||
chain-rule
|
||||
barCls ~> [CBar 'fz']
|
||||
stickTermRight ~> look-around
|
||||
# Fix for Apple : arrow bar at line start won't join with the rest (#548)
|
||||
CreateLigationLookup : list
|
||||
chain-rule
|
||||
rodCls ~> [CRod 'fz']
|
||||
rodTermRight ~> look-around
|
||||
|
||||
CreateLigationLookup : list
|
||||
chain-rule
|
||||
stickTermLeft ~> look-around
|
||||
[[CBar 'zf'] barCls] ~> [[CBar 'zj'] barCls]
|
||||
anyBar ~> look-around
|
||||
chain-rule
|
||||
anyBar ~> look-around
|
||||
[[CBar 'fz'] barCls] ~> [[CBar 'jz'] barCls]
|
||||
stickTermRight ~> look-around
|
||||
CreateLigationLookup : list
|
||||
chain-rule
|
||||
rodTermLeft ~> look-around
|
||||
[[CRod 'zf'] rodCls] ~> [[CRod 'zm'] rodCls]
|
||||
anyBar ~> [lsx 'dMid']
|
||||
chain-rule
|
||||
anyBar ~> [lsx 'dMid']
|
||||
[[CRod 'fz'] rodCls] ~> [[CRod 'mz'] rodCls]
|
||||
rodTermRight ~> look-around
|
||||
|
||||
# Gap filling
|
||||
CreateLigationLookup : list
|
||||
chain-rule
|
||||
stickTermLeft ~> stickConnLeft
|
||||
stickTermRight ~> stickConnRight
|
||||
# Gap filling
|
||||
CreateLigationLookup : list
|
||||
chain-rule
|
||||
rodTermLeft ~> rodConnLeft
|
||||
rodTermRight ~> rodConnRight
|
||||
|
||||
foreach [{barCls dbl ltgt CBar} : items-of ArrowFormationConfig] : do
|
||||
foreach [{rodCls dbl ltgt CRod} : items-of ArrowFormationConfig] : do "Ambiguous rods"
|
||||
define [CJoinHeadForce] : if dbl [lsx 'dblhead'] [lsx 'shift0']
|
||||
define [CAntiHeadForce] : if dbl [lsx 'hole'] [lsx 'shift0.anti']
|
||||
|
||||
do "Ambiguous rods"
|
||||
define ambiguousRods {}
|
||||
ambiguousRods.push : chain-rule # =>
|
||||
barCls ~> [if [hasLG 'arrow'] [CBar 'fr'] advance]
|
||||
greater ~> [if [hasLG 'arrow'] [CJoinHeadForce] advance]
|
||||
if ltgt
|
||||
ambiguousRods.push : chain-rule # <=
|
||||
less ~> [if [hasLG 'arrowZALE'] [CJoinHeadForce] advance]
|
||||
barCls ~> [if [hasLG 'arrowZALE'] [CBar 'lf'] advance]
|
||||
ambiguousRods.push : chain-rule # <-
|
||||
less ~> [if [hasLG 'arrow'] [CJoinHeadForce] advance]
|
||||
barCls ~> [if [hasLG 'arrow'] [CBar 'lf'] advance]
|
||||
define ambiguousRods {}
|
||||
ambiguousRods.push : chain-rule # =>
|
||||
rodCls ~> [if [hasLG 'arrow'] [CRod 'fr'] advance]
|
||||
greater ~> [if [hasLG 'arrow'] [CJoinHeadForce] advance]
|
||||
if ltgt
|
||||
ambiguousRods.push : chain-rule # <=
|
||||
less ~> [if [hasLG 'arrowZALE'] [CJoinHeadForce] advance]
|
||||
rodCls ~> [if [hasLG 'arrowZALE'] [CRod 'lf'] advance]
|
||||
ambiguousRods.push : chain-rule # <-
|
||||
less ~> [if [hasLG 'arrow'] [CJoinHeadForce] advance]
|
||||
rodCls ~> [if [hasLG 'arrow'] [CRod 'lf'] advance]
|
||||
|
||||
ambiguousRods.push : chain-rule # =<
|
||||
barCls ~> [if [hasLG 'arrow2'] [CBar 'fj'] advance]
|
||||
less ~> [if [hasLG 'arrow2'] [CAntiHeadForce] advance]
|
||||
if ltgt
|
||||
ambiguousRods.push : chain-rule # >=
|
||||
greater ~> [if [hasLG 'arrowZAGE'] [CAntiHeadForce] advance]
|
||||
barCls ~> [if [hasLG 'arrowZAGE'] [CBar 'jf'] advance]
|
||||
ambiguousRods.push : chain-rule # >-
|
||||
greater ~> [if [hasLG 'arrow2'] [CAntiHeadForce] advance]
|
||||
barCls ~> [if [hasLG 'arrow2'] [CBar 'jf'] advance]
|
||||
ambiguousRods.push : chain-rule # =<
|
||||
rodCls ~> [if [hasLG 'arrow2'] [CRod 'fj'] advance]
|
||||
less ~> [if [hasLG 'arrow2'] [CAntiHeadForce] advance]
|
||||
if ltgt
|
||||
ambiguousRods.push : chain-rule # >=
|
||||
greater ~> [if [hasLG 'arrowZAGE'] [CAntiHeadForce] advance]
|
||||
rodCls ~> [if [hasLG 'arrowZAGE'] [CRod 'jf'] advance]
|
||||
ambiguousRods.push : chain-rule # >-
|
||||
greater ~> [if [hasLG 'arrow2'] [CAntiHeadForce] advance]
|
||||
rodCls ~> [if [hasLG 'arrow2'] [CRod 'jf'] advance]
|
||||
|
||||
CreateLigationLookup ambiguousRods
|
||||
CreateLigationLookup ambiguousRods
|
||||
|
||||
# <<, >>, <<<, >>>
|
||||
do "Less/Greater Chaining" : if [hasLG 'llgg'] : begin
|
||||
|
@ -701,17 +714,21 @@ define [buildLigationsImpl sink para featureName mappedFeature rankedLookups] :
|
|||
do "logical" : if [hasLG 'logic'] : begin
|
||||
CreateLigationLookup : list
|
||||
chain-rule
|
||||
slash ~> [csx 'left']
|
||||
backslash ~> [csx 'right']
|
||||
slash ~> [csx 'left']
|
||||
backslash ~> [csx 'right']
|
||||
chain-rule
|
||||
backslash ~> [csx 'left']
|
||||
slash ~> [csx 'right']
|
||||
backslash ~> [csx 'left']
|
||||
slash ~> [csx 'right']
|
||||
chain-rule
|
||||
bar ~> look-around
|
||||
hyphen ~> [lsx 'jf']
|
||||
bar ~> [lsx "dMid"]
|
||||
anyStraightRod ~> [lsx 'mf']
|
||||
chain-rule
|
||||
hyphen ~> [lsx 'fj']
|
||||
bar ~> look-around
|
||||
anyStraightRod ~> [lsx 'fm']
|
||||
bar ~> [lsx "dMid"]
|
||||
chain-rule
|
||||
underscore ~> [lsx 'fm']
|
||||
bar ~> [lsx 'bottomMid']
|
||||
underscore ~> [lsx 'mf']
|
||||
|
||||
# == and !=, and other related
|
||||
do "equals" : begin
|
||||
|
@ -911,8 +928,8 @@ define [buildLigationsImpl sink para featureName mappedFeature rankedLookups] :
|
|||
do "Underscore chains" : if [hasLG 'connected-underscore'] : begin
|
||||
CreateLigationLookup : list
|
||||
chain-rule
|
||||
{'underscore' 'underscore.jr'} ~> look-around
|
||||
{'underscore'} ~> {'underscore.jr'}
|
||||
[underscore.concat : [lsx 'zf'] underscore] ~> look-around
|
||||
underscore ~> [lsx 'zf']
|
||||
|
||||
do "Tilde chains" : if [hasLG 'connected-tilde-as-wave'] : begin
|
||||
CreateLigationLookup : list
|
||||
|
@ -968,3 +985,41 @@ define [buildLigationsImpl sink para featureName mappedFeature rankedLookups] :
|
|||
chain-rule
|
||||
{'numberSign' 'numberSign.jr'} ~> look-around
|
||||
{'numberSign'} ~> {'numberSign.jr'}
|
||||
|
||||
do "Kern Bars" : if [hasLG 'kern-bars'] : foreach chBar [items-of anyBar] : begin
|
||||
define dp { chBar }
|
||||
define dLeft : [lsx 'dLeft'] dp
|
||||
define dRight : [lsx 'dRight'] dp
|
||||
define dLeftHalf : [lsx 'dLeftHalf'] dp
|
||||
define dRightHalf : [lsx 'dRightHalf'] dp
|
||||
define dMid : [lsx 'dMid'] dp
|
||||
|
||||
CreateLigationLookup : list
|
||||
chain-rule
|
||||
[dRight.concat dMid] ~> look-around
|
||||
dp ~> dMid
|
||||
[dp.concat dMid] ~> look-around
|
||||
chain-rule
|
||||
[dRight.concat dMid] ~> look-around
|
||||
dp ~> dLeft
|
||||
chain-rule
|
||||
dp ~> dRight
|
||||
[dp.concat dMid] ~> look-around
|
||||
|
||||
CreateLigationLookup : list
|
||||
chain-rule
|
||||
dRight ~> look-around
|
||||
dMid ~> dRightHalf
|
||||
dMid ~> dLeftHalf
|
||||
dLeft ~> look-around
|
||||
chain-rule
|
||||
dRight ~> look-around
|
||||
dMid ~> dRightHalf
|
||||
dMid ~> look-around
|
||||
chain-rule
|
||||
dMid ~> look-around
|
||||
dMid ~> dLeftHalf
|
||||
dLeft ~> look-around
|
||||
chain-rule
|
||||
dRight ~> dRightHalf
|
||||
dLeft ~> dLeftHalf
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue