That’s technically correct but:
- It assumes you can reliably know the DPI of the display (from my experience, EDID data is often wrong about it)
- It assumes that people want to think in typographic points, which I think is not the case. Either you need to do things accurately with pixels, or you don’t really care and you just want an unlabelled slider going from “tiny” to “huge”. The case where it would matter is if you do desktop publishing or word processing or things like that, where it’s convenient to set the zoom level in your app to 100% and be sure that the thing shows in actual size, as it would be printed. But in user interface, you don’t care about this, you just want the text to be large enough that you can read it, and small enough that you can fit as much data as possible on screen.
- I see no reason to have two separate things in the user interface in appearance settings, or to have two separate APIs for the DPI and font size and ask developers to somehow combine the two to figure out an appropriate size for their controls. The only thing it would allow is people using millimeters or inches to specify how their user interface looks. Do we need that?
Also, we already have a pixel size for fonts. That’s font->GetHeight which gives the ascent and descent in pixels. Currently the display DPI is not taken into account for this. We could add it to the computation, but for UI development it essentially means “never use the font size to do anything because its relation with pixels depends on the display DPI”.
I think it is simpler to say that our current font size is not in typographic points, but in a device-specific unit that depends on the DPI. Especially because even if you know the DPI, you can’t really assume what the user want. Maybe they are using a huge IMAX screen but viewing it from very far, and so only big text should be used. Or conversely, maybe they’re using a VR headset where the screen is small and has very high DPI, but then there are lenses that make it cover your whole field of vision, and tiny text that would not be readable at all if looking at the screen can and should be used.
These are extreme examples, of course, but even when switching between a 12" laptop and a 24" display of the same resolution (say 1080p), I would probably use different font size settings, and not in a linear way. I don’t want the text to use the same number of pixels on these two displays as it would be too small on the 12" one. But I also probably don’t want the text to be the same size in inches/centimeters, because I will probably make the text a bit smaller on the 12" display so I can still fit two windows on screen side by side.
That’s how I’m thinking about it, in terms of using the OS and writing apps for it:
- Ease of use for users, with a single place to adjust the size. Not a combination of font size and DPI (or even more settings?) with ability to adjust both.
- Ease of use for developers, with a single place to get the information about “how large should I draw things”?
If that makes people happy, you can add any level of indirections and conversions between these two. But since I want just one value on the input side, and just one value on the input side, I don’t see the point in not doing the simple thing and using the same value.
To me it doesn’t matter which unit is used. A float value ranging from 0.6 to 3? It’s fine. A percentage fron 60% to 300%? I can handle that. A “font size” in some arbitrary unit ranging from 8 to 48? Why not, that does the job too.
And since the last of these 3 options was already available in the Be API, it was the simplest to just go with that. There was less code to rework.
If we were to change our mind about this, it would look like this:
- Hardcode the UI font to always be size 12 no matter what
- Add a “scaling” slider to appearance prefernces instead
- Change BFont to multiply that 12 by the scaling factor before handing it to the font rendering code
- Make sure all the code never calls font->Size and instead uses font->GetHeight (which is more complicated to use as it doesn’t return a single value) or StringWidth or directly some new GetDisplayScaling API when it needs to compute some size that should scale with the user interface
After doing this we still have not solved the issue of things that really care about the DPI (as mentionned earlier, desktop publishing and the like), since what these want is ignore the user set scaling, and make sure they can render thing at the actual size (“as would be printed”), and so they have to get the info from the source (that would be using BScreen to get the DPI, and then work in pixels with multiplying everything, or we can be fancy and add an API that allows to work directly in millimeters/inches/points/… like CSS does)