Hacker News new | ask | show | jobs
by Simon_M 5362 days ago
Am I missing something? The physical size of a 16px font will surely vary based on resolution and screen size.

So claims such as '16px is the same as most books' are clearly nonsense.

3 comments

Note that the author means "fonts/sizes that are 16 pixels tall" NOT "16 point fonts" (which is what you get when you pick 16 in MS Word or whatever).

The difference in terminology is subtle to look at, but huge in practice.

* for common pixel densities.
He means "for the most common monitor DPIs", duh.

The problem is: due to the need to mix and align with bitmap graphics, web design is most convenient when specifying font sizes in pixels (except for simple pages, like HN and such, fluid designs cannot cover most cases in a mainstream enough fashion).

So, given that, he had to mention a specific pixel setting. But he took into account most common DPIs. For the majority of users they do not vary that much, around 100-120 dpi.

(Btw, have you read the article? He is aware of that, and he even gives examples of 16px in different DPI screens).

Can we get over specifying text size by pixels already? You don't know what DPI monitor I will have when I look at your pages.
What’s the alternative? I know of no PPI-aware way of specifying font size.
Display PostScript - circa 1987 (thanks, Steve Jobs).

I know there isn't a good current alternative in the web world, but shouldn't it be a goal to not have to specify pixels anymore? Obviously mobile browsers already largely ignore/change pixel font sizes.

It’s a valuable goal but just that. A goal. It’s necessary to be pragmatic in the meantime. No point in dreaming.

(If you didn’t notice, we are talking about the web here.)

I understand the difference between pragmatism and dreaming.

In the short term, that pragmatism should include web devs not trying to lay everything out pixel-perfect so it breaks if the user hits "zoom". The diversity of screen sizes and browsers and DPIs is greater than it has ever been, and will only increase.

CSS3 media queries can help with this:

http://www.w3.org/TR/css3-mediaqueries/

A realistic strategy today is to assume a typical desktop monitor by default, since not all popular desktop browsers implement media queries to a useful extent. Then you can add specific CSS sections for hardware with very different parameters, such as screens on mobile devices. Usually being both newer and more in need, mobile OSes and the browsers running on them typically support media queries better, so while not always ideal, this approach works fairly well in practice.

Unfortunately we can't.

Maybe for copy text it's ok, but not for other page elements, ones that we want to align in a specific way to bitmap images, no.

The page-zoom style resizing is our best bet --it's the "resolution independent" way to have your pixels and eat them too.

Now, if we could provide bitmap assets that could be zoomed in the same way, instead of just showing bigger but more pixelated (as we can in application icons in OS X), we would be done.

Now, if we could provide bitmap assets that could be zoomed in the same way

The most common way (used for icons) is to provide multiple bitmaps and load the right one depending on screen DPI. You can do this on your site too.

And there's of course vector graphics (SVG), if you don't mind some extra processing on the client for rendering...

Yes, you could provide multiple bitmaps in a website now, but in a convoluted way (with some custom javascript checking for resize events etc). In the icons case, it happens automatically.

As for SVG, client rendering time would be insignificant for most case (for a desktop machine at least, they have CPU to spare). But currently used IE version (> 6) for one don't support SVG. And the main problem are bitmap assets such as photographs. Those cannot be done as vectors.

Sure... I didn't say that it would happen automatically, just that it could be done. Everything done on the web is convoluted.

Btw: why would you have to watch resize events? Changing the size of the browser window (even rotating the screen/phone) doesn't change the DPI.