Re: units other than pixels very unprecise? (how should 'top' width/height larger than screen be handled?)

test:
draw a 1x1 (inch) rect, getBBox it for pixel size, use resulting dpi(s) 
and screen.width/screen.height to calculate physical screen size.

problem:
measured and calculated screen size different (by more than a few mm).

testbed:
Vista, Opera+Firefox
screen that is obviously not the calculated 96 dpi (17.1" 1920x1200)


Gavin Kistner wrote:
> A test case is a great way to convey a problem precisely, as long as the 
> recipients can, and are motivated to, run your test. Can you summarize 
> the problem you are seeing and what you expected or hoped to see, for 
> those of us without ready access to test this? And, what platform(s) and 
> user agent(s) you see this problem on?
> 
> -- 
> (-, /\ \/ / /\/
> 
> On Apr 19, 2009, at 6:11 PM, Ruud Steltenpool <svg@steltenpower.com> wrote:
> 
>> According to this:
>>
>> <svg xmlns="http://www.w3.org/2000/svg" onclick="calculate()">
>> <script type="text/ecmascript"> <![CDATA[
>>    function calculate(evt) {
>>        bb=document.getElementById("rect").getBBox();
>>
>>        rwi=1;
>>        rwp=bb.width;
>>        swp=screen.width;
>>        swi=swp/rwp*rwi;
>>
>>        rhi=1;
>>        rhp=bb.height;
>>        shp=screen.height;
>>        shi=shp/rhp*rhi;
>>
>>        sdi=Math.sqrt(swi*swi+shi*shi);
>>
>>        blah="rect\n";
>>        blah+=rwi+"x"+rhi+"(inch,given)\n";
>>        blah+=rwp+"x"+rhp+"(pixels,queried)\n";
>>        blah+="\n";
>>
>>        blah+="screen\n";
>>        blah+=swp+"x"+shp+"(pixels,queried)\n";
>>        blah+=swi+"x"+shi+"(inch,calculated)\n";
>>        blah+="diagonal= "+sdi+" inch\n";
>>        blah+="(ERROR: in my case a strong exaggeration)";
>>        blah+="\n";
>>        blah+="\n";
>>
>>
>>        blah+="Without this ERROR i could of course calculate the 
>> viewBox i need in combination with width='100%' and height='100%' in 
>> order to scale any drawing to the prefered physical size\n";
>>        blah+="\n";
>>
>>        blah+="This ERROR of course also means it's very 
>> unprecise/unwise to use units (other than pixels) in general";
>>
>>        alert(blah);
>>    }
>>  ]]> </script>
>> <rect id="rect" width="1in" height="1in"/>
>> </svg>
>>
> 

Received on Tuesday, 21 April 2009 15:10:55 UTC