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

Re: [css3-values][css3-mediaqueries] resolution in dpi / dppx

From: Øyvind Stenhaug <oyvinds@opera.com>
Date: Mon, 28 Jan 2013 19:20:14 +0100
To: "Johannes Koch" <koch@w3development.de>, www-style@w3.org, François REMY <francois.remy.dev@outlook.com>
Cc: Fantasai <fantasai.lists@inkedblade.net>
Message-ID: <op.wrmvv0k4bunlto@oyvinds-desktop>
On Mon, 28 Jan 2013 17:08:44 +0100, François REMY  
<francois.remy.dev@outlook.com> wrote:

> Given that your DPI resolution is 312, I believe Opera is wrong because  
> rounding 312/96=3.25 to 2 is invalid. Then returned value in dppx could  
> have been anywhere between 3 and 4 (included) but should not lie outside  
> those limits. While rounding to 320dpi seems strange to me, it seems to  
> me it's valid anyway.

Note that the reference pixel depends on viewing distance. Although 1px  
would correspond to 1/96 of a physical inch on a rendering surface at  
arm's length (such as my computer screen), a handheld device (which we're  
presumably talking about here) would be held closer. So it may well be  
appropriate to use less than 312/96=3.25 device pixels per CSS px.

For instance, if we say the viewing distance is about half an arms length  
then the size of a reference pixel would be about 1/128 physical inches.  
Given 312 device pixels per physical inch, this gives 312/128 = 2.4375  
device pixels per reference pixel. When anchoring to the reference pixel  
"it is recommended that the pixel unit refer to the whole number of device  
pixels that best approximates the reference pixel" according to the spec,  
so this would be rounded to 2dppx.

According to the Media Queries spec, the dpi unit denotes "the density of  
device pixels" in "dots per CSS ‘inch’", and a CSS inch is always equal to  
96 CSS pixels, so it seems clear that if a CSS pixel corresponds to 2  
device pixels, media queries must evaluate (resolution: 192dpi) as true.

-- 
Øyvind Stenhaug
Opera Software ASA
Received on Monday, 28 January 2013 18:20:50 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:21:04 GMT