06-03-2013 02:52 PM
Blatant plugging of my own stuff now I'm back from the land of no Internet (middle of nowhere, Ireland)
My ScreenDisplay WW API is now on GitHub (thx timw)
You can get some useful numbers with JS but they are just what JS is told to tell you, If you set your meta wrong or whatever JS will tell you how big the browser is - not what size the screen is
This new API completely ignores the browser's idea of a pixel and uses the real sizes of everything. Of course if you're using non 1:1 meta you'll need to adjust but...
The most valuable bit of information the API gives you is PPI - PPI means Pixels Per Inch
This allows you to have images and text as-designed rather than tiny or huge depending on what device you use it on.
The Z10 + Q10, for example, have different PPI values - pixels are slightly smaller (358 + 332) on a Q10 (OK a DA-C)
This may sound trivial but suppose we get PlayBook BB10 OS?
All the text font sizes and images carefully designed for a Z10 are huge - if that's something you don't want then you want to use PPI
I've got a mostly written KB article I'll post soon as I can for those more interested
06-06-2013 07:32 PM
Not sure if you've seen this, but the following KB describes how to set up the viewport to achieve the same result = physical dimensions of the device, based on the devicePixelDensity property.
06-06-2013 08:09 PM
You miss the point
The extension I wrote is not bothered about what the browser tells us
You're thinking what the browser reports without regard to the size of the device
Is a font size of 12px the same on a PlayBook the same as on a Z10?
This actually makes it possible
As far as I am aware this extension is unique (only on BB10 and not available on any other device via JS)
Ask the QuirksMode dude (or listen to him telling me it will never be supported @ Amsterdam in sessions)
06-06-2013 09:18 PM - edited 06-06-2013 09:21 PM
Totally missed the point.. my mistake. Good job on the extension btw
I am also often puzzled by the fact that support for higher densities is still lacking in HTML5.
I remember thinking maybe we can use the pixelRatio as a multipier for font sizes (didn't get the time to continue investigating):
PixelRatio Font Size
1 (PlayBook) 15ox
2 (Retina) 30px
2.44 (Z10) ~36px
06-06-2013 09:39 PM
Don't get me wrong
The value returned by JS is VERY useful if you don't have PPI (that's just us)
The thing is that the PPI is wonderful as it allows you so much scope
You are correct, and this is why I wrote the thing - make it as designed
You have to mess about a bit on startup but your font will ALWAYS be legible
Your numbers look right
Don't worry about not seeing where I was going with this one
Its one of the most mis-understood bits of a HMI