Ligation breakdown for C-likes 1 (#1555)
This commit is contained in:
parent
5d594676de
commit
d3b8e339a2
9 changed files with 1132 additions and 843 deletions
|
@ -97,39 +97,6 @@ async function deriveFixed_DropFeatures(font, fFixed) {
|
|||
feature.params = null;
|
||||
}
|
||||
}
|
||||
|
||||
markSweepLookups(font.gsub);
|
||||
}
|
||||
function markSweepLookups(table) {
|
||||
let lookupSet = new Set();
|
||||
for (const feature of table.features) {
|
||||
for (const lookup of feature.lookups) {
|
||||
lookupSet.add(lookup);
|
||||
}
|
||||
}
|
||||
|
||||
do {
|
||||
let sizeBefore = lookupSet.size;
|
||||
for (const lookup of table.lookups) {
|
||||
if (lookup instanceof Ot.Gsub.Chaining || lookup instanceof Ot.Gpos.Chaining) {
|
||||
for (const rule of lookup.rules) {
|
||||
for (const app of rule.applications) lookupSet.add(app.apply);
|
||||
}
|
||||
}
|
||||
}
|
||||
let sizeAfter = lookupSet.size;
|
||||
if (sizeBefore >= sizeAfter) break;
|
||||
} while (true);
|
||||
|
||||
let front = 0;
|
||||
for (let rear = 0; rear < table.lookups.length; rear++) {
|
||||
if (lookupSet.has(table.lookups[rear])) {
|
||||
table.lookups[front++] = table.lookups[rear];
|
||||
}
|
||||
}
|
||||
table.lookups.length = front;
|
||||
|
||||
return lookupSet;
|
||||
}
|
||||
|
||||
async function readTTF(argv) {
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
import { CliProc } from "ot-builder";
|
||||
|
||||
import { convertGlyphs } from "./glyphs.mjs";
|
||||
import { convertGsub, convertGpos, convertGdef } from "./layout.mjs";
|
||||
|
||||
|
@ -6,5 +8,8 @@ export function convertOtd(baseFont, otl, gs) {
|
|||
const gsub = convertGsub(otl.GSUB, glyphs);
|
||||
const gpos = convertGpos(otl.GPOS, glyphs);
|
||||
const gdef = convertGdef(otl.GDEF, glyphs);
|
||||
return { ...baseFont, glyphs, cmap, gsub, gpos, gdef };
|
||||
|
||||
const font = { ...baseFont, glyphs, cmap, gsub, gpos, gdef };
|
||||
CliProc.consolidateFont(font);
|
||||
return font;
|
||||
}
|
||||
|
|
|
@ -133,7 +133,37 @@ define [buildLigationsImpl sink para $LigGroup$] : begin
|
|||
{'asterisk'} ~> {'asterisk/sMid'}
|
||||
{'parenRight'} ~> look-around
|
||||
|
||||
LigGroup "Bracket-Colon" : if [hasLG 'center-ops'] : begin
|
||||
CreateLigationLookup : list
|
||||
chain-rule # (:
|
||||
{'parenLeft' 'bracketLeft' 'braceLeft'} ~> look-around
|
||||
{'colon'} ~> {'colon/mid'}
|
||||
chain-rule # :)
|
||||
{'colon'} ~> {'colon/mid'}
|
||||
{'parenRight' 'bracketRight' 'braceRight'} ~> look-around
|
||||
|
||||
LigGroup "Operator centering" : if [hasLG 'center-ops'] : begin
|
||||
define triggerL {}
|
||||
define triggerR {}
|
||||
define skipL { 'slash' 'backslash' 'at' 'ampersand' 'percent' 'numberSign' }
|
||||
define skipR { 'slash' 'backslash' 'at' 'ampersand' 'percent' 'numberSign' }
|
||||
|
||||
if [hasLG 'center-op-trigger-plus-minus-l'] : triggerL.push 'plus' 'minus' 'hyphen'
|
||||
if [hasLG 'center-op-trigger-plus-minus-r'] : triggerR.push 'plus' 'minus' 'hyphen'
|
||||
if [hasLG 'center-op-trigger-equal-l'] : triggerL.push 'equal' 'ident'
|
||||
if [hasLG 'center-op-trigger-equal-r'] : triggerR.push 'equal' 'ident'
|
||||
if [hasLG 'center-op-trigger-bar-l'] : triggerL.push 'bar'
|
||||
if [hasLG 'center-op-trigger-bar-r'] : triggerR.push 'bar'
|
||||
if [hasLG 'center-op-trigger-slash-l'] : triggerL.push 'slash' 'backslash'
|
||||
if [hasLG 'center-op-trigger-slash-r'] : triggerR.push 'slash' 'backslash'
|
||||
if [hasLG 'center-op-trigger-angle-inside']
|
||||
begin [triggerR.push 'less'] [triggerL.push 'greater']
|
||||
if [hasLG 'center-op-trigger-angle-outside']
|
||||
begin [triggerL.push 'less'] [triggerR.push 'greater']
|
||||
|
||||
if [not : hasLG 'center-op-trigger-bar-l'] : skipL.push 'bar'
|
||||
if [not : hasLG 'center-op-trigger-bar-r'] : skipR.push 'bar'
|
||||
|
||||
|
||||
define [acops] : if [hasLG 'bar-triggers-op-centering']
|
||||
begin {'less' 'greater' 'hyphen' 'equal' 'plus' 'slash' 'bar' 'backslash'}
|
||||
|
@ -142,64 +172,48 @@ define [buildLigationsImpl sink para $LigGroup$] : begin
|
|||
begin {'at' 'ampersand' 'percent' 'numberSign'}
|
||||
begin {'slash' 'bar' 'backslash' 'at' 'ampersand' 'percent' 'numberSign'}
|
||||
|
||||
define [centerAsterisk] : {'asterisk'} ~> {'asterisk/sMid'}
|
||||
define [centerColon] : {'colon'} ~> {'colon/mid'}
|
||||
define [centerCaret] : {'asciiCaret'} ~> {'asciiCaret.low'}
|
||||
define [centerTilde] : {'asciiTilde'} ~> {'asciiTilde.low'}
|
||||
define [centerPeriod] : {'period'} ~> {'period/mid'}
|
||||
define [deCenterPeriod] : {'period/mid'} ~> {'period'}
|
||||
define opcGroups : list
|
||||
{'asterisk'} ~> {'asterisk/sMid'}
|
||||
{'asciiCaret'} ~> {'asciiCaret.low'}
|
||||
{'asciiTilde'} ~> {'asciiTilde.low'}
|
||||
|
||||
define centerizeGroups : list centerAsterisk centerColon centerCaret centerTilde
|
||||
if [hasLG 'dot-oper'] : centerizeGroups.push centerPeriod
|
||||
if [hasLG 'center-op-influence-dot'] : opcGroups.push : {'period'} ~> {'period/mid'}
|
||||
if [hasLG 'center-op-influence-colon'] : opcGroups.push : {'colon'} ~> {'colon/mid'}
|
||||
|
||||
define centerizeL : centerizeGroups.map : x => [x].left.0
|
||||
define centerizeR : centerizeGroups.map : lambda [x] : begin
|
||||
local left [x].left
|
||||
local right [x].right
|
||||
while (right <@ Function) : set right [right left]
|
||||
return : if right (right.0 || left.0) (left.0)
|
||||
define opcFrom : opcGroups.map : x => x.left.0
|
||||
define opcTo : opcGroups.map : x => x.right.0
|
||||
define C : opcFrom ~> opcTo
|
||||
|
||||
define [Cg] : centerizeL ~> centerizeR
|
||||
|
||||
do "Bracket-colon"
|
||||
# Triggering
|
||||
CreateLigationLookup : list
|
||||
chain-rule # (:
|
||||
{'parenLeft' 'bracketLeft' 'braceLeft'} ~> look-around
|
||||
centerColon
|
||||
chain-rule # :)
|
||||
centerColon
|
||||
{'parenRight' 'bracketRight' 'braceRight'} ~> look-around
|
||||
chain-rule C C skipL skipL triggerL # **##+
|
||||
chain-rule C C skipL triggerL # **#+
|
||||
chain-rule C C triggerL # **+
|
||||
chain-rule C skipL skipL triggerL # *##+
|
||||
chain-rule C skipL triggerL # *#+
|
||||
chain-rule C triggerL # *+
|
||||
chain-rule triggerR skipR skipR C # +##*
|
||||
chain-rule triggerR skipR C # +#*
|
||||
chain-rule triggerR C # +*
|
||||
|
||||
do "Operator Centering"
|
||||
# Extension
|
||||
CreateLigationLookup : list
|
||||
chain-rule [Cg] [Cg] [acskip] [acskip] [acops] # ::+
|
||||
chain-rule [Cg] [Cg] [acskip] [acops] # ::+
|
||||
chain-rule [Cg] [Cg] [acops] # ::+
|
||||
chain-rule [Cg] [acskip] [acskip] [acops] # :+
|
||||
chain-rule [Cg] [acskip] [acops] # :+
|
||||
chain-rule [Cg] [acops] # :+
|
||||
chain-rule [acops] [acskip] [acskip] [Cg] # +:
|
||||
chain-rule [acops] [acskip] [Cg] # +:
|
||||
chain-rule [acops] [Cg] # +:
|
||||
|
||||
do "Operator centering : Trailing"
|
||||
CreateLigationLookup : list
|
||||
chain-rule centerizeR [acskip] [acskip] [Cg]
|
||||
chain-rule centerizeR [acskip] [Cg]
|
||||
chain-rule centerizeR [Cg]
|
||||
chain-rule opcTo skipR skipR C # *##* --->
|
||||
chain-rule opcTo skipR C # *#* --->
|
||||
chain-rule opcTo C # ** --->
|
||||
|
||||
CreateReverseLigationLookup : list
|
||||
reverse-rule [Cg] [acskip] [acskip] centerizeR
|
||||
reverse-rule [Cg] [acskip] centerizeR
|
||||
reverse-rule [Cg] centerizeR
|
||||
reverse-rule C skipL skipL opcTo # *##* <---
|
||||
reverse-rule C skipL opcTo # *#* <---
|
||||
reverse-rule C opcTo # ** <---
|
||||
|
||||
do "Operator centering : Apple fix"
|
||||
# AAPL FIX
|
||||
# Apple (still) have problem when dealing with reverse chaining lookup
|
||||
# They give up at run beginning. Fix them.
|
||||
CreateLigationLookup : list
|
||||
chain-rule [Cg] [acskip] [acskip] centerizeR
|
||||
chain-rule [Cg] [acskip] centerizeR
|
||||
chain-rule [Cg] centerizeR
|
||||
chain-rule C skipR skipR opcTo
|
||||
chain-rule C skipR opcTo
|
||||
chain-rule C opcTo
|
||||
|
||||
LigGroup "slash-asterisk" : if [hasLG 'slash-asterisk'] : begin
|
||||
CreateLigationLookup : list
|
||||
|
|
|
@ -11,7 +11,7 @@ export function applyLigationData(data, para, argv) {
|
|||
for (const gr in data.composite) {
|
||||
const comp = data.composite[gr];
|
||||
if (!comp.tag) continue;
|
||||
const ligSets = createBuildup(data.simple, comp.buildup);
|
||||
const ligSets = createBuildup(data.simple, data.composite, comp.buildup);
|
||||
defaultBuildup[comp.tag] = ligSets;
|
||||
hives[`ligset-inherit-${gr}`] = { caltBuildup: ligSets };
|
||||
}
|
||||
|
@ -37,11 +37,20 @@ export function applyLigationData(data, para, argv) {
|
|||
}
|
||||
}
|
||||
|
||||
function createBuildup(simple, buildup) {
|
||||
let ligSet = new Set();
|
||||
export function createBuildup(simple, composite, buildup) {
|
||||
let sink = new Set();
|
||||
createBuildupImpl(sink, simple, composite, buildup);
|
||||
return Array.from(sink);
|
||||
}
|
||||
|
||||
function createBuildupImpl(sink, simple, composite, buildup) {
|
||||
for (const s of buildup) {
|
||||
if (!simple[s]) throw new Error("Cannot find simple ligation group " + s);
|
||||
ligSet.add(simple[s].ligGroup);
|
||||
if (simple[s]) {
|
||||
sink.add(simple[s].ligGroup);
|
||||
} else if (composite[s]) {
|
||||
createBuildupImpl(sink, simple, composite, composite[s].buildup);
|
||||
} else {
|
||||
throw new Error("Cannot find simple ligation group " + s);
|
||||
}
|
||||
}
|
||||
return Array.from(ligSet);
|
||||
}
|
||||
|
|
1404
package-lock.json
generated
1404
package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -10,8 +10,8 @@
|
|||
"dependencies": {
|
||||
"@iarna/toml": "^2.2.5",
|
||||
"@msgpack/msgpack": "^2.8.0",
|
||||
"ot-builder": "^1.6.0",
|
||||
"otb-ttc-bundle": "^1.6.0",
|
||||
"ot-builder": "^1.6.1",
|
||||
"otb-ttc-bundle": "^1.6.1",
|
||||
"semver": "^7.3.8",
|
||||
"spiro": "^3.0.0",
|
||||
"toposort": "^2.0.2",
|
||||
|
@ -23,11 +23,11 @@
|
|||
"devDependencies": {
|
||||
"@unicode/unicode-14.0.0": "^1.3.1",
|
||||
"cldr": "^7.3.0",
|
||||
"eslint": "^8.32.0",
|
||||
"eslint": "^8.34.0",
|
||||
"eslint-config-prettier": "^8.6.0",
|
||||
"eslint-plugin-import": "^2.27.5",
|
||||
"patel": "^0.38.0",
|
||||
"prettier": "^2.8.3",
|
||||
"prettier": "^2.8.4",
|
||||
"verda": "^1.11.0",
|
||||
"which": "^3.0.0"
|
||||
},
|
||||
|
|
|
@ -1,8 +1,59 @@
|
|||
[simple.center-ops]
|
||||
ligGroup = 'center-ops'
|
||||
samples = [":=", ":-", ":+", "<*", "<*>", "*>", "+:", "-:", "=:", "<***>", "<:", ":>"]
|
||||
samples = [":=", ":-", ":+", "<*", "<*>", "*>", "+:", "-:", "=:", "<***>", "<:", ":>", "*-", "-*", "*=", "=*", "*+", "+*"]
|
||||
desc = 'Vertically align some of the operators (like `*`) to the center position it is before or after a "center" operator (like `+`)'
|
||||
|
||||
[simple.center-op-trigger-plus-minus-l]
|
||||
ligGroup = 'center-op-trigger-plus-minus-l'
|
||||
samples = ["*+", "*-", ":+", ":-", ".+", ".-"]
|
||||
desc = 'Plus (`+`) and Minus (`-`) will trigger other operator characters at left to be centered'
|
||||
|
||||
[simple.center-op-trigger-plus-minus-r]
|
||||
ligGroup = 'center-op-trigger-plus-minus-r'
|
||||
samples = ["+*", "-*", "+:", "-:", "+.", "-."]
|
||||
desc = 'Plus (`+`) and Minus (`-`) will trigger other operator characters at right to be centered'
|
||||
|
||||
[simple.center-op-trigger-equal-l]
|
||||
ligGroup = 'center-op-trigger-equal-l'
|
||||
samples = ["*=", ":=", ".="]
|
||||
desc = 'Equal (`=`) will trigger other operator characters at left to be centered'
|
||||
|
||||
[simple.center-op-trigger-equal-r]
|
||||
ligGroup = 'center-op-trigger-equal-r'
|
||||
samples = ["=*", "=:", "=."]
|
||||
desc = 'Equal (`=`) will trigger other operator characters at right to be centered'
|
||||
|
||||
[simple.center-op-trigger-bar-l]
|
||||
ligGroup = 'center-op-trigger-bar-l'
|
||||
samples = ["*|", ":|"]
|
||||
desc = 'Bars (`|`) will trigger other operator characters at left to be centered'
|
||||
|
||||
[simple.center-op-trigger-bar-r]
|
||||
ligGroup = 'center-op-trigger-bar-r'
|
||||
samples = ["|*", "|:"]
|
||||
desc = 'Bars (`|`) will trigger other operator characters at right to be centered'
|
||||
|
||||
[simple.center-op-trigger-angle-inside]
|
||||
ligGroup = 'center-op-trigger-angle-inside'
|
||||
samples = ["<:", "<:>", ":>", "<*", "<*>", "*>", "<.", "<.>", ".>"]
|
||||
desc = 'Less (`<`) and Greater (`>`) will trigger other operator characters at inside to be centered'
|
||||
|
||||
[simple.center-op-trigger-angle-outside]
|
||||
ligGroup = 'center-op-trigger-angle-outside'
|
||||
samples = [">*", "*<"]
|
||||
desc = 'Less (`<`) and Greater (`>`) will trigger other operator characters at outside to be centered'
|
||||
|
||||
[simple.center-op-influence-dot]
|
||||
ligGroup = "center-op-influence-dot"
|
||||
samples = ["<.", "<.>", ".>"]
|
||||
desc = 'Treat dot (`.`) as operator and perform chained centering'
|
||||
|
||||
[simple.center-op-influence-colon]
|
||||
ligGroup = "center-op-influence-colon"
|
||||
samples = ["<:", "<:>", ":>", ":=", "=:", ":-", "-:"]
|
||||
|
||||
|
||||
|
||||
[simple.arrow]
|
||||
ligGroup = "arrow"
|
||||
samples = ["<--", "<---", "<<-", "<-", "->", "->>", "-->", "--->", "<->", "<-->", "<--->", "<---->", "<==", "<===", "<<=", "=>", "=>>", "==>", "===>", "<=>", "<==>", "<===>", "<====>", "<~~", "<~", "<~>", "~>", "~~>", "-------->"]
|
||||
|
@ -141,16 +192,6 @@ samples = ["<<=", ">>="]
|
|||
sampleRank = 2
|
||||
desc = 'Enable ligation for `<<=`, `>>=` as shift operator'
|
||||
|
||||
[simple.dot-as-operator]
|
||||
ligGroup = "dot-oper"
|
||||
samples = ["<.", "<.>", ".>"]
|
||||
desc = 'Treat dot (`.`) as operator and perform chained centering'
|
||||
|
||||
[simple.bar-triggers-op-centering]
|
||||
ligGroup = "bar-triggers-op-centering"
|
||||
samples = [":|", ":|:", "|:"]
|
||||
desc = 'Bars (`/`, `|`, `\`) will trigger operator centering'
|
||||
|
||||
[simple.lteq-as-arrow]
|
||||
ligGroup = "arrowZALE"
|
||||
samples = ["<="]
|
||||
|
@ -206,107 +247,347 @@ desc = 'Make contiguous hyphen-minuses (like `--`) connected as a straight solid
|
|||
|
||||
###################################################################################################
|
||||
|
||||
# Non-tagged composites, used for inheritance
|
||||
[composite.--default-center-ops--]
|
||||
buildup = [
|
||||
'center-ops',
|
||||
'center-op-trigger-plus-minus-l',
|
||||
'center-op-trigger-plus-minus-r',
|
||||
'center-op-trigger-equal-l',
|
||||
'center-op-trigger-equal-r',
|
||||
'center-op-trigger-angle-inside',
|
||||
'center-op-trigger-angle-outside',
|
||||
'center-op-influence-colon',
|
||||
]
|
||||
|
||||
[composite.--c-center-ops--]
|
||||
buildup = [
|
||||
'center-ops',
|
||||
'center-op-trigger-equal-l',
|
||||
]
|
||||
|
||||
[composite.--default-equality-inequality--]
|
||||
buildup = [ 'eqeq', 'exeq', 'ineq' ]
|
||||
|
||||
[composite.--c-equality-inequality--]
|
||||
buildup = [ 'eqeqeq', 'eqeq', 'exeqeq', 'exeq', 'ineq' ]
|
||||
|
||||
[composite.--raku-equality-inequality--]
|
||||
buildup = [ 'eqeqeq', 'eqeq', 'exeqeqeq', 'exeq', 'ineq' ]
|
||||
|
||||
[composite.--ml-equality-inequality--]
|
||||
buildup = [ 'eqeq', 'ltgt-ne', 'ineq' ]
|
||||
|
||||
[composite.--fstar-equality-inequality--]
|
||||
buildup = [ 'eqeq', 'ltgt-ne', 'eqeqeq', 'eqexeq', 'ineq' ]
|
||||
|
||||
[composite.--haskell-equality-inequality--]
|
||||
buildup = [ 'eqeq', 'slasheq', 'ineq' ]
|
||||
|
||||
[composite.--matlab-equality-inequality--]
|
||||
buildup = [ 'eqeq', 'tildeeq', 'ineq' ]
|
||||
|
||||
[composite.--verilog-equality-inequality--]
|
||||
buildup = [ 'eqeqeq', 'eqeq', 'exeqeq', 'exeq' ]
|
||||
|
||||
[composite.--wolfram-equality-inequality--]
|
||||
buildup = [ 'eqeq', 'exeq', 'eqexeq-dl', 'ineq' ]
|
||||
|
||||
[composite.--default-kern--]
|
||||
buildup = [ 'kern-dotty', 'kern-bars' ]
|
||||
|
||||
# This feature is on by default by many software
|
||||
[composite.default-calt]
|
||||
tag = 'calt'
|
||||
buildup = ['center-ops', 'arrow', 'html-comment', 'ltgt-diamond-tag', 'ltgt-slash-tag', 'trig', 'slash-asterisk', 'llgg', 'llggeq', 'eqeq', 'exeq', 'ineq', 'plusplus', 'kern-dotty', 'kern-bars']
|
||||
brief = 'Default'
|
||||
desc = 'Default setting in text editors'
|
||||
readmeDesc = 'Inherit default ligation set'
|
||||
buildup = [
|
||||
'--default-center-ops--',
|
||||
'--default-equality-inequality--',
|
||||
'--default-kern--',
|
||||
'arrow',
|
||||
'html-comment',
|
||||
'ltgt-diamond-tag',
|
||||
'ltgt-slash-tag',
|
||||
'trig',
|
||||
'slash-asterisk',
|
||||
'llgg',
|
||||
'llggeq',
|
||||
'plusplus',
|
||||
]
|
||||
|
||||
[composite.dlig]
|
||||
tag = 'dlig'
|
||||
buildup = ['center-ops', 'arrow', 'html-comment', 'ltgt-diamond-tag', 'ltgt-slash-tag', 'trig', 'slash-asterisk', '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']
|
||||
brief = 'Discretionary'
|
||||
desc = 'Discretionary ligatures'
|
||||
buildup = [
|
||||
'--default-center-ops--',
|
||||
'center-op-influence-dot',
|
||||
'--default-equality-inequality--',
|
||||
'--default-kern--',
|
||||
'arrow',
|
||||
'arrow2',
|
||||
'html-comment',
|
||||
'ltgt-diamond-tag',
|
||||
'ltgt-slash-tag',
|
||||
'trig',
|
||||
'slash-asterisk',
|
||||
'llgg',
|
||||
'plusplus',
|
||||
'logic',
|
||||
'brst',
|
||||
'brace-bar',
|
||||
'brack-bar',
|
||||
'connected-underscore',
|
||||
'connected-number-sign',
|
||||
'connected-tilde-as-wave',
|
||||
'connected-hyphen'
|
||||
]
|
||||
|
||||
[composite.clike]
|
||||
tag = 'CLIK'
|
||||
buildup = ['center-ops', 'arrow', 'html-comment', 'ltgt-diamond-tag', 'ltgt-slash-tag', 'trig', 'slash-asterisk', 'llgg', 'llggeq', 'eqeqeq', 'eqeq', 'exeqeq', 'exeq', 'ineq', 'plusplus', 'kern-dotty', 'kern-bars']
|
||||
desc = 'C-Like'
|
||||
buildup = [
|
||||
'--c-center-ops--',
|
||||
'--c-equality-inequality--',
|
||||
'--default-kern--',
|
||||
'arrow',
|
||||
'html-comment',
|
||||
'ltgt-diamond-tag',
|
||||
'ltgt-slash-tag',
|
||||
'trig',
|
||||
'slash-asterisk',
|
||||
'llgg',
|
||||
'llggeq',
|
||||
'plusplus',
|
||||
]
|
||||
|
||||
[composite.javascript]
|
||||
tag = 'JSPT'
|
||||
buildup = ['center-ops', 'arrow', 'html-comment', 'ltgt-diamond-tag', 'ltgt-slash-tag', 'trig', 'slash-asterisk', 'llgg', 'llggeq', 'eqeqeq', 'eqeq', 'exeqeq', 'exeq', 'ineq', 'plusplus', 'kern-dotty', 'kern-bars']
|
||||
desc = 'JavaScript'
|
||||
buildup = [
|
||||
'--c-center-ops--',
|
||||
'--c-equality-inequality--',
|
||||
'--default-kern--',
|
||||
'arrow',
|
||||
'html-comment',
|
||||
'ltgt-diamond-tag',
|
||||
'ltgt-slash-tag',
|
||||
'trig',
|
||||
'slash-asterisk',
|
||||
'llgg',
|
||||
'llggeq',
|
||||
'plusplus',
|
||||
]
|
||||
|
||||
[composite.php]
|
||||
tag = 'PHPX'
|
||||
buildup = ['center-ops', 'arrow', 'html-comment', 'ltgt-diamond-tag', 'ltgt-slash-tag', 'trig', 'slash-asterisk', 'llgg', 'llggeq', 'eqeqeq', 'eqeq', 'exeqeq', 'exeq', 'ineq', 'plusplus', 'dot-as-operator', 'kern-dotty', 'kern-bars']
|
||||
desc = 'PHP'
|
||||
buildup = [
|
||||
'--default-center-ops--',
|
||||
'center-op-influence-dot',
|
||||
'--c-equality-inequality--',
|
||||
'--default-kern--',
|
||||
'arrow',
|
||||
'html-comment',
|
||||
'ltgt-diamond-tag',
|
||||
'ltgt-slash-tag',
|
||||
'trig',
|
||||
'slash-asterisk',
|
||||
'llgg',
|
||||
'llggeq',
|
||||
'plusplus',
|
||||
]
|
||||
|
||||
[composite.julia]
|
||||
tag = 'JLIA'
|
||||
buildup = ['center-ops', 'arrow', 'trig', 'llgg', 'llggeq', 'eqeqeq', 'eqeq', 'exeqeq', 'exeq', 'ineq', 'plusplus', 'dot-as-operator', 'kern-dotty', 'kern-bars']
|
||||
desc = 'Julia'
|
||||
buildup = [
|
||||
'--default-center-ops--',
|
||||
'center-op-influence-dot',
|
||||
'--c-equality-inequality--',
|
||||
'--default-kern--',
|
||||
'arrow',
|
||||
'trig',
|
||||
'llgg',
|
||||
'llggeq',
|
||||
'plusplus',
|
||||
]
|
||||
|
||||
[composite.raku]
|
||||
tag = 'RAKU'
|
||||
buildup = ['center-ops', 'arrow', 'trig', 'llgg', 'llggeq', 'eqeqeq', 'eqeq', 'exeqeqeq', 'exeq', 'ineq', 'plusplus', 'dot-as-operator', 'kern-dotty', 'kern-bars']
|
||||
desc = 'Raku'
|
||||
buildup = [
|
||||
'--default-center-ops--',
|
||||
'center-op-influence-dot',
|
||||
'--raku-equality-inequality--',
|
||||
'--default-kern--',
|
||||
'arrow',
|
||||
'trig',
|
||||
'llgg',
|
||||
'llggeq',
|
||||
'plusplus',
|
||||
]
|
||||
|
||||
[composite.ml]
|
||||
tag = 'MLXX'
|
||||
buildup = ['center-ops', 'arrow', 'trig', 'eqeq', 'ltgt-ne', 'ineq', 'brst', 'plusplus', 'logic', 'kern-dotty', 'kern-bars']
|
||||
desc = 'ML'
|
||||
buildup = [
|
||||
'--default-center-ops--',
|
||||
'--ml-equality-inequality--',
|
||||
'--default-kern--',
|
||||
'arrow',
|
||||
'trig',
|
||||
'brst',
|
||||
'plusplus',
|
||||
'logic',
|
||||
]
|
||||
|
||||
[composite.fsharp]
|
||||
tag = 'FSHP'
|
||||
buildup = ['center-ops', 'arrow', 'trig', 'eqeq', 'ltgt-ne', 'ineq', 'brst', 'plusplus', 'logic', 'kern-dotty', 'kern-bars']
|
||||
desc = 'F#'
|
||||
buildup = [ 'ml' ]
|
||||
|
||||
[composite.fstar]
|
||||
tag = 'FSTA'
|
||||
buildup = ['center-ops', 'arrow', 'trig', 'eqeq', 'ltgt-ne', 'eqeqeq', 'eqexeq', 'ineq', 'brst', 'plusplus', 'logic', 'kern-dotty', 'kern-bars']
|
||||
desc = 'F*'
|
||||
buildup = [
|
||||
'--default-center-ops--',
|
||||
'--fstar-equality-inequality--',
|
||||
'--default-kern--',
|
||||
'arrow',
|
||||
'trig',
|
||||
'brst',
|
||||
'plusplus',
|
||||
'logic',
|
||||
]
|
||||
|
||||
[composite.haskell]
|
||||
tag = 'HSKL'
|
||||
buildup = ['center-ops', 'arrow', 'arrow2', 'trig', 'llgg', 'eqeq', 'slasheq', 'ineq', 'ltgt-diamond', 'plusplus', 'dot-as-operator', 'kern-dotty', 'kern-bars', 'logic']
|
||||
desc = 'Haskell'
|
||||
buildup = [
|
||||
'--default-center-ops--',
|
||||
'center-op-influence-dot',
|
||||
'--haskell-equality-inequality--',
|
||||
'--default-kern--',
|
||||
'arrow',
|
||||
'arrow2',
|
||||
'trig',
|
||||
'llgg',
|
||||
'ltgt-diamond',
|
||||
'plusplus',
|
||||
'logic',
|
||||
]
|
||||
|
||||
[composite.idris]
|
||||
tag = 'IDRS'
|
||||
buildup = ['center-ops', 'arrow', 'arrow2', 'trig', 'llgg', 'eqeq', 'slasheq', 'ineq', 'ltgt-diamond', 'plusplus', 'dot-as-operator', 'kern-dotty', 'kern-bars', 'logic']
|
||||
desc = 'Idris'
|
||||
buildup = [ 'haskell' ]
|
||||
|
||||
[composite.elm]
|
||||
tag = 'ELMX'
|
||||
buildup = ['center-ops', 'arrow', 'arrow2', 'trig', 'llgg', 'eqeq', 'slasheq', 'ineq', 'ltgt-diamond', 'plusplus', 'dot-as-operator', 'kern-dotty', 'kern-bars', 'logic']
|
||||
desc = 'Elm'
|
||||
buildup = [ 'haskell' ]
|
||||
|
||||
[composite.purescript]
|
||||
tag = 'PURS'
|
||||
buildup = ['center-ops', 'arrow', 'arrow2', 'trig', 'llgg', 'eqeq', 'slasheq', 'ineq', 'ltgt-diamond', 'plusplus', 'dot-as-operator', 'kern-dotty', 'kern-bars', 'logic']
|
||||
desc = 'PureScript'
|
||||
buildup = [ 'haskell' ]
|
||||
|
||||
[composite.swift]
|
||||
tag = 'SWFT'
|
||||
buildup = ['center-ops', 'arrow', 'arrow2', 'trig', 'slash-asterisk', 'llgg', 'eqeq', 'exeq', 'ineq', 'ltgt-diamond', 'plusplus', 'kern-dotty', 'kern-bars']
|
||||
desc = 'Swift'
|
||||
buildup = [
|
||||
'--default-center-ops--',
|
||||
'--default-equality-inequality--',
|
||||
'--default-kern--',
|
||||
'arrow',
|
||||
'arrow2',
|
||||
'trig',
|
||||
'slash-asterisk',
|
||||
'llgg',
|
||||
'ltgt-diamond',
|
||||
'plusplus',
|
||||
]
|
||||
|
||||
[composite.dafny]
|
||||
tag = 'DFNY'
|
||||
buildup = ['center-ops', 'arrow', 'arrow2', 'trig', 'slash-asterisk', 'llgg', 'eqeq', 'exeq', 'ineq', 'ltgt-diamond', 'plusplus', 'bar-triggers-op-centering', 'kern-dotty', 'kern-bars']
|
||||
desc = 'Dafny'
|
||||
buildup = [
|
||||
'--default-center-ops--',
|
||||
'center-op-trigger-bar-l',
|
||||
'center-op-trigger-bar-r',
|
||||
'--default-equality-inequality--',
|
||||
'--default-kern--',
|
||||
'arrow',
|
||||
'arrow2',
|
||||
'trig',
|
||||
'slash-asterisk',
|
||||
'llgg',
|
||||
'ltgt-diamond',
|
||||
'plusplus',
|
||||
]
|
||||
|
||||
[composite.coq]
|
||||
tag = 'COQX'
|
||||
buildup = ['center-ops', 'arrow', 'arrow2', 'trig', 'llgg', 'eqeq', 'ltgt-ne', 'ineq', 'plusplus', 'dot-as-operator', 'logic', 'brst', 'kern-dotty', 'kern-bars']
|
||||
desc = 'Coq'
|
||||
buildup = [
|
||||
'--default-center-ops--',
|
||||
'center-op-influence-dot',
|
||||
'--ml-equality-inequality--',
|
||||
'--default-kern--',
|
||||
'arrow',
|
||||
'arrow2',
|
||||
'trig',
|
||||
'llgg',
|
||||
'plusplus',
|
||||
'logic',
|
||||
'brst',
|
||||
]
|
||||
|
||||
[composite.matlab]
|
||||
tag = 'MTLB'
|
||||
buildup = ['center-ops', 'arrow', 'trig', 'llgg', 'eqeq', 'tildeeq', 'ineq', 'plusplus', 'kern-dotty', 'kern-bars']
|
||||
buildup = [
|
||||
'--default-center-ops--',
|
||||
'--matlab-equality-inequality--',
|
||||
'--default-kern--',
|
||||
'arrow',
|
||||
'trig',
|
||||
'llgg',
|
||||
'plusplus',
|
||||
]
|
||||
desc = 'Matlab'
|
||||
|
||||
[composite.verilog]
|
||||
tag = 'VRLG'
|
||||
buildup = ['center-ops', 'arrow', 'trig', 'slash-asterisk', 'llgg', 'llggeq', 'eqeqeq', 'eqeq', 'exeqeq', 'exeq', 'plusplus', 'brst', 'kern-dotty', 'kern-bars']
|
||||
buildup = [
|
||||
'--default-center-ops--',
|
||||
'--verilog-equality-inequality--',
|
||||
'--default-kern--',
|
||||
'arrow',
|
||||
'trig',
|
||||
'slash-asterisk',
|
||||
'llgg',
|
||||
'llggeq',
|
||||
'plusplus',
|
||||
'brst',
|
||||
]
|
||||
desc = 'Verilog'
|
||||
|
||||
[composite.wolfram]
|
||||
tag = 'WFLM'
|
||||
buildup = ['center-ops', 'arrow', 'trig', 'ltgt-diamond', 'eqeq', 'exeq', 'eqexeq-dl', 'ineq', 'brst', 'plusplus', 'logic', 'colon-greater-as-colon-arrow', 'kern-dotty', 'kern-bars']
|
||||
brief = 'Wolfram'
|
||||
desc = 'Wolfram Language (Mathematica)'
|
||||
buildup = [
|
||||
'--default-center-ops--',
|
||||
'--wolfram-equality-inequality--',
|
||||
'--default-kern--',
|
||||
'arrow',
|
||||
'trig',
|
||||
'ltgt-diamond',
|
||||
'brst',
|
||||
'plusplus',
|
||||
'logic',
|
||||
'colon-greater-as-colon-arrow',
|
||||
]
|
||||
|
|
|
@ -4,6 +4,8 @@ import url from "url";
|
|||
|
||||
import * as toml from "@iarna/toml";
|
||||
|
||||
import { createBuildup } from "../../font-src/support/ligation-data.mjs";
|
||||
|
||||
const ligationSamplesNarrow = [
|
||||
[
|
||||
"-<<",
|
||||
|
@ -58,8 +60,8 @@ const ligationSamplesNarrow = [
|
|||
[
|
||||
"<:",
|
||||
":=",
|
||||
":-",
|
||||
":+",
|
||||
"*=",
|
||||
"*+",
|
||||
"<*",
|
||||
"<*>",
|
||||
"*>",
|
||||
|
@ -69,8 +71,8 @@ const ligationSamplesNarrow = [
|
|||
"<.",
|
||||
"<.>",
|
||||
".>",
|
||||
"+:",
|
||||
"-:",
|
||||
"+*",
|
||||
"=*",
|
||||
"=:",
|
||||
":>"
|
||||
],
|
||||
|
@ -93,6 +95,7 @@ const ligationSamplesNarrow = [
|
|||
"<!---"
|
||||
]
|
||||
];
|
||||
|
||||
function buildLigationSet(ligData, getKey) {
|
||||
const ligationSets = new Map([
|
||||
["*off", { tag: "calt", rank: 0, desc: "Ligation Off", brief: "Off", ligSets: [] }]
|
||||
|
@ -103,15 +106,12 @@ function buildLigationSet(ligData, getKey) {
|
|||
const key = getKey(comp);
|
||||
let item = ligationSets.get(key);
|
||||
if (!item) {
|
||||
let ligSets = new Set();
|
||||
for (const s of comp.buildup) {
|
||||
ligSets.add(ligData.simple[s].ligGroup);
|
||||
}
|
||||
let ligSets = createBuildup(ligData.simple, ligData.composite, comp.buildup);
|
||||
item = {
|
||||
selector: sel,
|
||||
tag: comp.tag,
|
||||
rank: 1,
|
||||
ligSets: [...ligSets],
|
||||
ligSets,
|
||||
tagName: [comp.tag],
|
||||
desc: comp.desc,
|
||||
brief: comp.brief || comp.desc
|
||||
|
@ -125,6 +125,7 @@ function buildLigationSet(ligData, getKey) {
|
|||
}
|
||||
return ligationSets;
|
||||
}
|
||||
|
||||
export async function parseLigationData() {
|
||||
const __dirname = url.fileURLToPath(new URL(".", import.meta.url));
|
||||
const ligToml = await fs.promises.readFile(
|
||||
|
|
|
@ -4,13 +4,25 @@ function* makeSample(theme, args) {
|
|||
const groupSet = new Set(args.ligSets);
|
||||
for (const row of args.ligationSamples) {
|
||||
for (const sampleStr of row) {
|
||||
let rank = 0;
|
||||
let sat = [];
|
||||
|
||||
for (const [lgName, lg] of Object.entries(args.ligationCherry)) {
|
||||
if (!groupSet.has(lg.ligGroup)) continue;
|
||||
if (!new Set(lg.samples || []).has(sampleStr)) continue;
|
||||
const rankT = lg.sampleRank || 1;
|
||||
if (rankT > rank) rank = rankT;
|
||||
|
||||
if (!sat[rankT]) {
|
||||
sat[rankT] = { required: 1, satisfied: 0 };
|
||||
} else {
|
||||
sat[rankT].required += 1;
|
||||
}
|
||||
if (groupSet.has(lg.ligGroup)) {
|
||||
sat[rankT].satisfied += 1;
|
||||
}
|
||||
}
|
||||
|
||||
let rank = sat.length - 1;
|
||||
for (; rank >= 1 && (!sat[rank] || sat[rank].satisfied < sat[rank].required); rank--);
|
||||
|
||||
yield [{ color: theme[rank > 1 ? "stress" : rank > 0 ? "body" : "dimmed"] }, sampleStr];
|
||||
yield " ";
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue