Difference in rendering xft fonts in xorg-server and XQuartz.app
Richard L. Hamilton
rlhamil at smart.net
Tue May 28 13:53:54 UTC 2019
> On May 28, 2019, at 08:11, Ryan Schmidt <ryandesign at macports.org> wrote:
> On May 28, 2019, at 02:55, Chris Jones wrote:
>> On 28/05/2019 1:25 am, Richard Cobbe wrote:
>>> I just got a new MacBook and I'm setting up macports on it as part of the
>>> initial configuration. I've been using macports with XQuartz for many
>>> years, but I gather that XQuartz is no longer actively maintained, so I
>>> figured I'd try xorg-server instead. Everything installed fine and I'm
>>> able to open and use clients, but using xft fonts in urxvt (also installed
>>> via macports) doesn't produce the same results on screen under xorg-server
>>> as it does under XQuartz.
>>> I've put screen shots of the results at <https://imgur.com/a/TTNFx8b>. The
>>> first image contains the results under XQuartz, and the second under
>>> xorg-server. This is urxvt from the rxvt-unicode port, v9.22, on MacOS
>>> 10.14.5 started with the command
>>> LC_CTYPE=en_US.UTF-8 urxvt -fn xft:Consolas:pixelsize=16
>>> I prefer the first rendering quite strongly. Is there a way (installing
>>> a missing package, perhaps?) for me to get this rendering in xorg-server?
>> Honestly, I cannot see any difference between those two screen shots. What exactly is it about the [first] you say is different and you prefer ?
> The font appears to be different. Look at the lowercase "i" which has a bottom serif in the first screenshot, while it doesn't in the second screenshot. I see subtle differences in other letters as well, like the lowercase "l" which is more curved in the first screenshot than in the second and the capital "Q" which has a straight tail in the first screenshot but a curved one in the second. Overall the text in the first screenshot has a slightly heavier weight as well.
> It appears to me that the first (i.e. liked) font is Menlo 13 while the second (disliked) font is Andale Mono 13. I too like Menlo a lot and have been using it in my Terminal since Apple started shipping it with macOS.
> I don't know where X11 or its terminal stores its font settings...
Native macOS font locations:
Any app or framework can include its own fonts, usually in Resources/Fonts.
X11 font locations (server rendering):
See the font path, near the end of the output of
Proper fonts.dir files need to exist in each X11 font directory, as an index of the full names vs the file name. fonts.alias and fonts.scale may also exist; the latter is read by mkfontdir, not by the server. The commands mkfontscale and mkfontdir are used to build those files; the former deals with scalable fonts and puts its output in fonts.scale; the latter incorporates fonts.scale along with all the non-scalable (bitmap, mostly) fonts in the specified directory, to create the directory's fonts.dir file.
X11 font locations (client side rendering):
Could be anywhere, since a client could do this however it liked. If the client is using fontconfig, you can probably find its configuration files (for example, *.conf in /opt/local/etc/fonts, and below) and look at them to find the paths it searches.
Insofar as the file formats are supported and the directories contain fonts.dir files (/System/Library/Fonts tends not to, and may be protected by SIP), X11 (either server or client side rendering) could the same font directories that macOS uses, in addition to its own of course.
Individual X11 apps may have different ways of specifying which fonts they use. Xt based apps will probably have entries in resource files, for example
/opt/local/share/X11/app-defaults/XTerm, or in loaded resources (output of xrdb -q, generally initialized from ~/.Xdefaults). Qt and gtk toolkits have their own configuration mechanisms.
The above is mostly off the top of my head; no guarantee it's either complete or correct.
More information about the macports-users