Font DPI and screen scaling

Frank Steinmetzger Warp_7 at
Sat Jun 20 16:57:43 BST 2020

On Wed, Jun 17, 2020 at 08:29:43AM +0200, test wrote:
> On Fri, 2020-06-12 at 01:32 +0200, Frank Steinmetzger wrote:
> > On Tue, Jun 09, 2020 at 12:24:25AM +0200, test wrote:
> > > On Sun, 2020-06-07 at 22:39 +0200, Frank Steinmetzger wrote:
> > > > [...]
> > > > In your valued experience/opinion, what is the appropriate way of
> > > > ensuring
> > > > that a 10 pt font has the same physical size on all screens if I use
> > > > display
> > > > scaling exclusively? Is a screen scale of 100 % assuming 96 dpi?
> > > 
> > > The only way to do that is to use displays that have the same amount of
> > > dots per square(!) inch.
> > 
> > Or tell the system how many DPI my screens have, so fonts have the proper
> > physical size.
> How would that make the font have the same size?

When I tell the system that I want a font in a certain point size, and it
knows the screen’s DPI, then it can calculate the necessary pixel height.
One inch has 25.4 mm and a typographical point is 1/72 inch:

Here’s an example for my 176 DPI Thinkpad:

10 pt / (72 pt/in) * 176 px/in = 10 / 72 * 176 pt/*(pt/in)*(px/in) ≈ 24 px
└────────┬───────┘   └───┬───┘
font size in inch   pixel scaling

CRTs of the olden days had a density of 72 DPI, equalling that of the
physical printing with lead types. So back in the early days of Desktop
Publishing, what you saw on the screen you actually got on paper when
setting the view to 100 % zoom. But nowadays, screen DPIs vary throughout a
whole range, as can be seen in my original post.

> For example, when a character occupies 10x10 dots in size and the display
> has 192x192 dots per inch instead of 96x96, the character would need to be
> somehow converted from 10x10 into 20x20 dots.  Where is the additional
> information required for this conversation supposed to come from?

Correct (about the 20×20). But where, in your example, does the information
come from in the first place that the character is to be 10×10 on a 96 DPI
screen? These days, the screens report their physical size themselves:

$ xrandr
DVI-0 connected primary 2560x1440+0+0 (normal left inverted right x axis y axis) 597mm x 336mm

# get-edit | parse-edid
Section "Monitor"
        Identifier "EV2736W"
        # EDID version 1.3
        # Digital Display
        DisplaySize 600 340

$ xdpyinfo
screen #0:
  dimensions:    2560x1440 pixels (677x381 millimeters)
  resolution:    96x96 dots per inch

xdpyinfo is wrong here. It (the X server?) seems to assume 96×96 DPI and
calculates the physical size from that. I double-checked my monitor size
with a tape-measure and the diagonal can easily be checked using Pythagoras:

sqrt((597 mm)^2 + (336 mm)^2) ≈ 685 mm ≈ 27 in

On my tablet, xdpyinfo speaks thusly:
screen #0:
  dimensions:    1800x1200 pixels (211x141 millimeters)
  resolution:    217x216 dots per inch

But only because I enforced the screen’s DPI to 217 with an argument to the
X server in sddm.conf. If I remove that setting, I am back at:

screen #0:
  dimensions:    1800x1200 pixels (476x317 millimeters)
  resolution:    96x96 dots per inch

Have you ever seen a Surface Go with a screen half a meter wide? ;-)

> Are all common fonts like, for example, Liberation Sans Mono vector fonts?

Yes. There are still bitmap fonts around, on Linux mostly for use in the
terminal and especially TTYs. One good example is Terminus. But those need
to store bitmaps for every usable size. This makes the file bigger and, of
course, limits the usable sizes. And you cannot do advanced things like

OTOH, you can scale a vector font to any size and it always looks sharp.
But fonts are still designed differently for small and large sizes. Fonts
for small-size applications (e.g. newspaper text) are drawn with thicker
lines, whereas fonts for big-size applications (headlines, posters etc) are
thinner. This improves readability, contrast and the overall appeal to the

> and some things are unfixable, like the font size of the message list in
> Evolution being way too small and with no way to change that.

This is an unfortunate side-effect of Linux Desktops being a diverse
ecosystem. They use separate standards for certain features (qt vs gtk?).
Perhaps you can fix that particular problem if you use a different GTK
theme, possibly one that also provides a Qt theme, so both worlds look the
same. I know of Breeze and QtCurve, but there are more, I presume.

> > > What do you mean by "screen scaling"?
> > 
> > System settings → Screens → Global Scale
> > It uses a percent scale just like MS Winblows. But a percentage is always
> > a
> > comparison to a base figure. So what is that here? This is the same (IMHO
> > stupid) thing that MS did in their settings; scaling with a percentage
> > with
> > no physical meaning behind it.
> Cool, I didn't know that there is such a setting in KDE.  I guess 100% is
> the base figure, so it should look the same when you have twice the dots
> and set it to 200%.

This scaling influences not only the fonts, but also other GUI aspects such
as layout spacing and widget sizes. Because what good are huge fonts on a
High-DPI touchscreen, if the scrollbars are still only 13 px wide? So, while
writing this mail, I came to the conclusion that this setting is indeed
helpful in certain scenarios. But it does not answer my original question
about actual font sizes.

> But what when the aspect ratio is different, or when I turn the display to
> make use of the width as height?  Why aren't there two percentages?

I don’t know of any screen (computer monitor, anyway) that has different
horizontal and vertical pixel pitches. CRT televisions had non-square dots.
For instance, PAL had a 4:3 picture, but its effective resolution was
704×576, which is more narrow (4:3 would be 768×576).

> Should I use this screen scaling and make the fonts smaller again such that
> the ones which are too small finally become large enough?

If some are too small, you should probably only enlarge those. Screen
scaling affects all at the same time and the same proportion.

> Can I use the screen scaling per display when multiple displays are
> connected?

Probably. I remember seeing bug reports about such a thing not working
properly, maybe in connection with Wayland. To be fair, this is a rather
complicated topic to implement.

Gruß | Greetings | Qapla’
Bitte nichts von mir oder über mich auf einem sozialen Netzwerk hochladen.

What woman is looking for a man who is looking for a woman looking for a man?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <>

More information about the kde mailing list