- From: Francois Remy <fremycompany_pub@yahoo.fr>
- Date: Thu, 24 Jul 2008 10:47:02 +0200
- To: "David Hyatt" <hyatt@apple.com>, "Tomas Carnecky" <tom@dbservice.com>
- Cc: <www-style@w3.org>
>> There is a difference in how Gecko and WebKit interpret length units >> (can't check IE, but I guess they have yet another interpretation). The >> CSS spec needs to clarify what the units exactly mean. I think a px is not always equals to 96px in IE. For large resolutions, a scaling coefficient is applied. The proportion between PX and IN are readable in screen.logicalYDPI (XDPI for hor.) The proportion if no scaling were applied between the two is screen.deviceYDPI (XDPI for hor.) If a webdeveloper wants to preserve the normal size for it's page, he can do something like : function adaptZoom() { document.documentElement.style.zoom = screen.devidceYPDI / screen.logicalYDPI } window.attachEvent('onresize', adaptZoom); adaptZoom(); If a developer want to always have 96px equals to 1in, he can do something like : function adaptZoom() { document.documentElement.style.zoom = 96 / screen.logicalYDPI } window.attachEvent('onresize', adaptZoom); adaptZoom(); But I'm not expert in this point. MSDN report the behavior here : http://msdn.microsoft.com/en-us/library/ms537625(VS.85).aspx >> >> Gecko tries to match absolute lengths (in/cm/mm etc) to the real >> physical length by using the display device DPI. When there is >> 'width:1cm' in a CSS, Gecko tries to make it physically appear as 1 >> centimeter, I can put a ruler to the screen and the element will indeed >> be 1cm wide. But when it comes to 'px' (CSS pixels), Gecko applies a >> logic to make the 1 CSS pixel correspond to an integer number of device >> pixels. So 1 CSS pixel maps to one physical pixel on <143 DPI screens, >> to 2x2 physical pixels on 144-240 DPI screen etc. The logic is described >> on their wiki: http://wiki.mozilla.org/Mozilla2:Units >> >> While I believe this is mostly what the spec intended (absolute units >> are indeed absolute, relative units relative), in some cases it will >> considerably differ. Let's say I'm sitting 28 inches from the screen. In >> that case 96px should be the length of one physical inch. It is indeed >> if I configure Gecko with DPI=N*96 (where N=1,2,3,...), but in all other >> cases 96px will be different from one inch. This is especially well >> visible in the case of DPI=143, when 1in is 50% larger then 96px (1in = >> 143 physical pixels, 96px = 96 physical pixels). >> >> WebKit on the other hand does not differ between CSS pixels and absolute >> units. Absolute units have a constant relation to CSS pixels. 1in is >> always exactly 96px, 1cm exactly 96/2.54px etc. This has the effect that >> 1in is only one physical inch long when DPI=96. Comments in the code >> indicate that this is intentional, WebKit doesn't see the 'absolute' >> lengths as absolute but relative to a CSS pixel [1] >> >> So what is the correct interpretation of CSS lengths? Is Gecko or WebKit >> right or maybe both wrong? > > The problem is with the pt unit. Web pages use the pt unit without > understanding that it is supposed to be an absolute unit. They intermix > it with pixel units and then the Web site's design breaks if you ever > change that ratio. > dave > (hyatt@apple.com) > >
Received on Thursday, 24 July 2008 08:47:42 UTC