Optimize non-cached build performance

This commit is contained in:
be5invis 2023-12-22 01:53:19 -08:00
parent 65547da947
commit dcdf72eea3
17 changed files with 141 additions and 114 deletions

View file

@ -1,18 +1,18 @@
{
"name": "@iosevka/font-glyphs",
"version": "28.0.2",
"private": true,
"exports": {
".": "./src/index.mjs",
"./aesthetics": "./src/meta/aesthetics.mjs",
"./unicode-knowledge": "./src/meta/unicode-knowledge.mjs"
},
"dependencies": {
"@iosevka/font-kits": "28.0.2",
"@iosevka/geometry": "28.0.2",
"@iosevka/geometry-cache": "28.0.2",
"@iosevka/glyph": "28.0.2",
"@iosevka/util": "28.0.2",
"typo-geom": "^0.13.1"
}
"name": "@iosevka/font-glyphs",
"version": "28.0.2",
"private": true,
"exports": {
".": "./src/index.mjs",
"./aesthetics": "./src/meta/aesthetics.mjs",
"./unicode-knowledge": "./src/meta/unicode-knowledge.mjs"
},
"dependencies": {
"@iosevka/font-kits": "28.0.2",
"@iosevka/geometry": "28.0.2",
"@iosevka/geometry-cache": "28.0.2",
"@iosevka/glyph": "28.0.2",
"@iosevka/util": "28.0.2",
"typo-geom": "^0.13.2"
}
}

View file

@ -1,6 +1,5 @@
$$include '../meta/macros.ptl'
import [Arcs Quadify ShapeConv] from "typo-geom"
import [mix linreg clamp fallback] from "@iosevka/util"
import [TieMark AnyDerivingCv ScheduleLeaningMark LeaningMark LeaningMarkSpacer] from "@iosevka/glyph/relation"

View file

@ -1,6 +1,6 @@
$$include '../meta/macros.ptl'
import [Arcs Quadify ShapeConv] from "typo-geom"
import [Arcs ShapeConv] from "typo-geom"
import [OffsetCurve BezToContoursSink GEOMETRY_PRECISION] from "@iosevka/geometry/curve-util"
import [mix linreg clamp fallback] from "@iosevka/util"
import [DesignParameters] from "../meta/aesthetics.mjs"

View file

@ -1,6 +1,5 @@
$$include '../meta/macros.ptl'
import [Arcs Quadify ShapeConv] from "typo-geom"
import [mix linreg clamp fallback] from "@iosevka/util"
import [ScheduleLeaningMark] from "@iosevka/glyph/relation"

View file

@ -1,6 +1,5 @@
$$include '../meta/macros.ptl'
import [Arcs Quadify ShapeConv] from "typo-geom"
import [mix linreg clamp fallback] from "@iosevka/util"
glyph-module

View file

@ -1,6 +1,5 @@
$$include '../meta/macros.ptl'
import [Arcs Quadify ShapeConv] from "typo-geom"
import [mix linreg clamp fallback] from "@iosevka/util"
import [DesignParameters] from "../meta/aesthetics.mjs"

View file

@ -1,6 +1,5 @@
$$include '../meta/macros.ptl'
import [Arcs Quadify ShapeConv] from "typo-geom"
import [mix linreg clamp fallback] from "@iosevka/util"
glyph-module

View file

@ -1,6 +1,5 @@
$$include '../meta/macros.ptl'
import [Arcs Quadify ShapeConv] from "typo-geom"
import [mix linreg clamp fallback] from "@iosevka/util"
import [DesignParameters] from "../meta/aesthetics.mjs"

View file

@ -1,6 +1,5 @@
$$include '../meta/macros.ptl'
import [Arcs Quadify ShapeConv] from "typo-geom"
import [mix linreg clamp fallback] from "@iosevka/util"
import [TieMark TieGlyph] from "@iosevka/glyph/relation"

View file

@ -1,16 +1,14 @@
{
"name": "@iosevka/font-kits",
"version": "28.0.2",
"private": true,
"exports": {
"./boole-kit": "./src/boole-kit.mjs",
"./spiro-kit": "./src/spiro-kit.mjs"
},
"dependencies": {
"@iosevka/geometry": "28.0.2",
"@iosevka/glyph": "28.0.2",
"@iosevka/util": "28.0.2",
"spiro": "^3.0.0",
"typo-geom": "^0.13.1"
}
"name": "@iosevka/font-kits",
"version": "28.0.2",
"private": true,
"exports": {
"./boole-kit": "./src/boole-kit.mjs",
"./spiro-kit": "./src/spiro-kit.mjs"
},
"dependencies": {
"@iosevka/geometry": "28.0.2",
"@iosevka/glyph": "28.0.2",
"@iosevka/util": "28.0.2"
}
}

View file

@ -1,26 +1,24 @@
{
"name": "@iosevka/font",
"version": "28.0.2",
"private": true,
"exports": {
".": "./src/index.mjs",
"./anchor": "./src/anchor.mjs",
"./point": "./src/point.mjs",
"./transform": "./src/transform.mjs"
},
"dependencies": {
"@iarna/toml": "^2.2.5",
"@iosevka/font-glyphs": "28.0.2",
"@iosevka/font-otl": "28.0.2",
"@iosevka/geometry": "28.0.2",
"@iosevka/geometry-cache": "28.0.2",
"@iosevka/glyph": "28.0.2",
"@iosevka/param": "28.0.2",
"@iosevka/util": "28.0.2",
"harfbuzzjs": "^0.3.4",
"ot-builder": "^1.7.3",
"semver": "^7.5.4",
"spiro": "^3.0.0",
"typo-geom": "^0.13.1"
}
"name": "@iosevka/font",
"version": "28.0.2",
"private": true,
"exports": {
".": "./src/index.mjs",
"./anchor": "./src/anchor.mjs",
"./point": "./src/point.mjs",
"./transform": "./src/transform.mjs"
},
"dependencies": {
"@iarna/toml": "^2.2.5",
"@iosevka/font-glyphs": "28.0.2",
"@iosevka/font-otl": "28.0.2",
"@iosevka/geometry": "28.0.2",
"@iosevka/geometry-cache": "28.0.2",
"@iosevka/glyph": "28.0.2",
"@iosevka/param": "28.0.2",
"@iosevka/util": "28.0.2",
"harfbuzzjs": "^0.3.4",
"ot-builder": "^1.7.3",
"semver": "^7.5.4"
}
}

View file

@ -88,16 +88,20 @@ class SimplifyGeometry extends Geom.GeometryBase {
this.m_geom = g;
}
asContours() {
const source = this.m_geom.asContours();
// Produce simplified arcs
let arcs = CurveUtil.convertShapeToArcs(this.m_geom.asContours());
if (!this.m_geom.producesSimpleContours()) {
arcs = TypoGeom.Boolean.removeOverlap(
arcs,
TypoGeom.Boolean.PolyFillType.pftNonZero,
CurveUtil.BOOLE_RESOLUTION
);
}
// Convert to TT curves
const sink = new QuadifySink();
TypoGeom.ShapeConv.transferGenericShape(
TypoGeom.Fairize.fairizeBezierShape(
TypoGeom.Boolean.removeOverlap(
CurveUtil.convertShapeToArcs(source),
TypoGeom.Boolean.PolyFillType.pftNonZero,
CurveUtil.BOOLE_RESOLUTION
)
),
TypoGeom.Fairize.fairizeBezierShape(arcs),
sink,
CurveUtil.GEOMETRY_PRECISION
);

View file

@ -3,7 +3,7 @@ import zlib from "zlib";
import { encode, decode } from "@msgpack/msgpack";
const Edition = 29;
const Edition = 30;
const MAX_AGE = 16;
class GfEntry {
constructor(age, value) {

View file

@ -15,6 +15,6 @@
"dependencies": {
"@iosevka/util": "28.0.2",
"spiro": "^3.0.0",
"typo-geom": "^0.13.1"
"typo-geom": "^0.13.2"
}
}

View file

@ -16,6 +16,9 @@ export class GeometryBase {
asReferences() {
throw new Error("Unimplemented");
}
producesSimpleContours() {
return false;
}
getDependencies() {
throw new Error("Unimplemented");
}
@ -217,6 +220,9 @@ export class ReferenceGeometry extends GeometryBase {
if (this.isEmpty()) return [];
return [{ glyph: this.m_glyph, x: this.m_x, y: this.m_y }];
}
producesSimpleContours() {
return this.unwrap().producesSimpleContours();
}
getDependencies() {
return [this.m_glyph];
}
@ -253,6 +259,9 @@ export class TaggedGeometry extends GeometryBase {
asReferences() {
return this.m_geom.asReferences();
}
producesSimpleContours() {
return this.m_geom.producesSimpleContours();
}
getDependencies() {
return this.m_geom.getDependencies();
}
@ -298,6 +307,9 @@ export class TransformedGeometry extends GeometryBase {
result.push({ glyph, x: x + this.m_transform.x, y: y + this.m_transform.y });
return result;
}
producesSimpleContours() {
return this.m_geom.producesSimpleContours();
}
getDependencies() {
return this.m_geom.getDependencies();
}
@ -350,6 +362,9 @@ export class RadicalGeometry extends GeometryBase {
asReferences() {
return null;
}
producesSimpleContours() {
return this.m_geom.producesSimpleContours();
}
getDependencies() {
return this.m_geom.getDependencies();
}
@ -406,6 +421,11 @@ export class CombineGeometry extends GeometryBase {
}
return results;
}
producesSimpleContours() {
if (this.m_parts.length === 0) return true;
if (this.m_parts.length > 1) return false;
return this.m_parts[0].producesSimpleContours();
}
getDependencies() {
let results = [];
for (const part of this.m_parts) {
@ -468,21 +488,43 @@ export class BooleanGeometry extends GeometryBase {
}
asContoursImpl() {
if (this.m_operands.length === 0) return [];
let arcs = CurveUtil.convertShapeToArcs(this.m_operands[0].asContours());
for (let j = 1; j < this.m_operands.length; j++) {
arcs = TypoGeom.Boolean.combine(
this.m_operator,
arcs,
CurveUtil.convertShapeToArcs(this.m_operands[j].asContours()),
TypoGeom.Boolean.PolyFillType.pftNonZero,
TypoGeom.Boolean.PolyFillType.pftNonZero,
CurveUtil.BOOLE_RESOLUTION
);
}
const stack = [];
this.asOpStackImpl(stack);
const arcs = TypoGeom.Boolean.combineStack(stack, CurveUtil.BOOLE_RESOLUTION);
const ctx = new CurveUtil.BezToContoursSink();
TypoGeom.ShapeConv.transferBezArcShape(arcs, ctx);
return ctx.contours;
}
asOpStackImpl(sink) {
if (this.m_operands.length === 0) {
sink.push({
type: "operand",
fillType: TypoGeom.Boolean.PolyFillType.pftNonZero,
shape: []
});
return;
}
for (const [i, operand] of this.m_operands.entries()) {
// Push operand
if (operand instanceof BooleanGeometry) {
operand.asOpStackImpl(sink);
} else {
sink.push({
type: "operand",
fillType: TypoGeom.Boolean.PolyFillType.pftNonZero,
shape: CurveUtil.convertShapeToArcs(operand.asContours())
});
}
// Push operator if i > 0
if (i > 0) sink.push({ type: "operator", operator: this.m_operator });
}
}
producesSimpleContours() {
return this.m_operands.length > 1;
}
asReferences() {
return null;
}

View file

@ -1,16 +1,14 @@
{
"name": "@iosevka/glyph",
"version": "28.0.2",
"private": true,
"exports": {
".": "./src/glyph.mjs",
"./store": "./src/store.mjs",
"./block": "./src/block.mjs",
"./relation": "./src/relation.mjs"
},
"dependencies": {
"@iosevka/geometry": "28.0.2",
"spiro": "^3.0.0",
"typo-geom": "^0.13.1"
}
"name": "@iosevka/glyph",
"version": "28.0.2",
"private": true,
"exports": {
".": "./src/glyph.mjs",
"./store": "./src/store.mjs",
"./block": "./src/block.mjs",
"./relation": "./src/relation.mjs"
},
"dependencies": {
"@iosevka/geometry": "28.0.2"
}
}