Fix internal seams of variants of outlined letters U+1CCE6 and U+1CCEF (#2509). (#2512)

Closes #2509
This commit is contained in:
Belleve 2024-09-21 14:25:18 -10:00 committed by GitHub
parent 902068448a
commit ad42410219
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 44 additions and 44 deletions

1
changes/31.7.1.md Normal file
View file

@ -0,0 +1 @@
* Fix internal seams of variants of outlined letters U+1CCE6 and U+1CCEF (#2509).

View file

@ -19,8 +19,7 @@ glyph-block Letter-Latin-Upper-Q : begin
define [QHorizontalTailedBody df top sw] : begin define [QHorizontalTailedBody df top sw] : begin
define fine : mix ShoulderFine sw 0.125 define fine : mix ShoulderFine sw 0.125
return : dispiro return : dispiro
flat (df.middle - sw * TanSlope + O) (sw - fine) [widths.lhs fine] g4.right.mid [arch.adjust-x.bot df.middle fine] (sw - fine) [widths.lhs fine]
curl [arch.adjust-x.bot df.middle fine] (sw - fine)
archv archv
flat df.rightSB ArchDepthA [widths.lhs sw] flat df.rightSB ArchDepthA [widths.lhs sw]
curl df.rightSB (top - ArchDepthB) curl df.rightSB (top - ArchDepthB)
@ -28,7 +27,8 @@ glyph-block Letter-Latin-Upper-Q : begin
flat df.leftSB (top - ArchDepthA) flat df.leftSB (top - ArchDepthA)
curl df.leftSB ArchDepthB curl df.leftSB ArchDepthB
arcvh arcvh
straight.right.end [arch.adjust-x.bot df.middle] 0 flat [arch.adjust-x.bot df.middle] 0
curl df.rightSB 0
define [QOpenSwashyBody df top] : glyph-proc define [QOpenSwashyBody df top] : glyph-proc
define fine : AdviceStroke 3.5 define fine : AdviceStroke 3.5
@ -125,10 +125,6 @@ glyph-block Letter-Latin-Upper-Q : begin
VBar.m df.middle [mix Descender HalfStroke 1.75] 0 sw VBar.m df.middle [mix Descender HalfStroke 1.75] 0 sw
VBar.m df.middle 0 TailDepth VBar.m df.middle 0 TailDepth
define [QHorizontalTail df tio sw] : dispiro
flat [arch.adjust-x.bot df.middle] 0 [widths.lhs : AdviceStroke 3]
curl [mix df.rightSB df.width 0.5] 0
define detachedTailGap : Math.max (-0.25 * Descender) [AdviceStroke 12] define detachedTailGap : Math.max (-0.25 * Descender) [AdviceStroke 12]
define yObliqueTailStart : 0 - detachedTailGap - Stroke * 0.875 define yObliqueTailStart : 0 - detachedTailGap - Stroke * 0.875
define yObliqueTailEnd : [mix 0 Descender 0.75] - Stroke * 0.5 define yObliqueTailEnd : [mix 0 Descender 0.75] - Stroke * 0.5
@ -159,7 +155,7 @@ glyph-block Letter-Latin-Upper-Q : begin
crossing { QStdBody [AdviceStroke 4] QCrossing 'capital' 'e' } crossing { QStdBody [AdviceStroke 4] QCrossing 'capital' 'e' }
crossingBaseline { QStdBody [AdviceStroke 4] QCrossingBaseline 'capital' 'e' } crossingBaseline { QStdBody [AdviceStroke 4] QCrossingBaseline 'capital' 'e' }
verticalCrossing { QStdBody QInnerVertSw QVerticalCrossing 'capDesc' 'p' } verticalCrossing { QStdBody QInnerVertSw QVerticalCrossing 'capDesc' 'p' }
horizontalTailed { QHorizontalTailedBody [AdviceStroke 3] QHorizontalTail 'capital' 'e' } horizontalTailed { QHorizontalTailedBody [AdviceStroke 3] no-shape 'capital' 'e' }
detachedTailed { QStdBody Stroke QDetachedTail 'capDesc' 'p' } detachedTailed { QStdBody Stroke QDetachedTail 'capDesc' 'p' }
detachedBendTailed { QStdBody Stroke QDetachedBendTail 'capDesc' 'p' } detachedBendTailed { QStdBody Stroke QDetachedBendTail 'capDesc' 'p' }
openSwash { QOpenSwashyBody Stroke QSwashyTail 'capDesc' 'p' } openSwash { QOpenSwashyBody Stroke QSwashyTail 'capDesc' 'p' }

View file

@ -13,41 +13,43 @@ glyph-block Letter-Latin-X : begin
glyph-block-import Letter-Shared-Shapes : CyrDescender PalatalHook glyph-block-import Letter-Shared-Shapes : CyrDescender PalatalHook
glyph-block-export HalfXStrand glyph-block-export HalfXStrand
define [HalfXStrand stb fSlab _leftx lefty rightx righty turn pStraight tension _sw] : glyph-proc define [HalfXStrand stb fSlab _xOuter yOuter xCenter yCenter turn pStraight tension _sw _pConn] : glyph-proc
local sw : fallback _sw Stroke local sw : fallback _sw Stroke
local sbCor : if stb ([StrokeWidthBlend 1 6] * OX * ([Math.abs (lefty - righty)] / CAP)) 0 local sbCor : if stb ([StrokeWidthBlend 1 6] * OX * ([Math.abs (yOuter - yCenter)] / CAP)) 0
local leftx : _leftx + ([HSwToV : 0.5 * sw] + [Math.max (-SideJut) sbCor]) * [if (rightx > _leftx) 1 (-1)] local xOuter : _xOuter + ([HSwToV : 0.5 * sw] + [Math.max (-SideJut) sbCor]) * [if (xCenter > _xOuter) 1 (-1)]
if stb : begin if stb : begin
local hst : (0.5 * sw) * [DiagCor (righty - lefty) (rightx - leftx) 0 0] local hst : (0.5 * sw) * [DiagCor (yCenter - yOuter) (xCenter - xOuter) 0 0]
local hse : (0.5 * sw) * [Math.min 0.97 ([AdviceStroke 3] / Stroke)] local hse : (0.5 * sw) * [Math.min 0.97 ([AdviceStroke 3] / Stroke)]
local leftx2 : _leftx + ([HSwToV hst] + [Math.max (-SideJut) sbCor]) * [if (rightx > _leftx) 1 (-1)] local xOuterAdjusted : _xOuter + ([HSwToV hst] + [Math.max (-SideJut) sbCor]) * [if (xCenter > _xOuter) 1 (-1)]
include : dispiro include : dispiro
corner leftx2 lefty [widths.heading hst hst [if (lefty < righty) Upward Downward]] corner xOuterAdjusted yOuter [widths.heading hst hst [if (yOuter < yCenter) Upward Downward]]
corner rightx righty [widths.center : 2 * hse] corner xCenter yCenter [widths.center : 2 * hse]
: else : begin : else : begin
local height : Math.abs (lefty - righty) local height : Math.abs (yOuter - yCenter)
local slabClearance : if fSlab ((sw / Stroke) * [AdviceStroke2 2 3 height]) 0 local slabClearance : if fSlab ((sw / Stroke) * [AdviceStroke2 2 3 height]) 0
local turnyleft : mix lefty righty [if fSlab [Math.max turn (slabClearance / height)] turn] local turnyOuter : mix yOuter yCenter [if fSlab [Math.max turn (slabClearance / height)] turn]
local cyleft : mix turnyleft righty tension local cyOuter : mix turnyOuter yCenter tension
local straightxleft : mix leftx rightx pStraight local straightXOuter : mix xOuter xCenter pStraight
local straightyleft : mix cyleft righty pStraight local straightYOuter : mix cyOuter yCenter pStraight
local xCenterAdj : mix xCenter xOuter [fallback _pConn 0]
local yCenterAdj : mix yCenter cyOuter [fallback _pConn 0]
include : dispiro include : dispiro
widths.center sw widths.center sw
flat leftx lefty [heading [if (lefty < righty) Upward Downward]] flat xOuter yOuter [heading [if (yOuter < yCenter) Upward Downward]]
curl leftx turnyleft [heading [if (lefty < righty) Upward Downward]] curl xOuter turnyOuter [heading [if (yOuter < yCenter) Upward Downward]]
quadControls 0 ((cyleft - turnyleft) / (straightyleft - turnyleft)) 24 quadControls 0 ((cyOuter - turnyOuter) / (straightYOuter - turnyOuter)) 24
flat straightxleft straightyleft flat straightXOuter straightYOuter
curl rightx righty curl xCenterAdj yCenterAdj
glyph-block-export XStrand glyph-block-export XStrand
define [XStrand stb slab _leftx lefty _rightx righty turn pStraight tension _sw] : glyph-proc define [XStrand stb slab xLeft yLeft xRight yRight turn pStraight tension _sw] : glyph-proc
local middlex : mix _leftx _rightx 0.5 local xMid : mix xLeft xRight 0.5
local middley : mix lefty righty 0.5 local yMid : mix yLeft yRight 0.5
include : HalfXStrand stb slab _leftx lefty middlex middley turn pStraight tension _sw include : HalfXStrand stb slab xLeft yLeft xMid yMid turn pStraight tension _sw (-0.001)
include : HalfXStrand stb slab _rightx righty middlex middley turn pStraight tension _sw include : HalfXStrand stb slab xRight yRight xMid yMid turn pStraight tension _sw (-0.001)
define [XChanceryStrand sign leftX leftY rightX rightY fHalf _sw] : begin define [XChanceryStrand sign leftX leftY rightX rightY fHalf _sw] : begin
local sw : fallback _sw Stroke local sw : fallback _sw Stroke

View file

@ -20,19 +20,8 @@ function regulateGlyphStore(cache, para, skew, glyphStore) {
function flattenSimpleGlyph(cache, para, skew, g) { function flattenSimpleGlyph(cache, para, skew, g) {
try { try {
let gSimplified; if (!g.gizmo) throw new TypeError("No gizmo");
const needsTransform = g.gizmo ? !Transform.isTranslate(g.gizmo) : skew != 0; const gSimplified = Geom.SimplifyGeometry.wrapWithGizmo(g.geometry, g.gizmo);
if (needsTransform) {
const tfBack = g.gizmo ? g.gizmo.inverse() : new Transform(1, -skew, 0, 1, 0, 0);
const tfForward = g.gizmo ? g.gizmo : new Transform(1, +skew, 0, 1, 0, 0);
gSimplified = Geom.TransformedGeometry.create(
tfForward,
new Geom.SimplifyGeometry(Geom.TransformedGeometry.create(tfBack, g.geometry)),
);
} else {
gSimplified = new Geom.SimplifyGeometry(g.geometry);
}
const cs = gSimplified.toContours({ cache }); const cs = gSimplified.toContours({ cache });
g.clearGeometry(); g.clearGeometry();
g.includeContours(cs); g.includeContours(cs);

View file

@ -5,7 +5,7 @@ import zlib from "zlib";
import * as CurveUtil from "@iosevka/geometry/curve-util"; import * as CurveUtil from "@iosevka/geometry/curve-util";
import { encode, decode } from "@msgpack/msgpack"; import { encode, decode } from "@msgpack/msgpack";
const Edition = 45; const Edition = 46;
const MAX_AGE = 16; const MAX_AGE = 16;
class GfEntry { class GfEntry {
constructor(age, value) { constructor(age, value) {

View file

@ -771,6 +771,18 @@ export class SimplifyGeometry extends CachedGeometry {
h.embed(this.m_geom); h.embed(this.m_geom);
h.endStruct(); h.endStruct();
} }
static wrapWithGizmo(g, gizmo) {
const needsTransform = !Transform.isTranslate(gizmo);
if (needsTransform) {
return new TransformedGeometry(
gizmo,
new SimplifyGeometry(new TransformedGeometry(gizmo.inverse(), g)),
);
} else {
return new SimplifyGeometry(g);
}
}
} }
// Utility functions // Utility functions