* Add ligation set for HTML/XML/React tags (<>
, </
, />
and </>
) (#1413).
This commit is contained in:
parent
98047130c2
commit
70e9c2aa37
6 changed files with 149 additions and 62 deletions
1
changes/16.2.0.md
Normal file
1
changes/16.2.0.md
Normal file
|
@ -0,0 +1 @@
|
|||
* Add ligation set for HTML/XML/React tags (`<>`, `</`, `/>` and `</>`) (#1413).
|
|
@ -188,33 +188,40 @@ glyph-block Symbol-Ligation : begin
|
|||
include : Translate (arrowheadsKern * k) 0
|
||||
if (k > 0) : Joining.set currentGlyph Joining.Classes.Right
|
||||
if (k < 0) : Joining.set currentGlyph Joining.Classes.Left
|
||||
|
||||
create-glyph 'greater.lig.shift0' : glyph-proc
|
||||
include [refer-glyph 'greater'] AS_BASE ALSO_METRICS
|
||||
create-aliased-glyph 'greater.lig.shift0.head'
|
||||
create-aliased-glyph 'greater.lig.shift0.mid'
|
||||
create-aliased-glyph 'greater.lig.shift0.anti'
|
||||
create-aliased-glyph 'greater.lig.shiftN0'
|
||||
create-aliased-glyph 'greater.lig.shiftN0.mid'
|
||||
create-forked-glyph 'greater.lig.shift0h' : ArrowShiftTranslate 0.5
|
||||
create-forked-glyph 'greater.lig.shift1' : ArrowShiftTranslate 1.0
|
||||
create-forked-glyph 'greater.lig.shift1.head' : ArrowShiftTranslate 1.0
|
||||
create-forked-glyph 'greater.lig.shift1h' : ArrowShiftTranslate 1.5
|
||||
create-forked-glyph 'greater.lig.shift2' : ArrowShiftTranslate 2.0
|
||||
create-forked-glyph 'greater.lig.shiftN0h' : ArrowShiftTranslate (-0.5)
|
||||
create-forked-glyph 'greater.lig.shiftN1' : ArrowShiftTranslate (-1.0)
|
||||
create-forked-glyph 'greater.lig.shiftN1.anti' : ArrowShiftTranslate (-1.0)
|
||||
create-forked-glyph 'greater.lig.shiftN1h' : ArrowShiftTranslate (-1.5)
|
||||
create-forked-glyph 'greater.lig.shiftN2' : ArrowShiftTranslate (-2.0)
|
||||
|
||||
create-glyph 'less.lig.shift0' : glyph-proc
|
||||
include [refer-glyph 'less'] AS_BASE ALSO_METRICS
|
||||
create-aliased-glyph 'less.lig.shift0.head'
|
||||
create-aliased-glyph 'less.lig.shift0.mid'
|
||||
create-aliased-glyph 'less.lig.shift0.anti'
|
||||
create-aliased-glyph 'less.lig.shiftN0'
|
||||
create-aliased-glyph 'less.lig.shiftN0.mid'
|
||||
create-forked-glyph 'less.lig.shift0h' : ArrowShiftTranslate (-0.5)
|
||||
create-forked-glyph 'less.lig.shift1' : ArrowShiftTranslate (-1.0)
|
||||
create-forked-glyph 'less.lig.shift1.head' : ArrowShiftTranslate (-1.0)
|
||||
create-forked-glyph 'less.lig.shift1h' : ArrowShiftTranslate (-1.5)
|
||||
create-forked-glyph 'less.lig.shift2' : ArrowShiftTranslate (-2.0)
|
||||
create-forked-glyph 'less.lig.shiftN0h' : ArrowShiftTranslate 0.5
|
||||
create-forked-glyph 'less.lig.shiftN1' : ArrowShiftTranslate 1.0
|
||||
create-forked-glyph 'less.lig.shiftN1.anti' : ArrowShiftTranslate 1.0
|
||||
create-forked-glyph 'less.lig.shiftN1h' : ArrowShiftTranslate 1.5
|
||||
create-forked-glyph 'less.lig.shiftN2' : ArrowShiftTranslate 2.0
|
||||
|
||||
|
@ -412,40 +419,84 @@ glyph-block Symbol-Ligation : begin
|
|||
|
||||
do "<| , |> and <>"
|
||||
glyph-block-import Symbol-Math-Relation-Inequality : LessShape GreaterShape
|
||||
glyph-block-import Symbol-Punctuation-Slashes-And-Number-Sign : slashDefautLeft slashDefaultRight
|
||||
|
||||
local trigLeft : mix SB RightSB (1/6)
|
||||
local trigRight : Width * 1.5 - OperatorStroke * 1.5 * HVContrast
|
||||
local dHTriangle : LessSlope * (trigRight - trigLeft)
|
||||
define koTriangle : 1 / 6
|
||||
define koTag 0
|
||||
|
||||
define [TrigLeftShape shift] : LessShape (SymbolMid + dHTriangle) (SymbolMid - dHTriangle) (trigLeft + shift) (trigRight + shift)
|
||||
define [TrigRightShape shift] : GreaterShape (SymbolMid + dHTriangle) (SymbolMid - dHTriangle) (Width - trigRight + shift) (Width - trigLeft + shift)
|
||||
define kiShrunk 0
|
||||
define kiExtend 1
|
||||
define kiExtend2 2
|
||||
|
||||
local [trigLeft k] : mix SB RightSB k
|
||||
local [trigRight k] : mix RightSB (Width * 1.5 - OperatorStroke * 1.5 * HVContrast) k
|
||||
local [dHTriangle kOut kIn] : LessSlope * ([trigRight kIn] - [trigLeft kOut])
|
||||
|
||||
define [TrigLeftShape kOut kIn shift] : LessShape (SymbolMid + [dHTriangle kOut kIn]) (SymbolMid - [dHTriangle kOut kIn]) ([trigLeft kOut] + shift) ([trigRight kIn] + shift)
|
||||
define [TrigRightShape kOut kIn shift] : GreaterShape (SymbolMid + [dHTriangle kOut kIn]) (SymbolMid - [dHTriangle kOut kIn]) (Width - [trigRight kIn] + shift) (Width - [trigLeft kOut] + shift)
|
||||
|
||||
create-glyph 'less.lig.trig' : glyph-proc
|
||||
Joining.set currentGlyph Joining.Classes.Right
|
||||
include : TrigLeftShape 0
|
||||
include : TrigLeftShape koTriangle kiExtend 0
|
||||
|
||||
create-glyph 'bar.lig.trig' : glyph-proc
|
||||
include : VBar Middle (SymbolMid + dHTriangle + OperatorStroke) (SymbolMid - dHTriangle - OperatorStroke) OperatorStroke
|
||||
include : VBar Middle (SymbolMid + [dHTriangle koTriangle kiExtend] + OperatorStroke) (SymbolMid - [dHTriangle koTriangle kiExtend] - OperatorStroke) OperatorStroke
|
||||
|
||||
create-glyph 'greater.lig.trig' : glyph-proc
|
||||
Joining.set currentGlyph Joining.Classes.Left
|
||||
include : TrigRightShape 0
|
||||
include : TrigRightShape koTriangle kiExtend 0
|
||||
|
||||
create-glyph 'less.lig.diamond' : glyph-proc
|
||||
Joining.set currentGlyph Joining.Classes.Right
|
||||
include : intersection
|
||||
TrigLeftShape 0
|
||||
TrigLeftShape koTriangle kiExtend2 0
|
||||
union
|
||||
Rect ParenTop ParenBot 0 Width
|
||||
TrigRightShape Width
|
||||
TrigRightShape koTriangle kiExtend2 Width
|
||||
|
||||
create-glyph 'greater.lig.diamond' : glyph-proc
|
||||
Joining.set currentGlyph Joining.Classes.Left
|
||||
include : intersection
|
||||
TrigRightShape 0
|
||||
TrigRightShape koTriangle kiExtend2 0
|
||||
union
|
||||
Rect ParenTop ParenBot 0 Width
|
||||
TrigLeftShape (-Width)
|
||||
TrigLeftShape koTriangle kiExtend2 (-Width)
|
||||
|
||||
create-glyph 'less.lig.diamond.tag' : glyph-proc
|
||||
Joining.set currentGlyph Joining.Classes.Right
|
||||
include : intersection
|
||||
TrigLeftShape koTag kiExtend2 0
|
||||
union
|
||||
Rect ParenTop ParenBot 0 Width
|
||||
TrigRightShape koTag kiExtend2 Width
|
||||
|
||||
create-glyph 'greater.lig.diamond.tag' : glyph-proc
|
||||
Joining.set currentGlyph Joining.Classes.Left
|
||||
include : intersection
|
||||
TrigRightShape koTag kiExtend2 0
|
||||
union
|
||||
Rect ParenTop ParenBot 0 Width
|
||||
TrigLeftShape koTag kiExtend2 (-Width)
|
||||
|
||||
create-glyph 'less.lig.tag-slash' : glyph-proc
|
||||
Joining.set currentGlyph Joining.Classes.Right
|
||||
include : intersection
|
||||
MaskAbove SymbolMid
|
||||
TrigLeftShape koTag kiShrunk 0
|
||||
include : intersection
|
||||
MaskBelow SymbolMid
|
||||
TrigLeftShape koTag kiExtend2 0
|
||||
MaskLeftLine (slashDefautLeft + Width) ParenBot (slashDefaultRight + Width) ParenTop
|
||||
|
||||
create-glyph 'greater.lig.tag-slash' : glyph-proc
|
||||
Joining.set currentGlyph Joining.Classes.Right
|
||||
include : intersection
|
||||
MaskBelow SymbolMid
|
||||
TrigRightShape koTag kiShrunk 0
|
||||
include : intersection
|
||||
MaskAbove SymbolMid
|
||||
TrigRightShape koTag kiExtend2 0
|
||||
MaskRightLine (slashDefautLeft - Width) ParenBot (slashDefaultRight - Width) ParenTop
|
||||
|
||||
do "Chaining Plus"
|
||||
glyph-block-import Symbol-Math-Arith : PlusShape
|
||||
|
|
|
@ -10,8 +10,12 @@ glyph-block Symbol-Punctuation-Slashes-And-Number-Sign : begin
|
|||
glyph-block-import CommonShapes
|
||||
glyph-block-import Common-Derivatives
|
||||
|
||||
glyph-block-export slashDefautLeft
|
||||
glyph-block-export slashDefaultRight
|
||||
|
||||
define slashDefautLeft : SB + HalfStroke
|
||||
define slashDefaultRight : RightSB - HalfStroke
|
||||
|
||||
define [SlashShape l r _t _b _w] : glyph-proc
|
||||
local w : fallback _w Stroke
|
||||
local t : fallback _t ParenTop
|
||||
|
|
|
@ -36,6 +36,8 @@ define [buildLigationsImpl sink para featureName mappedFeature rankedLookups] :
|
|||
define exclam {'exclam'}
|
||||
define greater {'greater'}
|
||||
define greaterAndEquiv {'greater' 'greater.lig.shift0' 'greater.lig.shift0.anti'}
|
||||
define lessOrGreater : {}.concat less greater
|
||||
define lessOrGreaterAndEquiv : {}.concat lessAndEquiv greaterAndEquiv
|
||||
define anyBar {'bar' 'slash' 'backslash'}
|
||||
define slash {'slash'}
|
||||
define backslash {'backslash'}
|
||||
|
@ -409,11 +411,11 @@ define [buildLigationsImpl sink para featureName mappedFeature rankedLookups] :
|
|||
regexLookAround ~> advance
|
||||
regexLookAround ~> advance
|
||||
|
||||
define [CJoinHeadForce] : if dbl [lsx 'dblhead'] [lsx 'shift0']
|
||||
define [CJoinHeadForce] : if dbl [lsx 'dblhead'] [lsx 'shift0.head']
|
||||
define [CJoinHeadMid] : if dbl [lsx 'dblhead.mid'] [lsx 'shift0.mid']
|
||||
define [CJoinHeadForceShift1] : if dbl [lsx 'dblhead.shift1'] [lsx 'shift1']
|
||||
define [CJoinHeadForceShift1] : if dbl [lsx 'dblhead.shift1'] [lsx 'shift1.head']
|
||||
define [CAntiHeadForce] : if dbl [lsx 'hole'] [lsx 'shift0.anti']
|
||||
define [CAntiHeadForceShiftN1] : if dbl [lsx 'hole.shiftN1'] [lsx 'shiftN1']
|
||||
define [CAntiHeadForceShiftN1] : if dbl [lsx 'hole.shiftN1'] [lsx 'shiftN1.anti']
|
||||
|
||||
define [TJoinHeadForce] : if [hasLG 'arrow'] [CJoinHeadForce] advance
|
||||
define [TJoinHeadAmbig] : if [not ltgt] [TJoinHeadForce] advance
|
||||
|
@ -807,13 +809,6 @@ define [buildLigationsImpl sink para featureName mappedFeature rankedLookups] :
|
|||
[hasLG 'exeq'] : chain-rule
|
||||
exclam ~> {'neq.allow-dot.2l'}
|
||||
equal ~> {'equal.fc+cf'}
|
||||
piecewise
|
||||
[hasLG 'ltgt-diamond'] : chain-rule
|
||||
lessAndEquiv ~> [just 'less.lig.diamond']
|
||||
greaterAndEquiv ~> [just 'greater.lig.diamond']
|
||||
[hasLG 'ltgt-ne'] : chain-rule
|
||||
lessAndEquiv ~> [just 'neq.bar-only.2l']
|
||||
greaterAndEquiv ~> [just 'equal.fc+cf']
|
||||
piecewise
|
||||
[hasLG 'eqeq'] : chain-rule
|
||||
equal ~> {'equal.fc'}
|
||||
|
@ -841,27 +836,51 @@ define [buildLigationsImpl sink para featureName mappedFeature rankedLookups] :
|
|||
{'question'} ~> look-around
|
||||
regexLookAround ~> advance
|
||||
regexLookAround ~> advance
|
||||
|
||||
# <>
|
||||
piecewise
|
||||
[hasLG 'ltgt-diamond'] : chain-rule
|
||||
lessAndEquiv ~> [just 'less.lig.diamond']
|
||||
greaterAndEquiv ~> [just 'greater.lig.diamond']
|
||||
[hasLG 'ltgt-diamond-tag'] : chain-rule
|
||||
lessAndEquiv ~> [just 'less.lig.diamond.tag']
|
||||
greaterAndEquiv ~> [just 'greater.lig.diamond.tag']
|
||||
[hasLG 'ltgt-ne'] : chain-rule
|
||||
lessAndEquiv ~> [just 'neq.bar-only.2l']
|
||||
greaterAndEquiv ~> [just 'equal.fc+cf']
|
||||
|
||||
# <=, >=
|
||||
chain-rule
|
||||
[acops] ~> look-around
|
||||
{'less' 'greater'} ~> advance
|
||||
lessOrGreaterAndEquiv ~> advance
|
||||
equal ~> advance
|
||||
chain-rule
|
||||
{'less' 'greater'} ~> advance
|
||||
lessOrGreaterAndEquiv ~> advance
|
||||
equal ~> advance
|
||||
[acops] ~> look-around
|
||||
chain-rule
|
||||
{'less'} ~> {'less.lig2'}
|
||||
lessAndEquiv ~> [just 'less.lig2']
|
||||
equal ~> {'eq.at-lteq.lig2'}
|
||||
chain-rule
|
||||
{'greater'} ~> {'greater.lig2'}
|
||||
greaterAndEquiv ~> [just 'greater.lig2']
|
||||
equal ~> {'eq.at-gteq.lig2'}
|
||||
|
||||
# </, /> and </>
|
||||
piecewise
|
||||
[hasLG 'ltgt-slash-tag'] : chain-rule
|
||||
lessAndEquiv ~> [just 'less.lig.tag-slash']
|
||||
slash ~> look-around
|
||||
piecewise
|
||||
[hasLG 'ltgt-slash-tag'] : chain-rule
|
||||
slash ~> look-around
|
||||
greaterAndEquiv ~> [just 'greater.lig.tag-slash']
|
||||
|
||||
# :>
|
||||
do "colon-less-greater" : if [hasLG 'colon-greater'] : begin
|
||||
CreateLigationLookup : list
|
||||
chain-rule
|
||||
{'colon/mid'} ~> look-around
|
||||
{'greater'} ~> {'greaterArrow'}
|
||||
greaterAndEquiv ~> [just 'greaterArrow']
|
||||
|
||||
# [| |] {| |}
|
||||
do "brack-bar" : if [hasLG 'brack-bar'] : begin
|
||||
|
|
|
@ -88,6 +88,18 @@ ligGroup = "ltgt-diamond"
|
|||
samples = ["<>"]
|
||||
desc = 'Enable ligation for `<>` as diamond'
|
||||
|
||||
[simple.ltgt-diamond-tag]
|
||||
ligGroup = "ltgt-diamond-tag"
|
||||
samples = ["<>"]
|
||||
sampleRank = 3
|
||||
desc = 'Enable ligation for `<>` as diamond-shaped empty HTML/XML tag'
|
||||
|
||||
[simple.ltgt-slash-tag]
|
||||
ligGroup = "ltgt-slash-tag"
|
||||
samples = ["</", "/>", "</>"]
|
||||
sampleRank = 2
|
||||
desc = 'Enable ligation for `</`, `/>` and `</>`'
|
||||
|
||||
[simple.brst]
|
||||
ligGroup = "brst"
|
||||
samples = ["(*", "*)", "(* comm *)"]
|
||||
|
@ -198,30 +210,30 @@ desc = 'Make contiguous hyphen-minuses (like `--`) connected as a straight semi-
|
|||
# This feature is on by default by many software
|
||||
[composite.default-calt]
|
||||
tag = 'calt'
|
||||
buildup = ['center-ops', 'arrow', 'html-comment', 'trig', 'llgg', 'llggeq', 'eqeq', 'exeq', 'ineq', 'plusplus', 'kern-dotty', 'kern-bars']
|
||||
buildup = ['center-ops', 'arrow', 'html-comment', 'ltgt-diamond-tag', 'ltgt-slash-tag', 'trig', 'llgg', 'llggeq', 'eqeq', 'exeq', 'ineq', 'plusplus', 'kern-dotty', 'kern-bars']
|
||||
brief = 'Default'
|
||||
desc = 'Default setting in text editors'
|
||||
readmeDesc = 'Inherit default ligation set'
|
||||
|
||||
[composite.dlig]
|
||||
tag = 'dlig'
|
||||
buildup = ['center-ops', 'arrow', 'html-comment', 'trig', 'arrow2', 'llgg', 'eqeq', 'exeq', 'ineq', 'ltgt-diamond', 'plusplus', 'kern-dotty', 'kern-bars', 'dot-as-operator', 'logic', 'brst', 'brace-bar', 'brack-bar', 'connected-underscore', 'connected-number-sign', 'connected-tilde-as-wave', 'connected-hyphen-as-semi-dashed-line']
|
||||
buildup = ['center-ops', 'arrow', 'html-comment', 'ltgt-diamond-tag', 'ltgt-slash-tag', 'trig', 'arrow2', 'llgg', 'eqeq', 'exeq', 'ineq', 'plusplus', 'kern-dotty', 'kern-bars', 'dot-as-operator', 'logic', 'brst', 'brace-bar', 'brack-bar', 'connected-underscore', 'connected-number-sign', 'connected-tilde-as-wave', 'connected-hyphen-as-semi-dashed-line']
|
||||
brief = 'Discretionary'
|
||||
desc = 'Discretionary ligatures'
|
||||
|
||||
[composite.clike]
|
||||
tag = 'CLIK'
|
||||
buildup = ['center-ops', 'arrow', 'html-comment', 'trig', 'llgg', 'llggeq', 'eqeqeq', 'eqeq', 'exeqeq', 'exeq', 'ineq', 'plusplus', 'kern-dotty', 'kern-bars']
|
||||
buildup = ['center-ops', 'arrow', 'html-comment', 'ltgt-diamond-tag', 'ltgt-slash-tag', 'trig', 'llgg', 'llggeq', 'eqeqeq', 'eqeq', 'exeqeq', 'exeq', 'ineq', 'plusplus', 'kern-dotty', 'kern-bars']
|
||||
desc = 'C-Like'
|
||||
|
||||
[composite.javascript]
|
||||
tag = 'JSPT'
|
||||
buildup = ['center-ops', 'arrow', 'html-comment', 'trig', 'llgg', 'llggeq', 'eqeqeq', 'eqeq', 'exeqeq', 'exeq', 'ineq', 'plusplus', 'kern-dotty', 'kern-bars']
|
||||
buildup = ['center-ops', 'arrow', 'html-comment', 'ltgt-diamond-tag', 'ltgt-slash-tag', 'trig', 'llgg', 'llggeq', 'eqeqeq', 'eqeq', 'exeqeq', 'exeq', 'ineq', 'plusplus', 'kern-dotty', 'kern-bars']
|
||||
desc = 'JavaScript'
|
||||
|
||||
[composite.php]
|
||||
tag = 'PHPX'
|
||||
buildup = ['center-ops', 'arrow', 'html-comment', 'trig', 'llgg', 'llggeq', 'eqeqeq', 'eqeq', 'exeqeq', 'exeq', 'ineq', 'plusplus', 'dot-as-operator', 'kern-dotty', 'kern-bars']
|
||||
buildup = ['center-ops', 'arrow', 'html-comment', 'ltgt-diamond-tag', 'ltgt-slash-tag', 'trig', 'llgg', 'llggeq', 'eqeqeq', 'eqeq', 'exeqeq', 'exeq', 'ineq', 'plusplus', 'dot-as-operator', 'kern-dotty', 'kern-bars']
|
||||
desc = 'PHP'
|
||||
|
||||
[composite.julia]
|
||||
|
@ -286,12 +298,12 @@ desc = 'Coq'
|
|||
|
||||
[composite.matlab]
|
||||
tag = 'MTLB'
|
||||
buildup = ['center-ops', 'arrow', 'html-comment', 'trig', 'llgg', 'eqeq', 'tildeeq', 'ineq', 'plusplus', 'kern-dotty', 'kern-bars']
|
||||
buildup = ['center-ops', 'arrow', 'trig', 'llgg', 'eqeq', 'tildeeq', 'ineq', 'plusplus', 'kern-dotty', 'kern-bars']
|
||||
desc = 'Matlab'
|
||||
|
||||
[composite.verilog]
|
||||
tag = 'VRLG'
|
||||
buildup = ['center-ops', 'arrow', 'html-comment', 'trig', 'llgg', 'llggeq', 'eqeqeq', 'eqeq', 'exeqeq', 'exeq', 'plusplus', 'brst', 'kern-dotty', 'kern-bars']
|
||||
buildup = ['center-ops', 'arrow', 'trig', 'llgg', 'llggeq', 'eqeqeq', 'eqeq', 'exeqeq', 'exeq', 'plusplus', 'brst', 'kern-dotty', 'kern-bars']
|
||||
desc = 'Verilog'
|
||||
|
||||
[composite.wolfram]
|
||||
|
|
|
@ -40,9 +40,9 @@ const ligationSamplesNarrow = [
|
|||
["<->", "<-->", "<--->", "<---->", "<=>", "<==>", "<===>", "<====>", "::", ":::", "__"],
|
||||
[
|
||||
"<~~",
|
||||
"<~",
|
||||
"<~>",
|
||||
"~>",
|
||||
"</",
|
||||
"</>",
|
||||
"/>",
|
||||
"~~>",
|
||||
"==",
|
||||
"!=",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue