xmlgraphics-fop-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sergiu Dumitriu <sergiu.dumit...@gmail.com>
Subject Re: SVG pixel size
Date Tue, 09 Jul 2013 16:51:15 GMT
On 07/09/2013 12:26 PM, Vincent Hennebert wrote:
> Hi Massimo,
> 
> the easiest is to have the source resolution match the target
> resolution. That way, one pixel in your source will become 1 pixel in
> the output.
> 
> That said, if you want a real one-pixel line and not something
> anti-aliased you have to ensure that the coordinates will match output
> pixels. Start by setting the font-size on the outer block to 0, in order
> to avoid that the baseline ends up somewhere in between two pixels.
> Then, for some reason, you have to set the y pixels to half values. For
> example, 1.5px. I haven’t investigated why.

Because the stroked line width is split evenly around the imaginary line
defined by the coordinates. If it goes through 1.5, then 0.5px will be
above and 0.5px will be below it, which means that it actually fills in
a solid stripe between 1.0 and 2.0, which is exactly a pixel without any
antialiassing.

If it were to pass through 2.0, then it would end up as a solid stripe
between 1.5 and 2.5, which means that half of the first pixel and half
of the second pixel must be stroked, and since half pixels can't be
drawn, antialiassing is used.

I usually shift the viewbox by 0.5px to get rid of this problem and use
integer coordinates in the rest of the SVG.
-- 
Sergiu Dumitriu
http://purl.org/net/sergiu

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Mime
View raw message