Balanced /at.

This commit is contained in:
be5invis 2015-08-11 10:59:50 +08:00
parent 6ecbfe6f15
commit f64a11c4e3
2 changed files with 17 additions and 15 deletions

View File

@ -61,10 +61,10 @@ create-glyph 'at' : glyph-construction {
local sw : adviceBlackness 3.5
local m1 : [mix [SB + sw] [RIGHTSB - sw] 0.47] - sw / 2
local m2 : mix m1 RIGHTSB 0.5
local m2 : [mix m1 RIGHTSB 0.52] + globalTransform.yx * sw
local sma : SMOOTHA * [[RIGHTSB - m1] / [RIGHTSB - SB]]
local smb : SMOOTHB * [[RIGHTSB - m1] / [RIGHTSB - SB]]
local sma : SMOOTHA * [[RIGHTSB - m1] / [RIGHTSB - SB] * 1.1]
local smb : SMOOTHB * [[RIGHTSB - m1] / [RIGHTSB - SB] * 1.1]
include : create-stroke
:.start-from RIGHTSB [otop - O]
@ -73,10 +73,11 @@ create-glyph 'at' : glyph-construction {
:.line-to m2 [otop - O]
:.arc-hv-to m1 [otop - sma]
:.line-to m1 [obot + smb]
:.arc-vh-to [m2 + STROKE * globalTransform.yx] [obot + O]
:.arc-vh-to m2 [obot + O]
:.arc-hv-to RIGHTSB [obot + sma]
:.line-to RIGHTSB [top - SMOOTHB]
:.arc-vh-to MIDDLE [top - O]
:.heads-to LEFTWARD
:.set-width STROKE 0
:.arc-hv-to SB [top - SMOOTHA]
:.set-width sw 0
@ -84,9 +85,8 @@ create-glyph 'at' : glyph-construction {
:.arc-vh-to MIDDLE [bot + O]
:.set-width STROKE 0
:.heads-to RIGHTWARD
:.line-to [RIGHTSB - HALFSTROKE] [bot + O]
:.heads-to RIGHTWARD
:.set-samples 4
:.line-to [RIGHTSB - HALFSTROKE + globalTransform.yx * sw] [bot + O]
:.set-samples 6
}
### Brackets

View File

@ -182,6 +182,9 @@ define [Stroke.prototype.to-outline d1 d2 _samples straight] : begin {
local right ()
for [local j 0] [j < subSegments.length] [inc j] : begin {
local curve subSegments`j
left.push [begin [local last [computeOffsetPoint curve j j f1 fpdx fpdy]] (.x last.x .y last.y .onCurve true)]
right.push [begin [local last [computeOffsetPoint curve j j f2 fpdx fpdy]] (.x last.x .y last.y .onCurve true)]
foreach sample [range 0 samples] : begin {
local t : j + sample / samples
local tn : j + [sample + 1] / samples
@ -210,24 +213,23 @@ define [Stroke.prototype.to-outline d1 d2 _samples straight] : begin {
local il : intersection lthis.x lthis.y dlthis.x dlthis.y lnext.x lnext.y dlnext.x dlnext.y
if [[not straight] && [nonlinear lthis lnext dlthis] && [nonlinear lthis lnext dlnext] && [il.x != null] && [il.y != null] && [nonlinear lthis il lnext] && [near lthis il lnext]] [then {
left.push (.x lthis.x .y lthis.y .onCurve true) (.x il.x .y il.y .onCurve false)
left.push (.x il.x .y il.y .onCurve false) (.x lnext.x .y lnext.y .onCurve true)
}] [else {
left.push (.x lthis.x .y lthis.y .onCurve true)
left.push (.x lnext.x .y lnext.y .onCurve true)
}]
local ir : intersection rthis.x rthis.y drthis.x drthis.y rnext.x rnext.y drnext.x drnext.y
if [[not straight] && [nonlinear rthis rnext drthis] && [nonlinear rthis rnext drnext] && [ir.x != null] && [ir.y != null] && [nonlinear rthis ir rnext] && [near rthis ir rnext]] [then {
right.push (.x rthis.x .y rthis.y .onCurve true) (.x ir.x .y ir.y .onCurve false)
right.push (.x ir.x .y ir.y .onCurve false) (.x rnext.x .y rnext.y .onCurve true)
}] [else {
right.push (.x rthis.x .y rthis.y .onCurve true)
right.push (.x rnext.x .y rnext.y .onCurve true)
}]
}
left.push [begin [local last [computeOffsetPoint curve [j + 1] j f1 fpdx fpdy]] (.x last.x .y last.y .onCurve true)]
right.push [begin [local last [computeOffsetPoint curve [j + 1] j f2 fpdx fpdy]] (.x last.x .y last.y .onCurve true)]
shapes.push : left.concat [right.reverse]
set left ()
set right ()
}
shapes.push : left.concat [right.reverse]
return : shapes.map : function [shape] : begin {
# Remove duplicate points
for [local j] [j < shape.length - 1] [inc j] : begin {