Remix.run Logo
somat 11 hours ago

The spec fafs around a bit talking about how the px is a "visual angle unit" But I am unable to form an interpretation where the "reference pixel" is anything other than 1/96 inch.

https://drafts.csswg.org/css-values/#absolute-lengths

I guess theoretically a tv could say "this tv will be viewed at 12 feet away so our reference pixel is 1/16 inch" and still be in spec. Which sounds like it has messy implications, Does anyone do this?

Anyway the point being a pixel should fundamentally be a hardware measurement, and if they wanted a "visual angle unit" they should have introduced one.(the moa?) But the last thing we need is a pixel being defined as a hard 1/96 of a inch. which is what we got.

wongarsu 10 hours ago | parent | next [-]

Windows used to let you set the DPI setting of the monitor, circa Win95-WinXP. Software tended to only expect a value of 96dpi, so it wasn't a very practical setting to change, and eventually windows introduced display scaling (which leaves old software in the belief that you are on a 96dpi screen, while allowing software to opt in to knowing about the real device pixels)

Screenshot: https://www.softacom.com/wp-content/uploads/2022/03/11111-10...

I guess you could use that setting on an old version of windows to set a screen to 16dpi, and now a CSS reference pixel is 1/3rd of a real pixel? But more realistically, what the spec is getting at is that a mobile device should set its dpi setting close to the real device setting, and a reference pixel is now something that looks about as big as a pixel on a 96dpi screen. That nobody actually sets their screen dpi on desktops is probably of secondary importance to them

notatoad 11 hours ago | parent | prev [-]

what the spec says doesn't really matter though, the spec is just nonsense people wrote down to try to back-explain decisions that the browsers had already made.

pixels are pixels, and no browser implements them as a fractional-inch measurement. in every actual implementation i'm aware of, they're a hardware based unit.

edent 11 hours ago | parent [-]

They aren't hardware based. As I say in the first link, pixels mostly don't exist in hardware.

Screens very rarely contain a matrix of individual squares.

For example - https://global.samsungdisplay.com/29043/

jonhohle 9 hours ago | parent [-]

Pixels very much exist in hardware outside mobile. Microsoft’s clear type even exploited the specific layout of color channels in discrete hardware pixels. Mobile displays are all over the place, but most other displays use standard RGB layouts.

edent 7 hours ago | parent [-]

You've described the exact problem. Sub pixel rendering exploits the fact that most display pixels aren't discrete logical squares.

https://en.wikipedia.org/wiki/Subpixel_rendering

SR2Z 7 hours ago | parent [-]

Right, but there's still an addressable set of display units that convert an RGB signal to actual glowing lights, right?

It seems like defining px to be perceptual is one of those compatibility hacks that probably helped a ton back in the day, but we have perceptual units and now we're stuck with that baggage.

I don't have much of an opinion on this (I use em) but it has taken me by surprise a few times.