Fix the design of the ESTIMATED SYMBOL (U+212E) to match its spec; Refine design of POWER SYMBOL (U+23FB) and HEAVY CHECK MARK (U+2714) (#2245)

* Make estimated sign match its spec

* Refine power standby symbol

* Check mark refinement

* Doc

* fmt
This commit is contained in:
Belleve 2024-03-18 17:37:17 -10:00 committed by GitHub
parent f28a26504a
commit 733f56fe79
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
33 changed files with 225 additions and 177 deletions

View file

@ -23,8 +23,8 @@ function convertContourToArcs(contour) {
switch (z.type) {
case Point.Type.CubicStart: {
const z1 = z;
const z2 = contour[j + 1];
const z3 = contour[j + 2];
const z2 = contour[(j + 1) % contour.length];
const z3 = contour[(j + 2) % contour.length];
newContour.push(
new TypoGeom.Arcs.Bez3(
z0,
@ -39,7 +39,7 @@ function convertContourToArcs(contour) {
}
case Point.Type.Quadratic: {
const zc = z;
let zf = contour[j + 1] || contour[0];
let zf = contour[(j + 1) % contour.length];
const zfIsCorner = zf.type === Point.Type.contour;
if (!zfIsCorner) zf = Point.from(Point.Type.Corner, zc).mix(0.5, zf);
newContour.push(

View file

@ -202,8 +202,8 @@ export class ReferenceGeometry extends GeometryBase {
}
unwrap() {
return new TransformedGeometry(
this.m_glyph.geometry,
Transform.Translate(this.m_x, this.m_y),
this.m_glyph.geometry,
);
}
toContours() {
@ -267,11 +267,16 @@ export class TaggedGeometry extends GeometryBase {
}
export class TransformedGeometry extends GeometryBase {
constructor(g, tfm) {
constructor(tfm, g) {
super();
this.m_geom = g;
this.m_transform = tfm;
this.m_geom = g;
}
withTransform(tfm) {
return new TransformedGeometry(Transform.Combine(this.m_transform, tfm), this.m_geom);
}
toContours() {
let result = [];
for (const c of this.m_geom.toContours()) {
@ -296,7 +301,7 @@ export class TransformedGeometry extends GeometryBase {
filterTag(fn) {
const e = this.m_geom.filterTag(fn);
if (!e) return null;
return new TransformedGeometry(e, this.m_transform);
return new TransformedGeometry(this.m_transform, e);
}
measureComplexity() {
return (
@ -308,26 +313,16 @@ export class TransformedGeometry extends GeometryBase {
const unwrapped = this.m_geom.unlinkReferences();
if (Transform.isIdentity(this.m_transform)) {
return unwrapped;
} else if (
unwrapped instanceof TransformedGeometry &&
Transform.isTranslate(this.m_transform) &&
Transform.isTranslate(unwrapped.m_transform)
) {
return new TransformedGeometry(
unwrapped.m_geom,
Transform.Translate(
this.m_transform.tx + unwrapped.m_transform.tx,
this.m_transform.ty + unwrapped.m_transform.ty,
),
);
} else if (unwrapped instanceof TransformedGeometry) {
return unwrapped.withTransform(this.m_transform);
} else {
return new TransformedGeometry(unwrapped, this.m_transform);
return new TransformedGeometry(this.m_transform, unwrapped);
}
}
toShapeStringOrNull() {
const sTarget = this.m_geom.toShapeStringOrNull();
if (!sTarget) return null;
return Format.struct("TransformedGeometry", sTarget, Format.gizmo(this.m_transform));
return Format.struct("TransformedGeometry", Format.gizmo(this.m_transform), sTarget);
}
}
@ -544,7 +539,7 @@ export class StrokeGeometry extends GeometryBase {
toContours() {
// Produce simplified arcs
const nonTransformedGeometry = new TransformedGeometry(this.m_geom, this.m_gizmo.inverse());
const nonTransformedGeometry = new TransformedGeometry(this.m_gizmo.inverse(), this.m_geom);
let arcs = TypoGeom.Boolean.removeOverlap(
CurveUtil.convertShapeToArcs(nonTransformedGeometry.toContours()),
TypoGeom.Boolean.PolyFillType.pftNonZero,

View file

@ -83,6 +83,11 @@ export class Transform {
static isPositive(tfm) {
return tfm.xx * tfm.yy - tfm.xy * tfm.yx > 0;
}
static Scale(sx, sy) {
return new Transform(sx, 0, 0, sy, 0, 0);
}
/** Combine the transfoems, in application order */
static Combine(...tfms) {
let z00 = new Vec2(0, 0);
let z10 = new Vec2(1, 0);