Making a resolution independent UI
blog.wolfire.com
blog.wolfire.com
- UIs tend to depend on things lining up, in order to look good. If you allow any scale, at some point things will not look quite right. One decent solution is to choose fixed scales, limiting what the user can choose; then, everything is (perhaps manually) made to work at those zoom levels.
- Detecting something like a mouse click is no longer the same problem at an arbitrary scale. If you need to know "was this clicked?" when using pixels, you're only talking about mapping one pixel to a region that is expressed entirely in units of whole pixels. But at an arbitrary scale, neither the mouse nor the target shape will "appear to" be rendered with whole pixels.
- In order to scale, everything must be scaling-aware. This turns out to be a pain, especially in established code that is accustomed to thinking in terms of a rigid pixel grid. You can see this problem, say, in Windows XP; while it allows users to customize system fonts extensively, it's pretty easy to find an installer or other program that didn't leave enough space (and wasn't thinking in the right terms), causing half the text to be truncated when a certain font and size are used.
Basically, I would build 320x240.css, 640x480.css, 800x600.css, etc., have an event listener polling for windowWidth, and change to the best stylesheet available. If you were, for example, at 799px width, you got the 640x480 display.
This was, of course, labor intensive, so you don't do this for everything. The last project I employed this on was done many years ago, and HAD TO look good at almost any resolution. This worked out well, except for images (which there were very very few of in this app), but that could be swapped out on resize as well, if you were really had to make it perfect.
Don't use pixels as absolute measurements and don't scale up raster graphics.
I see what you did there!
I always assume that people set their resolutions such that they can read normal-sized (12-14pt) text. If that's too small for their eyes, they would have set their screens to a lower resolution. As someone who likes to see a lot at once, this would probably irritate me.
All of this said, there's no reason why, if they provide proper instrumentation/controls, that I couldn't use a resolution independent display to crank the UI down to tiny size (tell it that I have low DPI) and provide a lot of screen real estate.
I'd like to see a writeup for the WebKit / Awesomium integration.
I was hoping for 150 DPI on screens ("paper quality" at the time was defined by laserprinters doing 300 DPIs, so 150 for screen sounded good enough). Never happened.
Would it be useful? After all, what do you think is an HDTV? smaller pixels, higher resolution.
There doesn't seem to be any elegant way around this problem unfortunately.