Refactor into geometry tree

This commit is contained in:
be5invis 2021-02-27 21:01:20 -08:00
parent f17710b0a4
commit a81c477fab
6 changed files with 207 additions and 121 deletions

View file

@ -3,6 +3,7 @@
const TypoGeom = require("typo-geom");
const Point = require("../../support/point");
const CurveUtil = require("../../support/curve-util");
const util = require("util");
module.exports = finalizeGlyphs;
function finalizeGlyphs(para, glyphStore) {
@ -16,7 +17,7 @@ function finalizeGlyphs(para, glyphStore) {
function suppressNaN(glyphStore) {
for (const g of glyphStore.glyphs()) {
if (g.geometry) g.geometry.suppressNaN();
// if (g.geometry) g.geometry.suppressNaN();
}
}
@ -28,7 +29,7 @@ function regulateGlyphStore(skew, glyphStore) {
if (!regulateCompositeGlyph(glyphStore, g)) {
const cs = g.geometry.asContours();
g.clearGeometry();
for (const c of cs) g.geometry.addContour(c);
g.includeContours(cs, 0, 0);
}
}
for (const g of glyphStore.glyphs()) {
@ -55,7 +56,7 @@ function regulateSimpleGlyph(g, skew) {
for (const contour of cs) for (const z of contour) z.x += z.y * skew;
g.clearGeometry();
for (const c of cs) g.geometry.addContour(c);
g.includeContours(cs, 0, 0);
}
///////////////////////////////////////////////////////////////////////////////////////////////////