[squeak-dev] #createSegmentsFromSVG: [was: Bezier filled shape rendering artifacts]

Igor Stasenko siguctua at gmail.com
Tue Mar 25 21:32:33 UTC 2008


On 25/03/2008, Klaus D. Witzel <klaus.witzel at cobss.com> wrote:
> On Tue, 25 Mar 2008 14:36:49 +0100, Gary Chambers wrote:
>
>  > Though I did find a bug (rarely encountered) in
>  > SVGPathMorph>>createSegmentsFromSVG.
>  >
>  > Replace
>  >
>  >       data do: [:cmd |
>  >               ((cmd = $S or: [cmd = $s]) and: ['CcSs' includes: c not])
>  >                       ifTrue: [lastCubicControl := position].
>  >               ((cmd = $T or: [cmd = $t]) and: ['QqTt' includes: c not])
>  >                       ifTrue: [lastQuadraticControl := position].
>  >
>  > with
>  >
>  >       data do: [:cmd |
>  >               ((cmd key = $S or: [cmd key = $s]) and: ['CcSs' includes: c not])
>  >                       ifTrue: [lastCubicControl := position].
>  >               ((cmd key = $T or: [cmd key = $t]) and: ['QqTt' includes: c not])
>  >                       ifTrue: [lastQuadraticControl := position].
>
>  Yes, seen that. But the glyph files that I tested never did the #ifTrue:
>  part in the patched (last week, by me) version, because, otherwise
>  aCharacter would have DNU'ed #not ;-)
>
>  Also[1], command $Z is not handeled in #createSegmentsFromSVG: and in
>  #pathDataFromSVG: ($z is, both methods can do what $z does when it's $Z
>  and when after the data do: it's not $Z). I had just converted $Z to $z in
>  #pathDataFromSVG: and let the rest as is.
>
>  Also[2], use of temp names lastCubicControl,lastQuadraticControl seems not
>  to be consistent in the $t branch (compared to the $T branch).
>
>  >
>  > Also, never did get to the bottom of why the page bounds sometimes come
>  > out
>  > wrong... (perhaps because taken from the SVG rather than computed
>  > "after-the-fact").
>  >
>  > Glad someone is still using the old SVGMorph "experiment"!
>
>  Yay, and it works :) still can't believe it :)
>
>  There are BTW "only" some 6,000 known glyphs of this sort; my Inkskape
>  instance will surely get burned when I do change the scaling of the 2,500
>  [many duplicates] .svg files that I have in my directory.
>

If problem was with scale, you can normalize scale before rendering.
Like:
 determine the bounding box of svg shape points, let the scale be the
length of shorter box side. Multiply all coordinates by 20/scale.

Then render morph with scale transform:

scale/20 *  [ (points) ]

>  /Klaus
>
>  > Regards, Gary.
>
>
>


-- 
Best regards,
Igor Stasenko AKA sig.



More information about the Squeak-dev mailing list