this post was submitted on 04 Jul 2023
19 points (85.2% liked)

Programming

17503 readers
8 users here now

Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!

Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.

Hope you enjoy the instance!

Rules

Rules

  • Follow the programming.dev instance rules
  • Keep content related to programming in some way
  • If you're posting long videos try to add in some form of tldr for those who don't want to watch videos

Wormhole

Follow the wormhole through a path of communities [email protected]



founded 1 year ago
MODERATORS
 

What happens when you set "font_size": 32 in your favorite editor? I would’ve told you anyway, but I’m glad that you asked.

top 4 comments
sorted by: hot top controversial new old
[–] [email protected] 10 points 1 year ago

Wow, all the ideas of the author are bad.

Font size in pixels are a bad idea, because people have different screen resolutions. For some your text might be legible and for some it will be a text for ants. You don't want that. Also a piece of paper doesn't have pixels, so you'll get different results for printed pages. You don't want that as well.

And the line height thing? No. Just no. Only because I have one larger letter anywhere in my text I don't want to screw up the line spacing for the whole paragraph/text.

Text size in px is objectively a bad idea.

[–] [email protected] 10 points 1 year ago

The problem is that points and pixels aren't directly comparable, but someone insisted on trying to make a universal definition mapping the former to the latter. We need to get rid of that mapping and return to treating points as a physical size that occupies a different number of pixels depending on the physical resolution of the display. Getting the mapping correct for any given display then becomes the problem of the people coding the font library, which is as it should be. Not only should fonts not be specified in pixels, but it should not be possible to specify the size of a font in pixels unless you're programming for embedded or other unusual use cases.

[–] [email protected] 9 points 1 year ago

While the exact scaling being based on a square around the letter is bad, the ideas the author brings are quite terrible as well.
We've been slowly adopting HiDPI screens over the last years and increasingly programs can actually scale with higher resolutions. At least on Linux with Xorg this scaling can be done by changing the DPI directly.
Using pixels instead is an absolutely terrible idea, because now it won't scale with DPI anymore. Much too big if you have an older screen with 1080p or lower resolutions and barely readable on 4k.

[–] [email protected] 5 points 1 year ago

Font size is definitely not useless. The article assumes that it is, because not all displays are the same size or have identical ppi. However, you are meant to calibrate your scaling settings for typography so that a size 32 font will look identical in any calibrated display or on printed paper.

If you don't care about printed typography, you don't need to bother with any of that.