Live data from Hacker News

Death to px, long live ch

shkspr.mobi

51–60 of 86 posts

Re: Death to px, long live ch

#51
post #15
post #10

What I want to know is who decided to break px, the last thing we need is yet another screwball physical measurement, css was already full of them. But what "tut tut, everybody is using px and these new hi-dpi displays are rendering things really tiny, we can't have that" and now px as a useful unit is ruined. Is there a way to use real pixels? My, admittedly quick, search says no. at least nothing jumps out at me fr…

No one decided to break it, it was 1/96th of an inch from the beginning. The problem with different screens having different pixel densities was already present and obvious in 1996. "Real" pixels are useless if you don't know anything about the screen you're going to render on.

Knowing about the screen also doesn't do you much good if you don't know how far it is going to be away from the viewer. (Yay at fonts rendering with 3 point on my projector because it reports some 6m³ of "screen" area.)

Re: Death to px, long live ch

#52

What happened to em?

em is a generic "font-size" without regard to the axis. ch is specifically related to the font width, and ex is specifically related to the font height. So if you want things like padding and margins to be proportionate to the font size, then using em will be suboptimal for fonts that happen to be tall or short. And as a web developer, you generally don’t know which font will be used (content management systems, designers making different choices in the future, users overriding fonts for accessibility reasons, etc.)

For lengths that you specifically want to be axis-independent and related to the font size, e.g. border-radius, then you should still use ems.

Re: Death to px, long live ch

#53
post #10

What I want to know is who decided to break px, the last thing we need is yet another screwball physical measurement, css was already full of them. But what "tut tut, everybody is using px and these new hi-dpi displays are rendering things really tiny, we can't have that" and now px as a useful unit is ruined. Is there a way to use real pixels? My, admittedly quick, search says no. at least nothing jumps out at me fr…

Who broke px? It was W3C. In "CSS Values and Units Module Level 3", px was defined as 1/96th of an inch

But even in CSS1 (1996), a "reference pixel" based on a typical 90 DPI monitor was recommended. You could argue its always been broken

Re: Death to px, long live ch

#54
post #48

The article links to https://shkspr.mobi/blog/2018/11/the-myth-of-the-pixel-perfe... which confuses me, because I definitely remember pixels being visible when I was growing up. I remember the first time I got a 1080p monitor. I felt a visceral terror at the fact that I could no longer see the pixels.

Yeah, you can see square-looking pixels on most screens if you display something with sharp aliasing. "There is no universal grid" is good to understand, but there are device-specific grids all over the place.

And all the examples that are ultra zoomed and/or showing antialiased font rendering obscure the pixels that are more visible in other situations.

That 0.01 to 0.04 degree range later in the article is big enough to drive a truck though. And you can see stairstepping at even finer distances.

Re: Death to px, long live ch

#55

I’ve found that ch and ex units are heavily influenced by latin characters. They just give weird results with non-latin characters leading to magic numbers. But the concept is really solid: use them if you want the spacing relative to text.

Nobody uses ch, let's be honest.

Totally.

Re: Death to px, long live ch

#57
post #48

The article links to https://shkspr.mobi/blog/2018/11/the-myth-of-the-pixel-perfe... which confuses me, because I definitely remember pixels being visible when I was growing up. I remember the first time I got a 1080p monitor. I felt a visceral terror at the fact that I could no longer see the pixels.

> because I definitely remember pixels being visible when I was growing up

Was this on an LCD or CRT display? Because on a CRT, you can't really see the pixels [0] [1], so what you were seeing was probably the shadow mask instead [2]. You could definitely see the pixels on old LCD monitors though, and new LCD monitors too if you look really close, although even big LCD pixels aren't quite as prominent as the shadow mask is on a CRT.

[0]: https://en.wikipedia.org/wiki/Fixed-pixel_display

[1]: https://alvyray.com/Memos/CG/Microsoft/6_pixel.pdf#page=8

[2]: https://en.wikipedia.org/wiki/Shadow_mask

Re: Death to px, long live ch

#58
post #8

I also did some experiment with ch many years ago. I found that 60ch is ideal width for block text for easy reading. too bad it is pretty hard to make websites with only 60ch wide.

Huh?

  
    Your content
  
What is hard about that?

Re: Death to px, long live ch

#59
post #25

Earlier quoted context omitted.

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.

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/

You’ve linked one example of exactly how those samsung displays do consist of a matrix of individual squares.

Here, samsung draws a border around one: https://global.samsungdisplay.com/wp-content/uploads/2021/11...

A pixel is made up of multiple components because everything is made of multiple components.

Re: Death to px, long live ch

#60
post #59
post #25

Earlier quoted context omitted.

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/

You’ve linked one example of exactly how those samsung displays do consist of a matrix of individual squares. Here, samsung draws a border around one: https://global.samsungdisplay.com/wp-content/uploads/2021/11... A pixel is made up of multiple components because everything is made of multiple components.

Look at how they describe it on that page:

> Samsung Display succeeded in designing the most optimal spatial frequency design with a 45 degree diagonal symmetry across the entire display layout.

See the image: https://global.samsungdisplay.com/wp-content/uploads/2021/11...

All of the components are in that diamond pattern. When you try to draw to a specific pixel width, the display chooses which sub-pixels make up a logical pixel. There is no specific square for you to target.

Post reply on HN