Subject: bug#31702:

From: Carlos Pita <[email-masked]>
Date: Mon, 4 Jun 2018 20:02:33 -0300

I noticed another weird behavior (but it's not emacs fault as explained below).

Hack:size=11 looks very different of "Hack 11" or Hack-11. In fact
"Hack 11" is more like Hack:size=15.

The fontconfig documentation states that the size property is a double
which specifies the size in points, but then it's ambiguous when
stating how the size is encoded in a descriptor. The general
descriptor format is:

<families>-<point sizes>:<name1>=<values1>:<name2>=<values2>...

where <nameX> can be "size". So there seems to be two equivalent ways
of specifying a size in points: Hack-11 and Hack:size=11.

But by trial and error I found out that when part of the name-value
list, the size property is synonymous with the pixelsize property.

So the right way to specify a point size is, in my example, Hack-11.

Now, I was concerned about missing some font sizes, since emacs is
rounding sizes in a different way than gtk or whatever is the desktop
using. But my concern was unfounded. To be sure, emacs' Hack-10 is
desktop's Hack-10 and emacs' Hack-11 is desktop's Hack-12, so there is
a gap there. Of course, this is no big deal when setting the font from
inside emacs, since I'm able to set the size with tenth-of-point
precision: instead of 110 I just set 109 to get desktop's Hack-11. But
TIL that from resources file I'm able to set double valued sizes, so
Hack-10.9 also does the trick.

:)

>From my very limited experiments, it seems to be that emacs is
rounding sizes to the nearest available one while the desktop is
always rounding them down. Perhaps is a bit impolite from the part of
emacs to behave like that in a desktop environment but its behavior is
both internally consistent and more accurate. I feel inclined to close
this issue (and maybe to add an entry to the wiki explaining this font
sizing border case).