W3C home > Mailing lists > Public > www-style@w3.org > January 2010

Re: Making pt a non-physical unit

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Fri, 15 Jan 2010 22:33:14 -0800
Message-ID: <dd0fbad1001152233y63cb5571r7d0e04b607309afa@mail.gmail.com>
To: Brad Kemper <brad.kemper@gmail.com>
Cc: "robert@ocallahan.org" <robert@ocallahan.org>, www-style <www-style@w3.org>
On Fri, Jan 15, 2010 at 9:29 AM, Brad Kemper <brad.kemper@gmail.com> wrote:
> On Jan 14, 2010, at 4:26 PM, "Tab Atkins Jr." <jackalmage@gmail.com> wrote:
>> On Thu, Jan 14, 2010 at 12:38 PM, Brad Kemper <brad.kemper@gmail.com> wrote:
>>> As an evil idiot author, I feel much of the value of high resolution
>>> monitors would be wasted if I cannot e.g. draw a border that is one device
>>> pixel in width while still maintaining the proportion between that 1px
>>> measure and other measures.
>>
>> If you know that your output device is high-enough resolution to have
>> something like mapping 1 CSS px to 2x2 device pixels, you can always
>> draw a border with .5px width.
>
> Gah. And if I really want 2 device pixels I have to use 1px. Making it incompatible with existing Web pages where the author actually really wanted the one device pixel he thought he was specifying.

The author doesn't really want one device pixel, though.  ^_^  You may
want a line of particular thickness, but the number of pixels that
make it up is an implementation detail.  Unfortunately, at the moment
it's a very important detail, because we're in a transition period
where a CSS pixel is moving from mapping to 1 device pixel to 2.  Once
we make it past this point, future transitions will be less
significant.  (Moving from 2 to 3 is only a 50% change, from 3 to 4 is
only a 33% change, etc.  We don't care about the pixel mapping on
printers because the ratio is so high that differences are
unnoticeable.)

>> Alternately, if that use-case is
>> really determined to be important as we move into the future of higher
>> definition screens, the hairline unit people keep mentioning can be
>> employed (defined as "the minimum number of device pixels necessary to
>> draw a line that is visible to the human eye at standard viewing
>> distances").
>
> Would you call that "true-px"? For high rez printing, I think it would be useless (close to invisible).

That's what a hairline means.  It's just on the edge of visibility.
Right now a hairline is pretty fat, because to go any thinner is to
disappear entirely.

I wouldn't call it anything special, though.  It would be a 'unit',
though one that doesn't take any values along with it (no 2hairline,
or anything like that).  It defines a very particular length for a
particular purpose, and that's it.

> For screens, I suspect most (or at least a huge portion of) Web authors would expect 1px to be 1 device pixel. And with this, many may go into all their style sheets and HTML files, and wherever something is measured in pixels, they'd add the same measurement as true-px. And not be too happy about it. Because despite what we decree from  our ivory towers, they expect a pixel to be a pixel and not to be told that the pixel they authored wasn't REALLY the pixel they wanted, because we know best what they REALLY meant (I'm not saying I feel that way, but rather that I anticipate this sort of reaction). And because they really want their 1024px-wide layout to fit on a 1024 pixel-wide monitor, even if it has 140 dpi (138 is half way to (96 x 2), so anything in that range would be rounded to two device pixels per px, right?).

If you're on a 140dpi screen, and have a mere 1024px resolution,
you're looking at a pretty small screen.  You, the user, would
probably appreciate mapping a CSS pixel to multiple device pixels.
Though, at 140dpi the jury's still out.  I suspect we'll stay with a
1-1 mapping until a decent bit past the halfway point, just because of
inertia.

Do you think this is somehow maintainable?  What about when screens
are 300 dpi?  1000dpi?  Do you still expect 1 CSS px to be one device
pixel?  I expect that would render most current webpages unreadable.

We all know that transitioning from a 1-1 mapping to a 1-2 mapping
will be painful.  It's the largest transition of all; how could it not
be?  That doesn't mean it's not necessary, or the correct course of
action.

> I understand the reasoning of the current definition of px, and after thinking about it I think it may help to simply deal with those "2 device pixels = 1px" situations as **zoom**. Thus, "(1px:1 pixel ratio) = zoom:1" and "(1px : 2 pixel ratio) = zoom:2". Then when we provide that guidance about "0.0213 degrees" pixel sizes, we can say that whenever one device pixel would be bigger or smaller than 1px (after rounding to nearest integer), then a 'zoom' should be used to indicate this difference, and the user should have clear controls for changing the zoom level. Then, if the author really wants the one to one relationship for their page, they can set something like this:
>
> body { zoom:1; }
>
> That authored zoom level should then be reflected in any UA menu that showed the zoom level, and the user could override it if they want.

I don't think that's a solution that will stand the test of time.
That means that, on the future 1000dpi screens, 1in will translate to
roughly 10 inches of screen real-estate.

>>>> Also, I think we have use cases for true dimensions. We might as well
>>>> ensure that 1px is 1/96 of an inch when printed, so that CSS absolute length
>>>> units take their expected values when printing.
>>>
>>> Right. Just as a device pixel is unambiguous on a monitor, but an inch is
>>> not, the situation is reversed in print. If I print to a PDF file, I can
>>> tell it to make something exactly one inch, but 1px has to be approximated
>>> (because device pixels are not too useful of a measure in high resolution
>>> printing; they vary too much between output devices).
>>
>> Yeah, I agree, and I think most of the working group did too.
>> Printing in ordinary situations (on normal paper, frex) should follow
>> physical units exactly.
>
> Good. I mentioned it mostly to lead into the part about scaling.
>
>> Scaling should of course scale the physical
>> units,
>
> ..and the px units too, since for print they would be exactly equal to 1/96in, making them de facto physical units in print.
>
> But, ah, I guess you are already agreeing with that too, below.

Yeah, as far as I can tell, the least controversial solution so far is
to fix the ratio of px to inch (96px to the inch), with all the other
physical units, pt included, having their correct ratios.  Then the
output device decides which unit to map into the real world, and how
to do so.  Screens define the px, and thus the length of an inch
follows.  Printing defines the inch, and so the length of a px
follows.  Other media can decide to define whichever makes more sense
for them.

~TJ
Received on Saturday, 16 January 2010 06:34:06 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:23 GMT