Further improve colinar handling
This commit is contained in:
parent
229d624ebf
commit
9d8fe1c3ed
3 changed files with 27 additions and 24 deletions
|
@ -4,7 +4,7 @@ const fs = require("fs-extra");
|
|||
const zlib = require("zlib");
|
||||
const { encode, decode } = require("@msgpack/msgpack");
|
||||
|
||||
const Edition = 5;
|
||||
const Edition = 6;
|
||||
const MAX_AGE = 5;
|
||||
|
||||
class GfEntry {
|
||||
|
|
|
@ -199,29 +199,32 @@ class FairizedShapeSink {
|
|||
return c;
|
||||
}
|
||||
removeColinearKnots(c0) {
|
||||
const c = c0.slice(0),
|
||||
shouldRemove = [];
|
||||
for (let i = 0; i < c.length; i++) {
|
||||
const zPrev = c[(i - 1 + c.length) % c.length],
|
||||
zCurr = c[i],
|
||||
zNext = c[(i + 1) % c.length];
|
||||
if (
|
||||
zPrev.type === Point.Type.Corner &&
|
||||
zCurr.type === Point.Type.Corner &&
|
||||
zNext.type === Point.Type.Corner
|
||||
) {
|
||||
if (aligned(zPrev.x, zCurr.x, zNext.x) && between(zPrev.y, zCurr.y, zNext.y))
|
||||
shouldRemove[i] = true;
|
||||
if (aligned(zPrev.y, zCurr.y, zNext.y) && between(zPrev.x, zCurr.x, zNext.x))
|
||||
shouldRemove[i] = true;
|
||||
const c = c0.slice(0);
|
||||
let lengthBefore = c.length,
|
||||
lengthAfter = c.length;
|
||||
do {
|
||||
lengthBefore = c.length;
|
||||
const shouldRemove = [];
|
||||
for (let i = 0; i < c.length; i++) {
|
||||
const zPrev = c[(i - 1 + c.length) % c.length],
|
||||
zCurr = c[i],
|
||||
zNext = c[(i + 1) % c.length];
|
||||
if (zPrev.type === Point.Type.Corner && zNext.type === Point.Type.Corner) {
|
||||
if (aligned(zPrev.x, zCurr.x, zNext.x) && between(zPrev.y, zCurr.y, zNext.y))
|
||||
shouldRemove[i] = true;
|
||||
if (aligned(zPrev.y, zCurr.y, zNext.y) && between(zPrev.x, zCurr.x, zNext.x))
|
||||
shouldRemove[i] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
let n = 0;
|
||||
for (let i = 0; i < c.length; i++) {
|
||||
if (!shouldRemove[i]) c[n++] = c[i];
|
||||
}
|
||||
c.length = n;
|
||||
lengthAfter = c.length;
|
||||
} while (lengthAfter < lengthBefore);
|
||||
|
||||
const c2 = [];
|
||||
for (let i = 0; i < c.length; i++) {
|
||||
if (!shouldRemove[i]) c2.push(c[i]);
|
||||
}
|
||||
return c2;
|
||||
return c;
|
||||
}
|
||||
}
|
||||
function isOccurrent(zFirst, zLast) {
|
||||
|
|
|
@ -19,8 +19,8 @@ glyph-block Letter-Cyrillic-De : begin
|
|||
include : HBarBottom (cutleft - descenderOverflow) (cutright + descenderOverflow) 0
|
||||
include : VBarRight cutright 0 top
|
||||
include : HalfXStrand false false (topleft + Stroke * HVContrast) top (cutleft + HalfStroke * HVContrast * 0.8) HalfStroke 0.1 0.75 0.5
|
||||
include : VBarLeft (cutleft - descenderOverflow) (-LongJut + HalfStroke) 0
|
||||
include : VBarRight (cutright + descenderOverflow) (-LongJut + HalfStroke) 0
|
||||
include : VBarLeft (cutleft - descenderOverflow) (-LongJut + HalfStroke) 0.1
|
||||
include : VBarRight (cutright + descenderOverflow) (-LongJut + HalfStroke) 0.1
|
||||
|
||||
if SLAB : then
|
||||
include : dispiro
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue