Fix shapes of sswash and srtail
This commit is contained in:
parent
a33a1bf882
commit
894a6cea4b
7 changed files with 62 additions and 53 deletions
|
@ -28,8 +28,7 @@ glyph-block Letter-Latin-Lower-T : begin
|
|||
if (sink == spiro-outline) {[corner (hookx - offset) top]} {}
|
||||
|
||||
define [SmallTShape top bot] : glyph-proc
|
||||
local G : SmallTHookShapeT dispiro 0 top bot Stroke
|
||||
local g : G.call currentGlyph # Not using include
|
||||
local g : include : SmallTHookShapeT dispiro 0 top bot Stroke
|
||||
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 '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
|
||||
local G : DiagTailedSmallTHookShape df top 0 Stroke
|
||||
local g : G.call currentGlyph # Not using include
|
||||
local g : include : DiagTailedSmallTHookShape df top 0 Stroke
|
||||
set-base-anchor 'overlay' (g.knots.0.x + 0.125 * Stroke * HVContrast) (top * 0.42)
|
||||
|
||||
include : HCrossBar.top
|
||||
|
|
|
@ -23,29 +23,37 @@ glyph-block Letter-Latin-S : begin
|
|||
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]
|
||||
|
||||
glyph-block-export SStroke
|
||||
define [SStroke] : params [[stroke : AdviceStroke2 2 3 CAP] [refSwEss Ess]] : begin
|
||||
define [SStrokeImpl st sb stroke refSwEss] : begin
|
||||
local ess : refSwEss * stroke / Stroke
|
||||
define smooth : adviceSSmooth CAP (-1) stroke
|
||||
|
||||
return : dispiro
|
||||
widths.lhs stroke
|
||||
if st
|
||||
list
|
||||
SerifedArcStart_RtlLhs RightSB Middle CAP stroke Hook
|
||||
list
|
||||
g4 RightSB (CAP - Hook)
|
||||
hookstart (CAP - O) (sw -- stroke) (swItalicAdj -- Stroke)
|
||||
|
||||
g4 SB (CAP - smooth)
|
||||
alsoThru.g2 0.5 0.5 [widths.center ess]
|
||||
g4 (RightSB - SOBot) smooth [widths 0 stroke]
|
||||
|
||||
if sb
|
||||
list
|
||||
SerifedArcEnd_RtlRhs SB Middle 0 stroke Hook
|
||||
list
|
||||
hookend O (sw -- stroke) (swItalicAdj -- Stroke)
|
||||
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 ess : refSwEss * stroke / Stroke
|
||||
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
|
||||
return : SStrokeImpl true true stroke refSwEss
|
||||
|
||||
define [RevSStroke] : begin
|
||||
local stroke : AdviceStroke2 2 3 CAP
|
||||
|
@ -61,32 +69,34 @@ glyph-block Letter-Latin-S : begin
|
|||
hookend O (sw -- stroke) (swItalicAdj -- Stroke)
|
||||
g4 (RightSB - SOBot) Hook
|
||||
|
||||
define [SmallSStroke] : begin
|
||||
define [SmallSStrokeImpl st sb] : begin
|
||||
define stroke : AdviceStroke2 2 3 XH
|
||||
define ess : AdviceStroke2 2.2 3.2 XH
|
||||
define strokeCoeff : StrokeWidthBlend 0 1 stroke
|
||||
define smooth : adviceSSmooth XH (-1) stroke
|
||||
|
||||
return : dispiro
|
||||
widths.lhs stroke
|
||||
if st
|
||||
list
|
||||
SerifedArcStart_RtlLhs RightSB Middle XH stroke SHook
|
||||
list
|
||||
g4 (RightSB + OX) (XH - SHook)
|
||||
hookstart (XH - O) (sw -- stroke) (swItalicAdj -- Stroke)
|
||||
|
||||
g4 (SB - OX) (XH - smooth)
|
||||
SNeck (stroke -- ess) (slantCoeff -- -0.02) (dist -- [SmallSDistCoeff]) (tensionCoeff -- [SmallSTensionCoeff 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)
|
||||
g4 (SB - OX + SOBot) SHook
|
||||
|
||||
define [SlabSmallSStroke] : begin
|
||||
define stroke : AdviceStroke2 2 3 XH
|
||||
define ess : AdviceStroke2 2.2 3.2 XH
|
||||
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
|
||||
define [SmallSStroke] : SmallSStrokeImpl false false
|
||||
define [HalfSlabSmallSStroke] : SmallSStrokeImpl true false
|
||||
define [SlabSmallSStroke] : SmallSStrokeImpl true true
|
||||
|
||||
glyph-block-export SStrokeAlt
|
||||
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
|
||||
include : MarkSet.b
|
||||
local stroke : [RevSmallSStroke].call currentGlyph
|
||||
local stroke : include : RevSmallSStroke
|
||||
local start : currentGlyph.gizmo.unapply stroke.lhsKnots.0
|
||||
include : VBarLeft start.x start.y (XH + Accent)
|
||||
|
||||
create-glyph 'cyrl/gheDescender.italic' : glyph-proc
|
||||
include : MarkSet.b
|
||||
local stroke : [RevSmallSStroke].call currentGlyph
|
||||
local stroke : include : RevSmallSStroke
|
||||
local start : currentGlyph.gizmo.unapply stroke.rhsKnots.(0)
|
||||
include : VBarRight start.x (-Accent) start.y
|
||||
|
||||
|
@ -233,7 +243,7 @@ glyph-block Letter-Latin-S : begin
|
|||
include : MarkSet.p
|
||||
|
||||
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)
|
||||
|
||||
include : new-glyph : glyph-proc
|
||||
|
@ -247,7 +257,8 @@ glyph-block Letter-Latin-S : begin
|
|||
create-glyph 'Sswash' 0x2C7E : glyph-proc
|
||||
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 sw : AdviceStroke2 2 3 CAP
|
||||
|
@ -262,7 +273,7 @@ glyph-block Letter-Latin-S : begin
|
|||
include : MarkSet.p
|
||||
|
||||
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 sw : AdviceStroke2 2 3 XH
|
||||
|
|
|
@ -485,7 +485,7 @@ glyph-block Digits-Five : begin
|
|||
hookend (O + 1)
|
||||
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)
|
||||
include : VBarRight firstKnot.x firstKnot.y top sw
|
||||
include : HBarTop (firstKnot.x + O) xright top sw
|
||||
|
|
|
@ -6,7 +6,7 @@ export : define [SetupBuilders args] : begin
|
|||
define [Boole operator] : begin
|
||||
define [BooleImplFn] : begin
|
||||
define k : {}.slice.call arguments 0
|
||||
return : lambda [dontinc] : begin
|
||||
return : lambda [] : begin
|
||||
local contourArcs : getArcsFromProc this k.0
|
||||
if (k.length === 1) : set contourArcs : TypoGeom.Boolean.removeOverlap
|
||||
begin contourArcs
|
||||
|
|
|
@ -178,7 +178,7 @@ export : define [SetupBuilders args] : begin
|
|||
define CUBIC false
|
||||
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
|
||||
local s : new SpiroExpansionContext
|
||||
set s.gizmo : this.gizmo || GlobalTransform
|
||||
|
@ -209,7 +209,7 @@ export : define [SetupBuilders args] : begin
|
|||
this.includeGeometry g 0 0
|
||||
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 { .knots knots .closed closed } : prepareSpiroKnots k g
|
||||
convertSpiroToBezier knots closed g
|
||||
|
|
|
@ -47,11 +47,11 @@ define-macro params : syntax-rules
|
|||
### Necessary macros
|
||||
# A glyph construction is a function which "modifies" a glyph.
|
||||
define-macro glyph-proc : syntax-rules
|
||||
`[glyph-proc @::steps] {'.syntactic-closure' `[lambda [] [begin \\
|
||||
`[glyph-proc @::steps] : dirty `[lambda [] [begin \\
|
||||
local currentGlyph this
|
||||
begin @::[steps.map formOf]
|
||||
return nothing
|
||||
]] env}
|
||||
]]
|
||||
|
||||
define-macro composite-proc : syntax-rules
|
||||
`[composite-proc @::steps] : dirty `[lambda [] [begin \\
|
||||
|
|
|
@ -61,15 +61,15 @@ module.exports = class Glyph {
|
|||
} else if (component instanceof Function) {
|
||||
const t = this.defaultTag;
|
||||
if (component.tag) this.defaultTag = component.tag;
|
||||
component.call(this, copyAnchors, copyWidth);
|
||||
let ret = component.call(this, copyAnchors, copyWidth);
|
||||
this.defaultTag = t;
|
||||
return;
|
||||
return ret;
|
||||
} else if (component instanceof Transform) {
|
||||
this.applyTransform(component, copyAnchors);
|
||||
return this.applyTransform(component, copyAnchors);
|
||||
} else if (component.isMarkSet) {
|
||||
this.copyAnchors(component);
|
||||
return this.copyAnchors(component);
|
||||
} else if (component instanceof Glyph) {
|
||||
this.includeGlyph(component, copyAnchors, copyWidth);
|
||||
return this.includeGlyph(component, copyAnchors, copyWidth);
|
||||
} else {
|
||||
throw new Error("Invalid component to be introduced.");
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue