Fixed may-incorrect stroke position correction in xsStrand
This commit is contained in:
parent
d3597a08e2
commit
12e010ab29
|
@ -65,11 +65,11 @@ define [buildFont para recursive] : begin {
|
|||
local parenMid [mix parenTop parenBot 0.5]
|
||||
|
||||
# Transform constructors
|
||||
define [Italify angle] : begin {
|
||||
define [Italify angle shift] : begin {
|
||||
local slope [Math.tan [[fallback angle para.italicangle] / 180 * Math.PI]]
|
||||
return (.xx 1 .yx slope .xy 0 .yy 1 .x [-slope * parenMid] .y 0)
|
||||
return (.xx 1 .yx slope .xy 0 .yy 1 .x [fallback shift : -slope * parenMid] .y 0)
|
||||
}
|
||||
define [Upright angle] [inverse : Italify angle]
|
||||
define [Upright angle shift] [inverse : Italify angle shift]
|
||||
define [Scale sx sy] (.xx sx .yx 0 .xy 0 .yy [fallback sy sx] .x 0 .y 0)
|
||||
define [Translate x y] (.xx 1 .yx 0 .xy 0 .yy 1 .x x .y y)
|
||||
define [Rotate angle] (.xx [Math.cos angle] .yx [-[Math.sin angle]] .xy [Math.sin angle] .yy [Math.cos angle] .x 0 .y 0)
|
||||
|
|
|
@ -92,8 +92,17 @@ define [xsStrand _xleft yleft _xright yright _halfstroke0 _halfstroke1 _ess _exp
|
|||
local halfstroke0 : _halfstroke0 || HALFSTROKE
|
||||
local halfstroke1 : _halfstroke1 || HALFSTROKE
|
||||
local ess : _ess || [halfstroke0 + halfstroke1] / 2
|
||||
local yItalicCorrection [globalTransform.yx * 0.985]
|
||||
local xItalicCorrection : 1 / [Math.sqrt [1 - yItalicCorrection * yItalicCorrection]]
|
||||
local upright : Upright
|
||||
# calculate italic correction
|
||||
local outline : [new Stroke
|
||||
:.set-transform globalTransform
|
||||
:.start-from _xleft yleft
|
||||
:.set-width [2 * halfstroke0] 0
|
||||
:.line-to _xleft [yleft - 1000]
|
||||
:.set-samples 1
|
||||
:.to-outline].0.map : [p] -> [tp upright p]
|
||||
local xItalicCorrection : -[outline.3.x - outline.0.x] / [2 * halfstroke0]
|
||||
local yItalicCorrection : [outline.3.y - outline.0.y] / [2 * halfstroke0]
|
||||
|
||||
local roundsize : [_roundp || SMOOTHA * 0.4] * [if [yleft < yright] [-1] 1]
|
||||
local roundleft [yleft - roundsize]
|
||||
|
|
Loading…
Reference in New Issue
Block a user