Allow inherit ligations from calt
(#750)
* Allow inherit ligations from `calt` Add `calt` to `hives` so `inherit = 'calt'` works. Also get rid of `optInBuildup`/`optOutBuildup` because they just merged into `para.ligation.defaultBuildup`. * fixup! Allow inherit ligations from `calt` * fixup! Allow inherit ligations from `calt` Rename hives * fixup! Allow inherit ligations from `calt` Rename `calt` to `default-calt` * fixup! fixup! Allow inherit ligations from `calt`
This commit is contained in:
parent
e429b9ec10
commit
6d48193438
4 changed files with 15 additions and 22 deletions
|
@ -3,48 +3,41 @@
|
||||||
const Parameters = require("./parameters");
|
const Parameters = require("./parameters");
|
||||||
|
|
||||||
module.exports = function applyLigationData(data, para, argv) {
|
module.exports = function applyLigationData(data, para, argv) {
|
||||||
const optInBuildup = {};
|
const defaultBuildup = {};
|
||||||
const optOutBuildup = {};
|
|
||||||
|
|
||||||
const hives = {};
|
const hives = {};
|
||||||
hives["default"] = { caltBuildup: [] };
|
hives["default"] = { caltBuildup: [] };
|
||||||
for (const gr in data.simple) {
|
for (const gr in data.simple) {
|
||||||
hives["enable-" + gr] = { appends: { caltBuildup: [data.simple[gr].ligGroup] } };
|
hives[`ligset-enable-${gr}`] = { appends: { caltBuildup: [data.simple[gr].ligGroup] } };
|
||||||
hives["disable-" + gr] = { removes: { caltBuildup: [data.simple[gr].ligGroup] } };
|
hives[`ligset-disable-${gr}`] = { removes: { caltBuildup: [data.simple[gr].ligGroup] } };
|
||||||
}
|
}
|
||||||
for (const gr in data.composite) {
|
for (const gr in data.composite) {
|
||||||
const comp = data.composite[gr];
|
const comp = data.composite[gr];
|
||||||
if (!comp.tag) continue;
|
if (!comp.tag) continue;
|
||||||
|
|
||||||
const ligSets = createBuildup(data.simple, comp.buildup);
|
const ligSets = createBuildup(data.simple, comp.buildup);
|
||||||
if (comp.isOptOut) {
|
defaultBuildup[comp.tag] = ligSets;
|
||||||
optOutBuildup[comp.tag] = ligSets;
|
hives[`ligset-inherit-${gr}`] = { caltBuildup: ligSets };
|
||||||
} else {
|
|
||||||
optInBuildup[comp.tag] = ligSets;
|
|
||||||
}
|
|
||||||
if (!comp.isOptOut) {
|
|
||||||
hives["ligset-" + gr] = { caltBuildup: ligSets };
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
para.ligation = {
|
para.ligation = {
|
||||||
defaultBuildup: { ...optInBuildup, ...optOutBuildup },
|
defaultBuildup,
|
||||||
caltBuildup: []
|
caltBuildup: []
|
||||||
};
|
};
|
||||||
if (argv.ligations) {
|
if (argv.ligations) {
|
||||||
if (argv.ligations.inherits)
|
if (argv.ligations.inherits)
|
||||||
Parameters.apply(para.ligation, hives, ["ligset-" + argv.ligations.inherits]);
|
Parameters.apply(para.ligation, hives, [`ligset-inherit-${argv.ligations.inherits}`]);
|
||||||
if (argv.ligations.disables)
|
if (argv.ligations.disables)
|
||||||
Parameters.apply(
|
Parameters.apply(
|
||||||
para.ligation,
|
para.ligation,
|
||||||
hives,
|
hives,
|
||||||
argv.ligations.disables.map(x => `disable-${x}`)
|
argv.ligations.disables.map(x => `ligset-disable-${x}`)
|
||||||
);
|
);
|
||||||
if (argv.ligations.enables)
|
if (argv.ligations.enables)
|
||||||
Parameters.apply(
|
Parameters.apply(
|
||||||
para.ligation,
|
para.ligation,
|
||||||
hives,
|
hives,
|
||||||
argv.ligations.enables.map(x => `enable-${x}`)
|
argv.ligations.enables.map(x => `ligset-enable-${x}`)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -124,12 +124,13 @@ desc = 'Transform `:>` into `:` and a narrow arrow.'
|
||||||
|
|
||||||
###################################################################################################
|
###################################################################################################
|
||||||
|
|
||||||
[composite.calt]
|
# This feature is on by default by many software
|
||||||
isOptOut = true # This feature is on by default by many software
|
[composite.default-calt]
|
||||||
tag = 'calt'
|
tag = 'calt'
|
||||||
buildup = ['center-ops', 'arrow', 'html-comment', 'trig', 'llgg', 'llggeq', 'eqeq', 'exeq', 'ineq', 'plusplus', 'kern-dotty']
|
buildup = ['center-ops', 'arrow', 'html-comment', 'trig', 'llgg', 'llggeq', 'eqeq', 'exeq', 'ineq', 'plusplus', 'kern-dotty']
|
||||||
brief = 'Default'
|
brief = 'Default'
|
||||||
desc = 'Default setting in text editors'
|
desc = 'Default setting in text editors'
|
||||||
|
longDesc = 'Inherit default ligation set'
|
||||||
|
|
||||||
[composite.dlig]
|
[composite.dlig]
|
||||||
tag = 'dlig'
|
tag = 'dlig'
|
||||||
|
|
|
@ -31,9 +31,9 @@ l = 'italic'
|
||||||
# Configure ligations
|
# Configure ligations
|
||||||
|
|
||||||
[buildPlans.iosevka-custom.ligations]
|
[buildPlans.iosevka-custom.ligations]
|
||||||
inherits = "calt" # Optional; inherits an existing ligation set
|
inherits = "default-calt" # Optional; inherits an existing ligation set
|
||||||
disables = [] # Optional; disable specific ligation groups, overrides inherited ligation set
|
disables = [] # Optional; disable specific ligation groups, overrides inherited ligation set
|
||||||
enables = [] # Optional; enable specific ligation groups, overrides inherited ligation set
|
enables = [] # Optional; enable specific ligation groups, overrides inherited ligation set
|
||||||
|
|
||||||
# End ligation section
|
# End ligation section
|
||||||
###################################################################################################
|
###################################################################################################
|
||||||
|
|
|
@ -177,7 +177,6 @@ async function processLigSetPreDef() {
|
||||||
const headerPath = path.resolve(__dirname, "fragments/description-predefined-ligation-sets.md");
|
const headerPath = path.resolve(__dirname, "fragments/description-predefined-ligation-sets.md");
|
||||||
md.log(await fs.readFile(headerPath, "utf-8"));
|
md.log(await fs.readFile(headerPath, "utf-8"));
|
||||||
for (const gr in ligData.rawSets) {
|
for (const gr in ligData.rawSets) {
|
||||||
if (ligData.rawSets[gr].isOptOut) continue;
|
|
||||||
const longDesc =
|
const longDesc =
|
||||||
ligData.rawSets[gr].longDesc ||
|
ligData.rawSets[gr].longDesc ||
|
||||||
`Default ligation set would be assigned to ${ligData.rawSets[gr].desc}`;
|
`Default ligation set would be assigned to ${ligData.rawSets[gr].desc}`;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue