Refactored [smallo] with spiros.
This commit is contained in:
parent
1301b024d3
commit
7c33bbce2d
|
@ -222,16 +222,21 @@ define [buildFont para recursive] : begin {
|
|||
}
|
||||
return a
|
||||
}
|
||||
define [afInterpolate before after args] : G2 [mix before.x after.x args.rx] [mix before.y after.y args.ry] VIRTUAL
|
||||
define [G4 x y f] (.x x .y y .type 'g4' .af f)
|
||||
define [G2 x y f] (.x x .y y .type 'g2' .af f)
|
||||
define [LEFT x y f] (.x x .y y .type 'left' .af f)
|
||||
define [RIGHT x y f] (.x x .y y .type 'right' .af f)
|
||||
define [CLOSE f] (.type 'close' .af f)
|
||||
define [PREPARE f] (.type 'prepare' .af f)
|
||||
define [WIDTHS l r] : lambda [] : this.set-width l r
|
||||
define [VIRTUAL] : this.points.[this.points.length - 1].subdivided = true
|
||||
define [INTERPOLATE rx ry] (.type 'interpolate' .rx rx .ry ry .af afInterpolate)
|
||||
define [afInterpolate before after args] : g2 [mix before.x after.x args.rx] [mix before.y after.y args.ry] VIRTUAL
|
||||
|
||||
define [g4 x y f] (.x x .y y .type 'g4' .af f)
|
||||
define [g2 x y f] (.x x .y y .type 'g2' .af f)
|
||||
define [flat x y f] (.x x .y y .type 'left' .af f)
|
||||
define [curl x y f] (.x x .y y .type 'right' .af f)
|
||||
define [close f] (.type 'close' .af f)
|
||||
define [prepare f] (.type 'prepare' .af f)
|
||||
define [widths l r] : lambda [] : this.set-width l r
|
||||
|
||||
define [controls rx ry] (.type 'interpolate' .rx rx .ry ry .af afInterpolate)
|
||||
define [archv] : INTERPOLATE 0.5 0.103
|
||||
define [arcvh] : INTERPOLATE 0.5 0.897
|
||||
|
||||
define [spiro] : begin {
|
||||
local s : new Stroke
|
||||
s.set-transform globalTransform
|
||||
|
|
|
@ -222,41 +222,35 @@ define [smallo u d l r _width _sma _smb] : glyph-construction {
|
|||
if [u - d > sma + smb] {
|
||||
then : begin {
|
||||
include : spiro {
|
||||
PREPARE : WIDTHS width 0
|
||||
G4 [middle - mc] [u - O]
|
||||
INTERPOLATE 0.5 0.11
|
||||
LEFT [l + O] [u - sma]
|
||||
RIGHT [l + O] [d + smb]
|
||||
INTERPOLATE 0.5 0.89
|
||||
G4 [middle + mc] [d + O]
|
||||
INTERPOLATE 0.5 0.11
|
||||
LEFT [r - O] [d + sma]
|
||||
RIGHT [r - O] [u - smb]
|
||||
INTERPOLATE 0.5 0.89
|
||||
CLOSE
|
||||
prepare : widths width 0
|
||||
g4 [middle - mc] [u - O]
|
||||
archv
|
||||
flat [l + O] [u - sma]
|
||||
curl [l + O] [d + smb]
|
||||
arcvh
|
||||
g4 [middle + mc] [d + O]
|
||||
archv
|
||||
flat [r - O] [d + sma]
|
||||
curl [r - O] [u - smb]
|
||||
arcvh
|
||||
close
|
||||
}
|
||||
# include : create-stroke
|
||||
# :.set-transform globalTransform
|
||||
# :.start-from [middle - mc] [u - O]
|
||||
# :.set-width width 0
|
||||
# :.arc-hv-to [l + O] [u - sma]
|
||||
# :.line-to [l + O] [d + smb]
|
||||
# :.arc-vh-to [middle + mc] [d + O]
|
||||
# :.arc-hv-to [r - O] [d + sma]
|
||||
# :.line-to [r - O] [u - smb]
|
||||
# :.arc-vh-to [middle - mc] [u - O]
|
||||
}
|
||||
else : begin {
|
||||
local ymiddlea : mix d u [smb / [sma + smb]]
|
||||
local ymiddleb : mix d u [sma / [sma + smb]]
|
||||
include : create-stroke
|
||||
:.set-transform globalTransform
|
||||
:.start-from [middle - mc] [u - O]
|
||||
:.set-width width 0
|
||||
:.arc-hv-to [l + O] ymiddlea
|
||||
:.arc-vh-to [middle + mc] [d + O]
|
||||
:.arc-hv-to [r - O] ymiddleb
|
||||
:.arc-vh-to [middle - mc] [u - O]
|
||||
include : spiro {
|
||||
prepare : widths width 0
|
||||
g4 [middle - mc] [u - O]
|
||||
archv
|
||||
g4 [l + O] ymiddlea
|
||||
arcvh
|
||||
g4 [middle + mc] [d + O]
|
||||
archv
|
||||
g4 [r - O] ymiddleb
|
||||
arcvh
|
||||
close
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user