Cleanup out-dated stuff
This commit is contained in:
parent
fe17db4a5c
commit
dd9fa67c82
5 changed files with 59 additions and 47 deletions
|
@ -15,12 +15,10 @@ glyph-block CommonShapes : begin
|
||||||
local mx ((l + r) / 2)
|
local mx ((l + r) / 2)
|
||||||
currentGlyph.gizmo = [if transformShiftOnly [Translate 0 0] GlobalTransform]
|
currentGlyph.gizmo = [if transformShiftOnly [Translate 0 0] GlobalTransform]
|
||||||
include : spiro-outline
|
include : spiro-outline
|
||||||
begin [lambda : set this.gizmo currentGlyph.gizmo]
|
|
||||||
corner l d
|
corner l d
|
||||||
corner l u
|
corner l u
|
||||||
corner r u
|
corner r u
|
||||||
corner r d
|
corner r d
|
||||||
close [lambda : begin [set this.angles 4] [set this.fairGizmo currentGlyph.gizmo]]
|
|
||||||
if transformShiftOnly : begin
|
if transformShiftOnly : begin
|
||||||
local {.x mx1 .y my1} : GlobalTransform.apply {.x mx .y my}
|
local {.x mx1 .y my1} : GlobalTransform.apply {.x mx .y my}
|
||||||
include : Translate (mx1 - mx) (my1 - my)
|
include : Translate (mx1 - mx) (my1 - my)
|
||||||
|
@ -38,7 +36,6 @@ glyph-block CommonShapes : begin
|
||||||
local mx ((l + r) / 2)
|
local mx ((l + r) / 2)
|
||||||
currentGlyph.gizmo = [if transformShiftOnly [Translate 0 0] GlobalTransform]
|
currentGlyph.gizmo = [if transformShiftOnly [Translate 0 0] GlobalTransform]
|
||||||
include : spiro-outline
|
include : spiro-outline
|
||||||
begin [lambda : set this.gizmo currentGlyph.gizmo]
|
|
||||||
g4 mx d
|
g4 mx d
|
||||||
archv
|
archv
|
||||||
g4 l my
|
g4 l my
|
||||||
|
@ -47,7 +44,7 @@ glyph-block CommonShapes : begin
|
||||||
archv
|
archv
|
||||||
g4 r my
|
g4 r my
|
||||||
arcvh
|
arcvh
|
||||||
close [lambda : begin [set this.angles 4] [set this.fairGizmo currentGlyph.gizmo]]
|
close
|
||||||
if transformShiftOnly : begin
|
if transformShiftOnly : begin
|
||||||
local {.x mx1 .y my1} : GlobalTransform.apply {.x mx .y my}
|
local {.x mx1 .y my1} : GlobalTransform.apply {.x mx .y my}
|
||||||
include : Translate (mx1 - mx) (my1 - my)
|
include : Translate (mx1 - mx) (my1 - my)
|
||||||
|
@ -69,7 +66,7 @@ glyph-block CommonShapes : begin
|
||||||
archv
|
archv
|
||||||
g4 r my
|
g4 r my
|
||||||
arcvh
|
arcvh
|
||||||
close [lambda : begin [set this.angles 4] [set this.fairGizmo currentGlyph.gizmo]]
|
close
|
||||||
if transformShiftOnly : begin
|
if transformShiftOnly : begin
|
||||||
local {.x mx1 .y my1} : GlobalTransform.apply {.x mx .y my}
|
local {.x mx1 .y my1} : GlobalTransform.apply {.x mx .y my}
|
||||||
include : Translate (mx1 - mx) (my1 - my)
|
include : Translate (mx1 - mx) (my1 - my)
|
||||||
|
@ -86,7 +83,7 @@ glyph-block CommonShapes : begin
|
||||||
g4 l my
|
g4 l my
|
||||||
g4 mx u
|
g4 mx u
|
||||||
g4 r my
|
g4 r my
|
||||||
close [lambda : begin [set this.angles 4] [set this.fairGizmo currentGlyph.gizmo]]
|
close
|
||||||
if transformShiftOnly : begin
|
if transformShiftOnly : begin
|
||||||
local {.x mx1 .y my1} : GlobalTransform.apply {.x mx .y my}
|
local {.x mx1 .y my1} : GlobalTransform.apply {.x mx .y my}
|
||||||
include : Translate (mx1 - mx) (my1 - my)
|
include : Translate (mx1 - mx) (my1 - my)
|
||||||
|
|
|
@ -32,7 +32,6 @@ glyph-block Letter-Greek-Lower-Omega : begin
|
||||||
archv 8
|
archv 8
|
||||||
flat (df.middle + (mfine - fine / 2) * HVContrast) y3 [widths.heading mfine 0 Upward]
|
flat (df.middle + (mfine - fine / 2) * HVContrast) y3 [widths.heading mfine 0 Upward]
|
||||||
curl (df.middle + (mfine - fine / 2) * HVContrast) y4 [heading Upward]
|
curl (df.middle + (mfine - fine / 2) * HVContrast) y4 [heading Upward]
|
||||||
end [function : set this.angles 4]
|
|
||||||
include : dispiro
|
include : dispiro
|
||||||
widths.rhs fine
|
widths.rhs fine
|
||||||
g4 (df.width - x0) y0
|
g4 (df.width - x0) y0
|
||||||
|
@ -42,7 +41,6 @@ glyph-block Letter-Greek-Lower-Omega : begin
|
||||||
archv 8
|
archv 8
|
||||||
flat (df.middle - (mfine - fine / 2) * HVContrast) y3 [widths.heading 0 mfine Upward]
|
flat (df.middle - (mfine - fine / 2) * HVContrast) y3 [widths.heading 0 mfine Upward]
|
||||||
curl (df.middle - (mfine - fine / 2) * HVContrast) y4 [heading Upward]
|
curl (df.middle - (mfine - fine / 2) * HVContrast) y4 [heading Upward]
|
||||||
end [function : set this.angles 4]
|
|
||||||
|
|
||||||
create-glyph 'grek/pomega' 0x3D6 : glyph-proc
|
create-glyph 'grek/pomega' 0x3D6 : glyph-proc
|
||||||
local df : DivFrame para.diversityM 3
|
local df : DivFrame para.diversityM 3
|
||||||
|
@ -80,4 +78,3 @@ glyph-block Letter-Greek-Lower-Omega : begin
|
||||||
archv 8
|
archv 8
|
||||||
flat (df.middle - (mfine - fine / 2) * HVContrast) y3 [widths.heading 0 mfine Upward]
|
flat (df.middle - (mfine - fine / 2) * HVContrast) y3 [widths.heading 0 mfine Upward]
|
||||||
curl (df.middle - (mfine - fine / 2) * HVContrast) y4 [heading Upward]
|
curl (df.middle - (mfine - fine / 2) * HVContrast) y4 [heading Upward]
|
||||||
end [function : set this.angles 4]
|
|
|
@ -44,7 +44,6 @@ glyph-block Letter-Latin-Upper-Y : begin
|
||||||
g4 (RightSB - HookX / 3) (CAP - Hook)
|
g4 (RightSB - HookX / 3) (CAP - Hook)
|
||||||
quadcontrols 0.55 0.7 32 unimportant
|
quadcontrols 0.55 0.7 32 unimportant
|
||||||
g4 (Middle + Stroke / 2 * HVContrast) cross
|
g4 (Middle + Stroke / 2 * HVContrast) cross
|
||||||
end [function : set this.loose true]
|
|
||||||
|
|
||||||
create-glyph : glyph-proc
|
create-glyph : glyph-proc
|
||||||
include : MarkSet.capital
|
include : MarkSet.capital
|
||||||
|
|
|
@ -19,16 +19,27 @@ export : define [SetupBuilders args] : begin
|
||||||
|
|
||||||
#directional bi-knots
|
#directional bi-knots
|
||||||
let
|
let
|
||||||
directions {{.name 'up' .x 0 .y 1}, {.name 'down' .x 0 .y (-1)}, {.name 'left' .x (-1) .y 0}, {.name 'right' .x 1 .y 0}}
|
directions : list
|
||||||
adhensions {{.name 'start' .l 0 .r 0.01}, {.name 'mid', .l (-0.005) .r 0.005}, {.name 'end', .l (-0.01) .r 0}}
|
* {.name 'up' .x 0 .y 1}
|
||||||
knottypes {g4, g2, corner, straight}
|
* {.name 'down' .x 0 .y (-1)}
|
||||||
foreach [direction : items-of directions] : let [d direction] : begin
|
* {.name 'left' .x (-1) .y 0}
|
||||||
foreach [knottype : items-of knottypes] : let [kt knottype] : begin
|
* {.name 'right' .x 1 .y 0}
|
||||||
set kt.(d.name) {.}
|
adhensions : list
|
||||||
|
* {.name 'start' .l 0 .r 0.01}
|
||||||
|
* {.name 'mid' .l (-0.005) .r 0.005}
|
||||||
|
* {.name 'end' .l (-0.01) .r 0}
|
||||||
|
knotTypes : list
|
||||||
|
* {g4 g4 g4}
|
||||||
|
* {g2 g2 g2}
|
||||||
|
* {corner corner corner}
|
||||||
|
* {straight flat curl}
|
||||||
|
foreach [_kt : items-of knotTypes] : let [{ sink kl kr } _kt] : begin
|
||||||
|
foreach [_d : items-of directions] : let [d _d] : begin
|
||||||
|
set sink.(d.name) {.}
|
||||||
foreach [adh : items-of adhensions] : let [a adh] : begin
|
foreach [adh : items-of adhensions] : let [a adh] : begin
|
||||||
set kt.(d.name).(a.name) : lambda [x y f] : list
|
set sink.(d.name).(a.name) : lambda [x y af] : list
|
||||||
[fallback kt.l kt] (x + d.x * a.l) (y + d.y * a.l) f
|
kl (x + d.x * a.l) (y + d.y * a.l) af
|
||||||
[fallback kt.r kt] (x + d.x * a.r) (y + d.y * a.r) f
|
kr (x + d.x * a.r) (y + d.y * a.r) af
|
||||||
|
|
||||||
# Aux functions
|
# Aux functions
|
||||||
define [widths l r] : lambda [] : if this.setWidth : this.setWidth l r
|
define [widths l r] : lambda [] : if this.setWidth : this.setWidth l r
|
||||||
|
@ -37,7 +48,6 @@ export : define [SetupBuilders args] : begin
|
||||||
define [widths.center w] : widths ([fallback w Stroke] / 2) ([fallback w Stroke] / 2)
|
define [widths.center w] : widths ([fallback w Stroke] / 2) ([fallback w Stroke] / 2)
|
||||||
|
|
||||||
# Gizmo handler
|
# Gizmo handler
|
||||||
define [disable-gizmo] : lambda [] : set this.gizmo [Transform.Id]
|
|
||||||
define [disable-contrast] : lambda [] : set this.contrast 1
|
define [disable-contrast] : lambda [] : set this.contrast 1
|
||||||
|
|
||||||
define [heading d] : lambda [] : if (this.headsTo) : this.headsTo d
|
define [heading d] : lambda [] : if (this.headsTo) : this.headsTo d
|
||||||
|
@ -129,29 +139,40 @@ export : define [SetupBuilders args] : begin
|
||||||
foreach knot [items-of a] : ks.push [knot.af.call this before after knot]
|
foreach knot [items-of a] : ks.push [knot.af.call this before after knot]
|
||||||
return ks
|
return ks
|
||||||
]}
|
]}
|
||||||
define [flatten knots] : begin
|
|
||||||
local a {}
|
|
||||||
|
define [flattenImpl sink knots] : begin
|
||||||
foreach p [items-of knots] : piecewise
|
foreach p [items-of knots] : piecewise
|
||||||
(p <@ Array) : set a : a.concat [flatten p]
|
(p <@ Array) : flattenImpl sink p
|
||||||
true : a.push p
|
true : sink.push p
|
||||||
return a
|
define [nCyclic p n] : (p + n + n) % n
|
||||||
define [prepareSpiroKnots _knots s] : begin
|
define [flatten s knots0] : begin
|
||||||
local closed false
|
local knots : list
|
||||||
local lastafs {}
|
flattenImpl knots knots0
|
||||||
local knots _knots
|
|
||||||
while (knots.0 && knots.0 <@ Function) : begin
|
# Unwrap interpolation knots
|
||||||
knots.0.call s
|
local unwrapped false
|
||||||
set knots : knots.slice 1
|
|
||||||
while (knots.(knots.length - 1) && (knots.(knots.length - 1).type === 'close' || knots.(knots.length - 1).type === 'end')) : begin
|
|
||||||
set closed : knots.(knots.length - 1).type === 'close'
|
|
||||||
lastafs.push knots.(knots.length - 1).af
|
|
||||||
set knots : knots.slice 0 (-1)
|
|
||||||
set knots : flatten knots
|
|
||||||
if closed : knots.push knots.0
|
|
||||||
foreach j [range 0 knots.length] : if (knots.(j) && knots.(j).type === 'interpolate') : begin
|
foreach j [range 0 knots.length] : if (knots.(j) && knots.(j).type === 'interpolate') : begin
|
||||||
set knots.(j) : knots.(j).af.call s knots.(j - 1) knots.(j + 1) knots.(j)
|
local kBefore knots.[nCyclic (j - 1) knots.length]
|
||||||
if closed : knots.pop
|
local kAfter knots.[nCyclic (j + 1) knots.length]
|
||||||
return {.knots [flatten knots] .closed closed .lastafs lastafs}
|
set knots.(j) : knots.(j).af.call s kBefore kAfter knots.(j)
|
||||||
|
set unwrapped true
|
||||||
|
|
||||||
|
if unwrapped : return : flatten s knots
|
||||||
|
return knots
|
||||||
|
|
||||||
|
define [dropTailKnot knots] : begin
|
||||||
|
define last knots.(knots.length - 1)
|
||||||
|
if (last && (last.type === 'close' || last.type === 'end')) : begin
|
||||||
|
set knots.length : knots.length - 1
|
||||||
|
return : last.type === 'close'
|
||||||
|
|
||||||
|
define [prepareSpiroKnots _knots s] : begin
|
||||||
|
local knots _knots
|
||||||
|
while (knots.0 && knots.0 <@ Function) : begin [knots.0.call s] [knots.splice 0 1]
|
||||||
|
define closed : dropTailKnot knots
|
||||||
|
set knots : flatten s knots
|
||||||
|
return { .knots knots .closed closed }
|
||||||
|
|
||||||
define [convertSpiroToBezier knots closed ctx] : begin
|
define [convertSpiroToBezier knots closed ctx] : begin
|
||||||
define CUBIC false
|
define CUBIC false
|
||||||
|
@ -161,13 +182,12 @@ export : define [SetupBuilders args] : 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
|
||||||
local {.knots knots .closed closed .lastafs lastafs} : prepareSpiroKnots [{}.slice.call args 0] s
|
local { .knots knots .closed closed } : prepareSpiroKnots [{}.slice.call args 0] s
|
||||||
foreach knot [items-of knots] : let [ty knot.type] [af knot.af] : begin
|
foreach knot [items-of knots] : let [ty knot.type] [af knot.af] : begin
|
||||||
set knot.af : lambda [] : begin
|
set knot.af : lambda [] : begin
|
||||||
this.setType ty
|
this.setType ty
|
||||||
if af : af.apply this args
|
if af : af.apply this args
|
||||||
SpiroJs.spiroToArcsOnContext knots closed s
|
SpiroJs.spiroToArcsOnContext knots closed s
|
||||||
foreach af [items-of lastafs] : if af : af.call s
|
|
||||||
|
|
||||||
local {.lhs lhs .rhs rhs} : s.expand [fallback s.contrast Contrast]
|
local {.lhs lhs .rhs rhs} : s.expand [fallback s.contrast Contrast]
|
||||||
if closed : then
|
if closed : then
|
||||||
|
@ -191,14 +211,13 @@ export : define [SetupBuilders args] : begin
|
||||||
|
|
||||||
define [spiro-outline] : let [k : {}.slice.call arguments 0] : lambda [dontinc] : begin
|
define [spiro-outline] : let [k : {}.slice.call arguments 0] : lambda [dontinc] : begin
|
||||||
local g : new CurveUtil.BezToContoursSink (this.gizmo || GlobalTransform)
|
local g : new CurveUtil.BezToContoursSink (this.gizmo || GlobalTransform)
|
||||||
local {.knots knots .closed closed .lastafs lastafs} : prepareSpiroKnots k g
|
local { .knots knots .closed closed } : prepareSpiroKnots k g
|
||||||
convertSpiroToBezier knots closed g
|
convertSpiroToBezier knots closed g
|
||||||
foreach af [items-of lastafs] : if af : af.call g
|
|
||||||
this.includeGeometry g 0 0
|
this.includeGeometry g 0 0
|
||||||
return g
|
return g
|
||||||
|
|
||||||
return [object
|
return [object
|
||||||
g4 g2 corner flat curl close end straight
|
g4 g2 corner flat curl close end straight
|
||||||
widths disable-gizmo disable-contrast heading unimportant important
|
widths disable-contrast heading unimportant important
|
||||||
alsoThru alsoThruThem bezcontrols quadcontrols archv arcvh complexThru
|
alsoThru alsoThruThem bezcontrols quadcontrols archv arcvh complexThru
|
||||||
dispiro spiro-outline]
|
dispiro spiro-outline]
|
|
@ -217,7 +217,7 @@ define-macro glyph-block : syntax-rules
|
||||||
AdviceStroke2 MVertStroke OverlayStroke OperatorStroke GeometryStroke ShoulderFine
|
AdviceStroke2 MVertStroke OverlayStroke OperatorStroke GeometryStroke ShoulderFine
|
||||||
_SuperXY adviceSSmooth adviceGlottalStopSmooth shoulderMidSlope StrokeWidthBlend
|
_SuperXY adviceSSmooth adviceGlottalStopSmooth shoulderMidSlope StrokeWidthBlend
|
||||||
SmoothAOf SmoothBOf SmoothAdjust MidJutSide MidJutCenter compositeBaseAnchors YSmoothMidR YSmoothMidL]
|
SmoothAOf SmoothBOf SmoothAdjust MidJutSide MidJutCenter compositeBaseAnchors YSmoothMidR YSmoothMidL]
|
||||||
define spiroFnImports `[g4 g2 corner flat curl close end straight widths disable-gizmo
|
define spiroFnImports `[g4 g2 corner flat curl close end straight widths
|
||||||
disable-contrast heading unimportant important alsoThru alsoThruThem bezcontrols
|
disable-contrast heading unimportant important alsoThru alsoThruThem bezcontrols
|
||||||
quadcontrols archv arcvh complexThru dispiro spiro-outline]
|
quadcontrols archv arcvh complexThru dispiro spiro-outline]
|
||||||
define booleFnImports `[union intersection difference]
|
define booleFnImports `[union intersection difference]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue