Add Verilog ligation set (#710)

This commit is contained in:
be5invis 2020-10-30 20:28:23 -07:00
parent 6f2d40afb0
commit ac2925d833
4 changed files with 75 additions and 30 deletions

View file

@ -47,9 +47,7 @@ Afrikaans, Aghem, Akan, Albanian, Asturian, Asu, Azerbaijani, Bafia, Bambara, Ba
<!-- END Section-Language-List -->
Iosevka supports accessing all letter variants using OpenType features.
Iosevka supports accessing all letter variants using OpenType features, including `ss##` for applying a stylistic set, or `cv##` to cherry-pick variants.
![Style Sets](images/stylesets.png)
@ -57,11 +55,34 @@ Iosevka supports accessing all letter variants using OpenType features.
### Ligations
![Ligations Sample](images/ligations.png)
Iosevkas default ligation set is assigned to `calt` feature, though not all of them are enabled by default.
Iosevka supports Language-Specific Ligations, which is the ligation set enabled only under certain languages. These ligation sets are assigned to custom feature tags, like `CLIK`.
<!-- BEGIN Section-OT-Ligation-Tags -->
<!-- THIS SECTION IS AUTOMATICALLY GENERATED. DO NOT EDIT. -->
Iosevka supports Language-Specific Ligations, which is the ligation set enabled only under certain languages. These ligation sets are assigned to custom feature tags. To use them, you need to turn **off** `calt` and enable the corresponded feature. The feature list is:
- `dlig`: Discretionary ligatures.
- `CLIK`: C-Like.
- `JSPT`: JavaScript.
- `PHPX`: PHP.
- `MLXX`: ML.
- `FSHP`: F#.
- `FSTA`: F*.
- `HSKL`: Haskell.
- `IDRS`: Idris.
- `ELMX`: Elm.
- `PURS`: PureScript.
- `SWFT`: Swift.
- `COQX`: Coq.
- `MTLB`: Matlab.
- `VRLG`: Verilog.
- `WFLM`: Wolfram Language (Mathematica).
<!-- END Section-OT-Ligation-Tags -->
![Ligations Sample](images/ligations.png)
## Building from Source
@ -140,6 +161,7 @@ Subsection `ligations` is used to customize the ligation set assigned to `calt`
- `swift`: Default ligation set would be assigned to Swift.
- `coq`: Default ligation set would be assigned to Coq.
- `matlab`: Default ligation set would be assigned to Matlab.
- `verilog`: Default ligation set would be assigned to Verilog.
- `wolfram`: Default ligation set would be assigned to Wolfram Language (Mathematica).
<!-- END Section-Predefined-Ligation-Sets -->

View file

@ -190,6 +190,11 @@ tag = 'MTLB'
buildup = ['center-ops', 'arrow', 'html-comment', 'trig', 'llgg', 'eqeq', 'tildeeq', 'ineq', 'plusplus', 'kern-dotty']
desc = 'Matlab'
[composite.verilog]
tag = 'VRLG'
buildup = ['center-ops', 'arrow', 'html-comment', 'trig', 'llgg', 'llggeq', 'eqeqeq', 'eqeq', 'exeqeq', 'exeq', 'plusplus', 'kern-dotty']
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']

View file

@ -0,0 +1 @@
Iosevka supports Language-Specific Ligations, which is the ligation set enabled only under certain languages. These ligation sets are assigned to custom feature tags. To use them, you need to turn **off** `calt` and enable the corresponded feature. The feature list is:

View file

@ -14,6 +14,7 @@ const charMapObliquePath = process.argv[4];
execMain(main);
/////////////////////////////////////////////////////////////////////////////////////////////////////
async function main() {
const readmePath = path.resolve(__dirname, "../../README.md");
let readme = await fs.readFile(readmePath, "utf-8");
@ -21,6 +22,7 @@ async function main() {
readme = (await processSs()).apply(readme);
readme = (await processLigSetCherryPicking()).apply(readme);
readme = (await processLigSetPreDef()).apply(readme);
readme = (await processLigSetOt()).apply(readme);
readme = (await processLangList()).apply(readme);
readme = (await processPrivateBuildPlans()).apply(readme);
await fs.writeFile(readmePath, readme);
@ -73,30 +75,6 @@ async function processPrivateBuildPlans() {
return md;
}
class MdCol {
constructor(sectionName) {
this.data = "";
this.sectionName = sectionName;
this.matchRegex = new RegExp(
`^([ \\t]*)<!-- BEGIN ${sectionName} -->\\n[\\s\\S]*?<!-- END ${sectionName} -->\\n`,
`m`
);
}
log(...s) {
this.data += s.join("") + "\n";
}
apply(s) {
return s.replace(this.matchRegex, (m, $1) => {
return (
`<!-- BEGIN ${this.sectionName} -->\n` +
`<!-- THIS SECTION IS AUTOMATICALLY GENERATED. DO NOT EDIT. -->\n\n` +
this.data +
`\n<!-- END ${this.sectionName} -->\n`
).replace(/^/gm, $1);
});
}
}
function formatDefaults(selector, defaults) {
let dcs = [],
mask = 0;
@ -180,6 +158,19 @@ async function processLigSetPreDef() {
return md;
}
async function processLigSetOt() {
const ligData = await parseLigationData();
const md = new MdCol("Section-OT-Ligation-Tags");
const headerPath = path.resolve(__dirname, "fragments/description-ot-ligation-tags.md");
md.log(await fs.readFile(headerPath, "utf-8"));
for (const ls of ligData.nonMergeSets) {
if (!ls.rank || ls.tag === "calt") continue;
const longDesc = ls.desc;
md.log(`- \`${ls.tag}\`: ${longDesc}.`);
}
return md;
}
async function processLangList() {
const cl = await getCharMapAndSupportedLanguageList(
charMapPath,
@ -191,3 +182,29 @@ async function processLangList() {
md.log(cl.languages.join(", "));
return md;
}
/////////////////////////////////////////////////////////////////////////////////////////////////////
class MdCol {
constructor(sectionName) {
this.data = "";
this.sectionName = sectionName;
this.matchRegex = new RegExp(
`^([ \\t]*)<!-- BEGIN ${sectionName} -->\\n[\\s\\S]*?<!-- END ${sectionName} -->\\n`,
`m`
);
}
log(...s) {
this.data += s.join("") + "\n";
}
apply(s) {
return s.replace(this.matchRegex, (m, $1) => {
return (
`<!-- BEGIN ${this.sectionName} -->\n` +
`<!-- THIS SECTION IS AUTOMATICALLY GENERATED. DO NOT EDIT. -->\n\n` +
this.data +
`\n<!-- END ${this.sectionName} -->\n`
).replace(/^/gm, $1);
});
}
}