The problem is that the "pixel" is a very wrong/misleading unit.

Initially (HTML3) there was no CSS, and no units, so there were just
unit-less length: <table border=4> would create a table with a 4 pixels
wide border [1]. Back then (early-mid 90s), almost all monitors were low
resolution, and it was so obvious what a pixel was that it wasn't even
defined.

CSS1 defined [2] the pixel not as a screen unit, but as a an angle:

"The suggested reference pixel is the visual angle of one pixel on a
device with a pixel density of 90dpi and a distance from the reader of
an arm's length. For a nominal arm's length of 28 inches, the visual
angle is about 0.0227 degrees."

That means that a pixel isn't a display pixel, or a dot, regardless of
the DPI. Would it make sense for a 2400DPI printer to print lines 1/2400
in? Would that even be visible? One pixel is always a dot at 90DPI,
according to CSS1.


CSS2 defines the pixel both as a fixed length [3] and as an angle [4]:

"1px is equal to 0.75pt", and "the points used by CSS are equal to
1/72nd of 1in." => 1px = 1/96in

"The reference pixel is the visual angle of one pixel on a device with a
pixel density of 96dpi and a distance from the reader of an arm's
length. For a nominal arm's length of 28 inches, the visual angle is
therefore about 0.0213 degrees. For reading at arm's length, 1px thus
corresponds to about 0.26 mm (1/96 inch)."

This is a change from the 1/90, since there are far more monitors at
96DPI than at 90DPI, so it makes no sense to define it that way.


CSS3 removes the pt from the pixel definition, and goes straight to [5]:

"1px is equal to 1/96th of 1in"

And it keeps the visual angle definition for the "reference pixel".

So, a pixel is a fixed length that doesn't scale down with the DPI, it
should always be 1/96 inches. At 204 DPI that would translate into 2.125
dots.

[1] http://www.w3.org/TR/REC-html32.html#table
[2] http://www.w3.org/TR/1999/REC-CSS1-19990111#length-units
[3] http://www.w3.org/TR/CSS21/syndata.html#x39
[4] http://www.w3.org/TR/CSS21/syndata.html#x40
[5] http://www.w3.org/TR/css3-values/#absolute-lengths

On 07/09/2013 09:33 AM, Luis Bernardo wrote:
> Lets look at the default case, that creates a 100x100 pixel image. The
> default target dpi is 72, so 100/72 = 1.388888.
> 
> If you set the target dpi to 204, then the image needs to be 283x283
> pixels because 204*1.38888 = 283.3333. Then a 1 pixel line needs to be
> 2.83 pixels to keep the scaling correct. Since you cannot have 2.83
> pixel thickness in the monitor, it defaults to 3 pixels.
> 
> Is your goal to print (to paper) a line of a certain thickness? Then you
> need to talk about dimensions (say, mm) not pixels.
> 
> 
> 
> On Tue, Jul 9, 2013 at 1:35 PM, Massimo <massimo.iasev...@snai.it
> <mailto:massimo.iasev...@snai.it>> wrote:
> 
>     Thanks for the answer.
> 
>     I try to better explain the problem with an attached java example.
> 
>     If you run the main method you should get two png image
>     . svgDefImage.png that contain a 1px thin line generated with
>     default target
>     resolution
>     . svg204Image.png that contain a 3px thin line generated with 204dpi
>     target
>     resolution
> 
>     According to the svg tag, both files should contain 1px thin lines.
> 
>     All images is generated with the same attached fo file.
> 
>     Notice that I use a custom Java2D renderer.
> 
>     I forgot to mention that I am using the fop trunk version.
> 
>     Thanks.
>     Massimo.
> 
>     SVGTest.java
>     <http://apache-fop.1065347.n5.nabble.com/file/n38858/SVGTest.java>
>     svgpixelsize.fo <http://svgpixelsize.fo>
>     <http://apache-fop.1065347.n5.nabble.com/file/n38858/svgpixelsize.fo>
>     svgDefImage.png
>     <http://apache-fop.1065347.n5.nabble.com/file/n38858/svgDefImage.png>
>     svg204Image.png
>     <http://apache-fop.1065347.n5.nabble.com/file/n38858/svg204Image.png>
> 


-- 
Sergiu Dumitriu
http://purl.org/net/sergiu

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

Reply via email to