W3C home > Mailing lists > Public > www-style@w3.org > February 2004

Re: [css3-values] unit equivalence

From: Mikko Rantalainen <mira@cc.jyu.fi>
Date: Sun, 15 Feb 2004 07:34:22 -0500 (EST)
Message-ID: <402F6766.8060405@cc.jyu.fi>
To: ernestcline@mindspring.com
Cc: David Woolley <david@djwhome.demon.co.uk>, www-style@w3.org



Ernest Cline / 2004-02-15 02:56:
>>[Original Message]
>>From: David Woolley <david@djwhome.demon.co.uk>
>>
>>>unit difference, a difference which is at most one pixel, and may be
>>>less.
>>
>>As Mikko has pointed out, the worst case is 1 pixel for each element, 
>>not one pixel cumulative.
> 
> Yes, 1 pixel per element.  I wasn't saying otherwise.  However,
> that problem is not solved by  mandating unit equivalence.
> All unit equivalence does is define a specific method of generating
> the round offs that lead to this problem, but unless CSS is going
> to specify a specific internal unit that all UAs must use, it can't
> guarantee that two different UAs will be pixel equivalent.  Requiring
> such an internal unit is not a good idea in my opinion.

I agree. The problem is, IMO, that we need some hinting system. 
Sometimes I just want 10 small elements of equal width and all that 
matters is that they look identical to each other. Some other time, 
it's important that the combined width of those elements is "the 
absolute" one (as in 10 * 1mm == 10mm). The intent is dependant on 
the location and meaning of the elements and no automatic system can 
guess it out correctly without some aid. How about adding a new 
property:

hinting: [none|per-element]

where 'none' means that no hinting is done and all positions and 
sizes should be computed with true decimal or floating point system 
and rounded to pixels only during the rendering (similar to what 
OpenGL does). On the other hand 'per-element' means that the size of 
the element should be rounded to full pixels before inserting that 
to flow. [Here 'pixel' means minimum point size for the output 
device. For example, a 600dpi printer has different 'pixel' than a 
screen.]

If we had such a property implemented, I could say

<a><x></x><x></x><x></x><x></x><x></x></a>
<b><x></x><x></x><x></x><x></x><x></x></b>

a,b,x { margin: 0; border: none; padding: 0; }
x { width: 1mm; }
a x { hinting: per-element; }
b x { hinting: none; }

and be quaranteed that width of 'b' is 5mm. Width of 'a' may or may 
be 5mm but every element 'x' inside 'a' will be identical in size.

Perhaps a limitation that minimum width and height is 1px? Or make 
that author adjustable, too?

Thoughts? I think this should be pretty easy to implement.

Should the 'per-element' hinted element also round the position or 
not? For example, an element that is sized 10mm*10mm is equivalent 
to 8.21px*8.21px should rounded to 8px*8px due to 'per-element' 
hinting. But if the right border of the previously positioned 
(flowed) element is at 15.24px from left border of the canvas, 
should the flow position be at (15.24+8) or (15+8) pixels from left 
border of the canvas after adding the 'pre-hinted' element? I think 
that always keeping true decimal location of the element is better 
choice but somehow I feel, that we can find counter examples for 
that one.

Should the "computed size" of the element reflect the fact whether 
or not rounding is done to full pixels?

-- 
Mikko
Received on Monday, 16 February 2004 10:07:49 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 27 April 2009 13:54:26 GMT