Fixup format

This commit is contained in:
Belleve Invis 2020-04-12 00:10:12 -07:00
parent 0b1452a3a7
commit e6da99af60
15 changed files with 47 additions and 45 deletions

View file

@ -1,4 +1,6 @@
# .prettierrc
printWidth: 100
useTabs: true
tabWidth: 4
# .prettierrc
printWidth: 100
useTabs: true
tabWidth: 4
trailingComma: none
arrowParens: avoid

View file

@ -10,7 +10,7 @@ const { setFontMetrics } = require("../meta/aesthetics");
const regulateGlyphs = require("../support/regulate-glyph");
const gcFont = require("./gc");
module.exports = function(para) {
module.exports = function (para) {
const font = EmptyFont();
const gs = buildGlyphs(para);

View file

@ -1,6 +1,6 @@
"use strict";
module.exports = function() {
module.exports = function () {
return {
head: {
checkSumAdjustment: 369537602,

View file

@ -12,7 +12,7 @@ const formLigationData = require("../support/ligation-data");
const regulateGlyphs = require("../support/regulate-glyph");
const toml = require("toml");
main().catch((e) => {
main().catch(e => {
console.error(e);
process.exit(1);
});
@ -57,7 +57,7 @@ async function getParameters(argv) {
version: argv.ver,
weight: argv["menu-weight"] - 0,
width: argv["menu-width"] - 0,
slant: argv["menu-slant"],
slant: argv["menu-slant"]
};
return para;
@ -108,7 +108,7 @@ async function saveCharMap(font) {
glyph.name,
glyph.unicode,
typographicFeatures,
glyph.featureSelector ? Object.keys(glyph.featureSelector) : [],
glyph.featureSelector ? Object.keys(glyph.featureSelector) : []
]);
}
await fs.writeFile(argv.charmap, JSON.stringify(charMap), "utf8");

View file

@ -30,7 +30,7 @@ exports.OffsetCurve = class OffsetCurve {
}
};
exports.curveToContour = function(curve, segments) {
exports.curveToContour = function (curve, segments) {
const z0 = curve.eval(0);
const z1 = curve.eval(1);
const offPoints = fixedCubify(curve, segments || 16);

View file

@ -350,9 +350,9 @@ function fairifyImpl(sourceCubicContour, gizmo, builder) {
return buildCurve(splitContour, gizmo, builder);
}
exports.fairifyQuad = function(sourceCubicContour, gizmo) {
exports.fairifyQuad = function (sourceCubicContour, gizmo) {
return fairifyImpl(sourceCubicContour, gizmo, QuadBuilder);
};
exports.fairifySpiro = function(sourceCubicContour, gizmo) {
exports.fairifySpiro = function (sourceCubicContour, gizmo) {
return fairifyImpl(sourceCubicContour, gizmo, SpiroBuilder);
};

View file

@ -1,6 +1,6 @@
"use strict";
module.exports = function(xs, ys) {
module.exports = function (xs, ys) {
let i,
length = xs.length;
@ -9,7 +9,7 @@ module.exports = function(xs, ys) {
throw "Need an equal count of xs and ys.";
}
if (length === 0) {
return function() {
return function () {
return 0;
};
}
@ -17,7 +17,7 @@ module.exports = function(xs, ys) {
// Impl: Precomputing the result prevents problems if ys is mutated later and allows garbage collection of ys
// Impl: Unary plus properly converts values to numbers
let result = +ys[0];
return function() {
return function () {
return result;
};
}
@ -27,7 +27,7 @@ module.exports = function(xs, ys) {
for (i = 0; i < length; i++) {
indexes.push(i);
}
indexes.sort(function(a, b) {
indexes.sort(function (a, b) {
return xs[a] < xs[b] ? -1 : 1;
});
let oldXs = xs,
@ -82,7 +82,7 @@ module.exports = function(xs, ys) {
}
// Return interpolant function
return function(x) {
return function (x) {
// The rightmost point in the dataset should give an exact result
let i = xs.length - 1;
if (x == xs[i]) {

View file

@ -2,7 +2,7 @@
const blend = require("./monotonic-interpolate");
module.exports = function(aspect, hive, params, sink) {
module.exports = function (aspect, hive, params, sink) {
if (!hive || !hive.blend || !params) return;
const block = hive.blend;

View file

@ -62,7 +62,7 @@ function byGlyphPriority(a, b) {
return a.name < b.name ? -1 : a.name > b.name ? 1 : 0;
}
module.exports = function(gs, skew) {
module.exports = function (gs, skew) {
const excludeUnicode = new Set();
excludeUnicode.add(0x80);
for (let c = 0x2500; c <= 0x259f; c++) excludeUnicode.add(c);

View file

@ -48,7 +48,7 @@ const ligationSamples = [
arrow("<-->"),
arrow("<--->"),
arrow("<---->"),
htmlComment("<!--"),
htmlComment("<!--")
],
[
arrow2("=<<"),
@ -69,7 +69,7 @@ const ligationSamples = [
arrow("<==>"),
arrow("<===>"),
arrow("<====>"),
htmlComment("<!---"),
htmlComment("<!---")
],
[
arrow("<------"),
@ -91,7 +91,7 @@ const ligationSamples = [
eqeqeq("==="),
exeqeq("!=="),
eqslasheq("=/="),
eqexeq("=!="),
eqexeq("=!=")
],
[
centerOps(":="),
@ -114,8 +114,8 @@ const ligationSamples = [
plusplus("++"),
plusplus("+++"),
logc("|-"),
logc("-|"),
],
logc("-|")
]
];
const ligationSamplesNarrow = [
@ -129,7 +129,7 @@ const ligationSamplesNarrow = [
arrow("->>"),
arrow("-->"),
arrow("--->"),
htmlComment("<!--"),
htmlComment("<!--")
],
[
arrow2("-<<"),
@ -140,7 +140,7 @@ const ligationSamplesNarrow = [
arrow2(">>-"),
arrow("<-->"),
arrow("<--->"),
arrow("<---->"),
arrow("<---->")
],
[
arrow("<=="),
@ -152,7 +152,7 @@ const ligationSamplesNarrow = [
arrow("=>>"),
arrow("==>"),
arrow("===>"),
htmlComment("<!---"),
htmlComment("<!---")
],
[
arrow2("=<<"),
@ -163,7 +163,7 @@ const ligationSamplesNarrow = [
arrow2(">>="),
arrow("<==>"),
arrow("<===>"),
arrow("<====>"),
arrow("<====>")
],
[
arrow("<-------"),
@ -172,7 +172,7 @@ const ligationSamplesNarrow = [
arrow("<~~"),
arrow("<~"),
arrow("~>"),
arrow("~~>"),
arrow("~~>")
],
[
logc("\\/"),
@ -185,7 +185,7 @@ const ligationSamplesNarrow = [
eqeqeq("==="),
exeqeq("!=="),
eqslasheq("=/="),
eqexeq("=!="),
eqexeq("=!=")
],
[
centerOps(":="),
@ -199,7 +199,7 @@ const ligationSamplesNarrow = [
trig("|>"),
centerOps("+:"),
centerOps("-:"),
centerOps("=:"),
centerOps("=:")
],
[
kernDotty("::"),
@ -211,18 +211,18 @@ const ligationSamplesNarrow = [
plusplus("++"),
plusplus("+++"),
logc("|-"),
logc("-|"),
],
logc("-|")
]
];
module.exports = async function getLigationData() {
const ligToml = await fs.readFile(path.join(__dirname, "../../ligation-set.toml"), "utf8");
const ligData = toml.parse(ligToml);
const ligationSets = buildLigationSet(ligData, (comp) => comp.buildup.join(","));
const ligationSets = buildLigationSet(ligData, comp => comp.buildup.join(","));
const nonMergeLigationSets = buildLigationSet(
ligData,
(comp) => comp.tag + comp.buildup.join(",")
comp => comp.tag + comp.buildup.join(",")
);
return {
@ -231,13 +231,13 @@ module.exports = async function getLigationData() {
cherry: ligData.simple,
rawSets: ligData.composite,
sets: [...ligationSets.values()],
nonMergeSets: [...nonMergeLigationSets.values()],
nonMergeSets: [...nonMergeLigationSets.values()]
};
};
function buildLigationSet(ligData, getKey) {
const ligationSets = new Map([
["*off", { tag: "calt", switch: "off", desc: "Ligation Off", brief: "Off", buildup: [] }],
["*off", { tag: "calt", switch: "off", desc: "Ligation Off", brief: "Off", buildup: [] }]
]);
for (const sel in ligData.composite) {
const comp = ligData.composite[sel];
@ -250,7 +250,7 @@ function buildLigationSet(ligData, getKey) {
buildup: comp.buildup,
tagName: comp.tag,
desc: comp.desc,
brief: comp.brief || comp.desc,
brief: comp.brief || comp.desc
};
ligationSets.set(key, item);
} else {

View file

@ -2,7 +2,7 @@ const fs = require("fs-extra");
const path = require("path");
const toml = require("toml");
module.exports = async function() {
module.exports = async function () {
const variantsToml = await fs.readFile(path.join(__dirname, "../../variants.toml"), "utf8");
const variants = toml.parse(variantsToml);

View file

@ -18,7 +18,7 @@ module.exports = async function (charMapPath) {
...(exemplar.auxiliary || []),
...(exemplar.index || []),
...(exemplar.numbers || []),
...(exemplar.punctuation || []),
...(exemplar.punctuation || [])
].join("");
let fullSupport = true;
@ -64,9 +64,9 @@ module.exports = async function (charMapPath) {
return {
stats: {
glyphCount: charMap.length,
codePointCount: rawCoverage.size,
codePointCount: rawCoverage.size
},
unicodeCoverage: gatherCov(rawCoverage),
languages: Array.from(supportLangSet).sort(),
languages: Array.from(supportLangSet).sort()
};
};

View file

@ -1,6 +1,6 @@
const fs = require("fs");
module.exports = function(output, family, hs, formats) {
module.exports = function (output, family, hs, formats) {
let ans = ``;
for (const term of hs) {
let src = formats

View file

@ -2,7 +2,7 @@
const fs = require("fs");
const ttf2woff = require("ttf2woff");
module.exports = function(from, to) {
module.exports = function (from, to) {
const input = fs.readFileSync(from);
const ttf = new Uint8Array(input);
const woff = Buffer.from(ttf2woff(ttf, {}).buffer);

View file

@ -2,7 +2,7 @@
const fs = require("fs");
const ttf2woff2 = require("ttf2woff2");
module.exports = function(from, to) {
module.exports = function (from, to) {
const input = fs.readFileSync(from);
const woff = ttf2woff2(input);
fs.writeFileSync(to, woff);