Didnt worked for me :/ peak and keon draw different physical font sizes.

Is there any reliable way to identify the device model (or b2g target build) 
from javascript? That will allow to load different css depending on device.. 
That will look like fragmentation, but looks like there's no clear way to solve 
this on all platforms.

On May 16, 2013, at 17:55, pancake <[email protected]> wrote:

> Thanks, I will try later at night.
> 
> What would you suggest to get dpi-independent <canvas>?
> 
> Scaling is not an option, but theorically, i can measure the size of a div 
> containing a text in "rem" units, and use this as base to determine the size 
> of the pixels.
> 
> function getdpi() {
>    var e = document.body.appendChild (
>        document.createElement ('div'));
>    e.style.width = '1rem';
>    e.style.padding = '0';
>    var v = e.offsetWidth;
>    e.parentNode.removeChild(e);
>    return v;
> }
> 
> I will have to time to do some tests tonight and see if that works..
> 
> Another option would be to use SVG to get proper scaling of the ruler,
> and that will probably render faster than using a canvas.
> 
> On 05/16/13 14:42, Adán Sánchez de Pedro Crespo wrote:
>> I achieve uniform size on PC, Keon and Peak by using these media queries
>> in my CSS:
>> 
>> @media screen and (orientation:portrait) {
>> 
>>     html{
>> 
>>         font-size: 5vw;
>> 
>>     }
>> 
>> }
>> 
>> @media screen and (orientation:landscape) {
>> 
>>     html{
>> 
>>         font-size: 5vh;
>> 
>>     }
>> 
>> }
>> 
>> @media only screen and (min-resolution: 90dpi) and (min-width: 540px){
>> 
>>     html{
>> 
>>         font-size: 150%;
>> 
>>     }
>> 
>> }
>> 
>> 
>> Then you only have to change the units for everything to 'rem', which is
>> relative to html tag's font size.
>> 
>> 
>> 
>> _______________________________________________
>> dev-b2g mailing list
>> [email protected]
>> https://lists.mozilla.org/listinfo/dev-b2g
> 
> _______________________________________________
> dev-b2g mailing list
> [email protected]
> https://lists.mozilla.org/listinfo/dev-b2g
> 
_______________________________________________
dev-b2g mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-b2g

Reply via email to