Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

High-resolution devices (that includes iPhone 4 and iPad 3, but also every single printer anyone's used in the last 5+ years) are exactly why the spec says what it says. The only other option was to not have a "px" unit in the spec at all.

I mean, think about it. Say you have a 600dpi printer. Take a typical web page that sets its body element to be 1000px wide, because the person writing it was using a 96dpi display. If "px" really meant "smallest controllable dot", that web page would print about 1.66 inches wide. Which is obviously undesirable. On the other hand, if "px" means "the length that looks about as long as one pixel on a 96dpi display" then the same web page would print about 8 inches wide, which is probably much closer to what both author and user wanted.

This is also exactly why Apple did the "pixel doubling" thing on iPhone 4 and iPad 3: it was done to prevent existing content that made certain assumptions about the visible size of "px" from breaking.



Confusion between px and dpi are common for people who haven't done work for both screen and print:

Screens are more accurately measured in PPI (pixels per inch) while the smallest elements a printer can produce (more akin to each of the 8 bit sub-pixels on a screen) are measured in DPI (dots per inch). Since ink is 1 bit more smaller elements (dots) are needed in some sort of dithered pattern to represent grays and colors.

Using halftone screening [1] the image elements are called lines and so a 600dpi printer is capable of producing 85–105 LPI (lines per inch)[2].

The lines per inch of print are more analogous to the pixels per inch of a screen than dots per inch are.

So, that 96ppi LCD and the 600dpi printer have around the same information density for practical purposes.

[1] http://en.wikipedia.org/wiki/Halftone [2] http://en.wikipedia.org/wiki/Halftone#Resolution_of_halftone...


Interesting. Do printers use halftone screens for pure black-and-white content as well?


If it's pure crisp black like text, then no.

Sometimes pure black is printed incorrectly and looks "fuzzy" with dots around the edges - in that case it is rendered with a halftone screen.


A pixel is the smallest controllable dot on a screen. The spec shouldn't have changed the definition of this, but introduced a new unit instead. Personally, I'd have both!


Everyone was already using the existing "px" unit because UAs had shipped it. Would you have preferred that every single web page broke on high-res devices (so that no manufacturer would ever introduce any high-res devices to the market) to the status quo?

What would you have used the "device pixel" unit for, exactly?




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: