Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Web and WebWorks Development

Reply
Developer
peardox
Posts: 1,229
Registered: ‎03-20-2011
My Device: Playbook, Z10 LE, Dev Alpha B, 2x Dev Alpha C
My Carrier: 3, Orange, Vodafone

PPI - How big is a pixel?

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

 

 




Click the like button if you find my posts useful!
Please use plain text.
BlackBerry Development Advisor
anzor_b
Posts: 164
Registered: ‎09-24-2012
My Device: White BlackBerry 10
My Carrier: Bell

Re: PPI - How big is a pixel?

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.

 

http://supportforums.blackberry.com/t5/Web-and-WebWorks-Development/How-to-set-up-the-viewport-for-a...

Please use plain text.
Developer
peardox
Posts: 1,229
Registered: ‎03-20-2011
My Device: Playbook, Z10 LE, Dev Alpha B, 2x Dev Alpha C
My Carrier: 3, Orange, Vodafone

Re: PPI - How big is a pixel?

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)




Click the like button if you find my posts useful!
Please use plain text.
BlackBerry Development Advisor
anzor_b
Posts: 164
Registered: ‎09-24-2012
My Device: White BlackBerry 10
My Carrier: Bell

Re: PPI - How big is a pixel?

[ Edited ]

Totally missed the point.. my mistake. Good job on the extension btw :smileyhappy: 

 

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 

 

Cheers,

A.

Please use plain text.
Developer
peardox
Posts: 1,229
Registered: ‎03-20-2011
My Device: Playbook, Z10 LE, Dev Alpha B, 2x Dev Alpha C
My Carrier: 3, Orange, Vodafone

Re: PPI - How big is a pixel?

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

 

So yeah

 

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




Click the like button if you find my posts useful!
Please use plain text.