Fix shapes of sswash and srtail

This commit is contained in:
be5invis 2021-01-24 02:34:55 -08:00
parent a33a1bf882
commit 894a6cea4b
7 changed files with 62 additions and 53 deletions

View file

@ -28,8 +28,7 @@ glyph-block Letter-Latin-Lower-T : begin
if (sink == spiro-outline) {[corner (hookx - offset) top]} {} if (sink == spiro-outline) {[corner (hookx - offset) top]} {}
define [SmallTShape top bot] : glyph-proc define [SmallTShape top bot] : glyph-proc
local G : SmallTHookShapeT dispiro 0 top bot Stroke local g : include : SmallTHookShapeT dispiro 0 top bot Stroke
local g : G.call currentGlyph # Not using include
set-base-anchor 'bottomright' g.knots.(g.knots.length - 1).x g.knots.(g.knots.length - 1).y set-base-anchor 'bottomright' g.knots.(g.knots.length - 1).x g.knots.(g.knots.length - 1).y
set-base-anchor 'below' [mix xSmallTBarLeft g.knots.(g.knots.length - 1).x : StrokeWidthBlend 0.375 0.5] bot set-base-anchor 'below' [mix xSmallTBarLeft g.knots.(g.knots.length - 1).x : StrokeWidthBlend 0.375 0.5] bot
set-base-anchor 'overlay' (g.knots.0.x + 0.625 * Stroke * HVContrast) (top * 0.42) set-base-anchor 'overlay' (g.knots.0.x + 0.625 * Stroke * HVContrast) (top * 0.42)
@ -100,8 +99,7 @@ glyph-block Letter-Latin-Lower-T : begin
define [TDiagTailShape df top] : glyph-proc define [TDiagTailShape df top] : glyph-proc
local G : DiagTailedSmallTHookShape df top 0 Stroke local g : include : DiagTailedSmallTHookShape df top 0 Stroke
local g : G.call currentGlyph # Not using include
set-base-anchor 'overlay' (g.knots.0.x + 0.125 * Stroke * HVContrast) (top * 0.42) set-base-anchor 'overlay' (g.knots.0.x + 0.125 * Stroke * HVContrast) (top * 0.42)
include : HCrossBar.top include : HCrossBar.top

View file

@ -23,29 +23,37 @@ glyph-block Letter-Latin-S : begin
define tension : tensionCoeff * (0.5 - 0.4 * dist - 0.005 * strokeCoeff + slantCoeff * TanSlope) define tension : tensionCoeff * (0.5 - 0.4 * dist - 0.005 * strokeCoeff + slantCoeff * TanSlope)
return : alsoThruThem {{(0.5 - dist) tension} {(0.5 + dist) (1 - tension)}} [widths.center stroke] return : alsoThruThem {{(0.5 - dist) tension} {(0.5 + dist) (1 - tension)}} [widths.center stroke]
glyph-block-export SStroke define [SStrokeImpl st sb stroke refSwEss] : begin
define [SStroke] : params [[stroke : AdviceStroke2 2 3 CAP] [refSwEss Ess]] : begin
local ess : refSwEss * stroke / Stroke local ess : refSwEss * stroke / Stroke
define smooth : adviceSSmooth CAP (-1) stroke define smooth : adviceSSmooth CAP (-1) stroke
return : dispiro return : dispiro
widths.lhs stroke if st
list
SerifedArcStart_RtlLhs RightSB Middle CAP stroke Hook
list
g4 RightSB (CAP - Hook) g4 RightSB (CAP - Hook)
hookstart (CAP - O) (sw -- stroke) (swItalicAdj -- Stroke) hookstart (CAP - O) (sw -- stroke) (swItalicAdj -- Stroke)
g4 SB (CAP - smooth) g4 SB (CAP - smooth)
alsoThru.g2 0.5 0.5 [widths.center ess] alsoThru.g2 0.5 0.5 [widths.center ess]
g4 (RightSB - SOBot) smooth [widths 0 stroke] g4 (RightSB - SOBot) smooth [widths 0 stroke]
if sb
list
SerifedArcEnd_RtlRhs SB Middle 0 stroke Hook
list
hookend O (sw -- stroke) (swItalicAdj -- Stroke) hookend O (sw -- stroke) (swItalicAdj -- Stroke)
g4 (SB + SOBot) Hook g4 (SB + SOBot) Hook
glyph-block-export SStroke
define [SStroke] : params [[stroke : AdviceStroke2 2 3 CAP] [refSwEss Ess]] : begin
return : SStrokeImpl false false stroke refSwEss
define [HalfSlabSStroke] : params [[stroke : AdviceStroke2 2 3 CAP] [refSwEss Ess]] : begin
return : SStrokeImpl true false stroke refSwEss
define [SlabSStroke] : params [[stroke : AdviceStroke2 2 3 CAP] [refSwEss Ess]] : begin define [SlabSStroke] : params [[stroke : AdviceStroke2 2 3 CAP] [refSwEss Ess]] : begin
define ess : refSwEss * stroke / Stroke return : SStrokeImpl true true stroke refSwEss
define smooth : adviceSSmooth CAP (-1) stroke
return : dispiro
SerifedArcStart_RtlLhs RightSB Middle CAP stroke Hook
g4 SB (CAP - smooth)
alsoThru.g2 0.5 0.5 [widths.center ess]
g4 (RightSB - SOBot) smooth [widths 0 stroke]
SerifedArcEnd_RtlRhs SB Middle 0 stroke Hook
define [RevSStroke] : begin define [RevSStroke] : begin
local stroke : AdviceStroke2 2 3 CAP local stroke : AdviceStroke2 2 3 CAP
@ -61,32 +69,34 @@ glyph-block Letter-Latin-S : begin
hookend O (sw -- stroke) (swItalicAdj -- Stroke) hookend O (sw -- stroke) (swItalicAdj -- Stroke)
g4 (RightSB - SOBot) Hook g4 (RightSB - SOBot) Hook
define [SmallSStroke] : begin define [SmallSStrokeImpl st sb] : begin
define stroke : AdviceStroke2 2 3 XH define stroke : AdviceStroke2 2 3 XH
define ess : AdviceStroke2 2.2 3.2 XH define ess : AdviceStroke2 2.2 3.2 XH
define strokeCoeff : StrokeWidthBlend 0 1 stroke define strokeCoeff : StrokeWidthBlend 0 1 stroke
define smooth : adviceSSmooth XH (-1) stroke define smooth : adviceSSmooth XH (-1) stroke
return : dispiro return : dispiro
widths.lhs stroke if st
list
SerifedArcStart_RtlLhs RightSB Middle XH stroke SHook
list
g4 (RightSB + OX) (XH - SHook) g4 (RightSB + OX) (XH - SHook)
hookstart (XH - O) (sw -- stroke) (swItalicAdj -- Stroke) hookstart (XH - O) (sw -- stroke) (swItalicAdj -- Stroke)
g4 (SB - OX) (XH - smooth) g4 (SB - OX) (XH - smooth)
SNeck (stroke -- ess) (slantCoeff -- -0.02) (dist -- [SmallSDistCoeff]) (tensionCoeff -- [SmallSTensionCoeff stroke]) SNeck (stroke -- ess) (slantCoeff -- -0.02) (dist -- [SmallSDistCoeff]) (tensionCoeff -- [SmallSTensionCoeff stroke])
g4 (RightSB + OX - SOBot) (smooth) [widths 0 stroke] g4 (RightSB + OX - SOBot) (smooth) [widths 0 stroke]
if sb
list
SerifedArcEnd_RtlRhs SB Middle 0 stroke SHook
list
hookend O (sw -- stroke) (swItalicAdj -- Stroke) hookend O (sw -- stroke) (swItalicAdj -- Stroke)
g4 (SB - OX + SOBot) SHook g4 (SB - OX + SOBot) SHook
define [SlabSmallSStroke] : begin define [SmallSStroke] : SmallSStrokeImpl false false
define stroke : AdviceStroke2 2 3 XH define [HalfSlabSmallSStroke] : SmallSStrokeImpl true false
define ess : AdviceStroke2 2.2 3.2 XH define [SlabSmallSStroke] : SmallSStrokeImpl true true
define strokeCoeff : StrokeWidthBlend 0 1 stroke
define smooth : adviceSSmooth XH (-1) stroke
return : dispiro
SerifedArcStart_RtlLhs RightSB Middle XH stroke SHook
g4 (SB - OX) (XH - smooth)
SNeck (stroke -- ess) (slantCoeff -- -0.02) (dist -- [SmallSDistCoeff]) (tensionCoeff -- [SmallSTensionCoeff stroke])
g4 (RightSB + OX - SOBot) (smooth) [widths 0 stroke]
SerifedArcEnd_RtlRhs SB Middle 0 stroke SHook
glyph-block-export SStrokeAlt glyph-block-export SStrokeAlt
define [SStrokeAlt] : params [top hook swStart swEnd oXLeftTop offsetLT offsetRB offsetC] : begin define [SStrokeAlt] : params [top hook swStart swEnd oXLeftTop offsetLT offsetRB offsetC] : begin
@ -219,13 +229,13 @@ glyph-block Letter-Latin-S : begin
create-glyph 'cyrl/ge.italic' : glyph-proc create-glyph 'cyrl/ge.italic' : glyph-proc
include : MarkSet.b include : MarkSet.b
local stroke : [RevSmallSStroke].call currentGlyph local stroke : include : RevSmallSStroke
local start : currentGlyph.gizmo.unapply stroke.lhsKnots.0 local start : currentGlyph.gizmo.unapply stroke.lhsKnots.0
include : VBarLeft start.x start.y (XH + Accent) include : VBarLeft start.x start.y (XH + Accent)
create-glyph 'cyrl/gheDescender.italic' : glyph-proc create-glyph 'cyrl/gheDescender.italic' : glyph-proc
include : MarkSet.b include : MarkSet.b
local stroke : [RevSmallSStroke].call currentGlyph local stroke : include : RevSmallSStroke
local start : currentGlyph.gizmo.unapply stroke.rhsKnots.(0) local start : currentGlyph.gizmo.unapply stroke.rhsKnots.(0)
include : VBarRight start.x (-Accent) start.y include : VBarRight start.x (-Accent) start.y
@ -233,7 +243,7 @@ glyph-block Letter-Latin-S : begin
include : MarkSet.p include : MarkSet.p
if SLAB : include : ArcStartSerif RightSB XH [AdviceStroke2 2 3 XH] Hook if SLAB : include : ArcStartSerif RightSB XH [AdviceStroke2 2 3 XH] Hook
local stroke : [[if SLAB SlabSmallSStroke SmallSStroke]].call currentGlyph local stroke : include : [if SLAB HalfSlabSmallSStroke SmallSStroke]
local start : currentGlyph.gizmo.unapply stroke.lhsKnots.(stroke.lhsKnots.length - 1) local start : currentGlyph.gizmo.unapply stroke.lhsKnots.(stroke.lhsKnots.length - 1)
include : new-glyph : glyph-proc include : new-glyph : glyph-proc
@ -247,7 +257,8 @@ glyph-block Letter-Latin-S : begin
create-glyph 'Sswash' 0x2C7E : glyph-proc create-glyph 'Sswash' 0x2C7E : glyph-proc
include : MarkSet.if include : MarkSet.if
local stroke : [SStroke].call currentGlyph if SLAB : include : ArcStartSerif RightSB CAP Stroke Hook
local stroke : include : [if SLAB HalfSlabSStroke SStroke]
local start : currentGlyph.gizmo.unapply stroke.lhsKnots.(stroke.lhsKnots.length - 1) local start : currentGlyph.gizmo.unapply stroke.lhsKnots.(stroke.lhsKnots.length - 1)
local sw : AdviceStroke2 2 3 CAP local sw : AdviceStroke2 2 3 CAP
@ -262,7 +273,7 @@ glyph-block Letter-Latin-S : begin
include : MarkSet.p include : MarkSet.p
if SLAB : include : ArcStartSerif RightSB XH [AdviceStroke2 2 3 XH] Hook if SLAB : include : ArcStartSerif RightSB XH [AdviceStroke2 2 3 XH] Hook
local stroke : [[if SLAB SlabSmallSStroke SmallSStroke]].call currentGlyph local stroke : include : [if SLAB HalfSlabSmallSStroke SmallSStroke]
local start : currentGlyph.gizmo.unapply stroke.lhsKnots.(stroke.lhsKnots.length - 1) local start : currentGlyph.gizmo.unapply stroke.lhsKnots.(stroke.lhsKnots.length - 1)
local sw : AdviceStroke2 2 3 XH local sw : AdviceStroke2 2 3 XH

View file

@ -485,7 +485,7 @@ glyph-block Digits-Five : begin
hookend (O + 1) hookend (O + 1)
g4 (SB + 1) (Hook * top / CAP) g4 (SB + 1) (Hook * top / CAP)
local fiveStroke : FiveStroke.call currentGlyph local fiveStroke : include FiveStroke
local firstKnot : currentGlyph.gizmo.unapply fiveStroke.rhsKnots.(fiveStroke.rhsKnots.length - 1) local firstKnot : currentGlyph.gizmo.unapply fiveStroke.rhsKnots.(fiveStroke.rhsKnots.length - 1)
include : VBarRight firstKnot.x firstKnot.y top sw include : VBarRight firstKnot.x firstKnot.y top sw
include : HBarTop (firstKnot.x + O) xright top sw include : HBarTop (firstKnot.x + O) xright top sw

View file

@ -6,7 +6,7 @@ export : define [SetupBuilders args] : begin
define [Boole operator] : begin define [Boole operator] : begin
define [BooleImplFn] : begin define [BooleImplFn] : begin
define k : {}.slice.call arguments 0 define k : {}.slice.call arguments 0
return : lambda [dontinc] : begin return : lambda [] : begin
local contourArcs : getArcsFromProc this k.0 local contourArcs : getArcsFromProc this k.0
if (k.length === 1) : set contourArcs : TypoGeom.Boolean.removeOverlap if (k.length === 1) : set contourArcs : TypoGeom.Boolean.removeOverlap
begin contourArcs begin contourArcs

View file

@ -178,7 +178,7 @@ export : define [SetupBuilders args] : begin
define CUBIC false define CUBIC false
return : SpiroJs.spiroToBezierOnContext knots closed ctx CUBIC CurveUtil.GEOMETRY_PRECISION return : SpiroJs.spiroToBezierOnContext knots closed ctx CUBIC CurveUtil.GEOMETRY_PRECISION
define [dispiro] : let [args : {}.slice.call arguments 0] : lambda [dontinc] : begin define [dispiro] : let [args : {}.slice.call arguments 0] : lambda [] : begin
define CLOSED true define CLOSED true
local s : new SpiroExpansionContext local s : new SpiroExpansionContext
set s.gizmo : this.gizmo || GlobalTransform set s.gizmo : this.gizmo || GlobalTransform
@ -209,7 +209,7 @@ export : define [SetupBuilders args] : begin
this.includeGeometry g 0 0 this.includeGeometry g 0 0
return g return g
define [spiro-outline] : let [k : {}.slice.call arguments 0] : lambda [dontinc] : begin define [spiro-outline] : let [k : {}.slice.call arguments 0] : lambda [] : begin
local g : new CurveUtil.BezToContoursSink (this.gizmo || GlobalTransform) local g : new CurveUtil.BezToContoursSink (this.gizmo || GlobalTransform)
local { .knots knots .closed closed } : prepareSpiroKnots k g local { .knots knots .closed closed } : prepareSpiroKnots k g
convertSpiroToBezier knots closed g convertSpiroToBezier knots closed g

View file

@ -47,11 +47,11 @@ define-macro params : syntax-rules
### Necessary macros ### Necessary macros
# A glyph construction is a function which "modifies" a glyph. # A glyph construction is a function which "modifies" a glyph.
define-macro glyph-proc : syntax-rules define-macro glyph-proc : syntax-rules
`[glyph-proc @::steps] {'.syntactic-closure' `[lambda [] [begin \\ `[glyph-proc @::steps] : dirty `[lambda [] [begin \\
local currentGlyph this local currentGlyph this
begin @::[steps.map formOf] begin @::[steps.map formOf]
return nothing return nothing
]] env} ]]
define-macro composite-proc : syntax-rules define-macro composite-proc : syntax-rules
`[composite-proc @::steps] : dirty `[lambda [] [begin \\ `[composite-proc @::steps] : dirty `[lambda [] [begin \\

View file

@ -61,15 +61,15 @@ module.exports = class Glyph {
} else if (component instanceof Function) { } else if (component instanceof Function) {
const t = this.defaultTag; const t = this.defaultTag;
if (component.tag) this.defaultTag = component.tag; if (component.tag) this.defaultTag = component.tag;
component.call(this, copyAnchors, copyWidth); let ret = component.call(this, copyAnchors, copyWidth);
this.defaultTag = t; this.defaultTag = t;
return; return ret;
} else if (component instanceof Transform) { } else if (component instanceof Transform) {
this.applyTransform(component, copyAnchors); return this.applyTransform(component, copyAnchors);
} else if (component.isMarkSet) { } else if (component.isMarkSet) {
this.copyAnchors(component); return this.copyAnchors(component);
} else if (component instanceof Glyph) { } else if (component instanceof Glyph) {
this.includeGlyph(component, copyAnchors, copyWidth); return this.includeGlyph(component, copyAnchors, copyWidth);
} else { } else {
throw new Error("Invalid component to be introduced."); throw new Error("Invalid component to be introduced.");
} }