X.org and Fontpath

tgl

Active Member

Reaction score: 40
Messages: 104

Hi guys,

it is strictly necessary these days adding the "fontpath" to Xorg as the handbook suggests or this is something that can be ignored?

Thanks in advance,

TGL
 

T-Daemon

Daemon

Reaction score: 991
Messages: 1,890

Some fonts font path need to be set explicitely in a xorg configuration file. Without setting it xorg won't detect them. For example:
Code:
Section "Files"
    FontPath "/usr/local/share/fonts/GentiumBasic/"
    FontPath "/usr/local/share/fonts/GentiumPlus/"
    FontPath "/usr/local/share/fonts/Caladea/"
    FontPath "/usr/local/share/fonts/Carlito/"
    FontPath "/usr/local/share/fonts/dejavu/"
    FontPath "/usr/local/share/fonts/Liberation/"
    FontPath "/usr/local/share/fonts/LinLibertineG/"
    FontPath "/usr/local/share/fonts/powerline-fonts/"
    FontPath "/usr/local/share/fonts/terminus-font/"
    FontPath "/usr/local/share/fonts/webfonts/"
EndSection

If a font needs font path set or not can be seen in the post-installation message of the package. If you missed the messages run pkg info -aD | grep FontPath.

That output can also redirected into a xorg configuration file instead of writing ever line manually: On all installed font packages pkg info -aD | grep FontPath >> /usr/local/etc/X11/xorg.conf.d/files.conf

Or on individual font packages: pkg info -D <font_package_name> | grep FontPath >> /usr/local/etc/X11/xorg.conf.d/files.conf

Afterwards edit files.conf accordingly.
 

Geezer

Aspiring Daemon

Reaction score: 512
Messages: 831

Running X with xfce4 (which may be pertinent), any fonts that I add to /usr/local/share/fonts and any ~/.fonts are automatically found and appear in X without ceremony.

Reference:
13.0-RELEASE-p5 xorg-7.7_3 xfce4-wm-4.16.1
 

Alain De Vos

Son of Beastie

Reaction score: 870
Messages: 2,826

Which raises the following question. How do you and for which fonts you should edit xorg.conf ?
 

T-Daemon

Daemon

Reaction score: 991
Messages: 1,890

Those fonts mentioned in post #3 are not automatically detected by xorg without setting a font path, those need a font path set.

Xorg.0.log with FontPath set:
Code:
[    46.267] (**) FontPath set to:
        /usr/local/share/fonts/GentiumBasic/,
        /usr/local/share/fonts/GentiumPlus/,
        /usr/local/share/fonts/Caladea/,
        /usr/local/share/fonts/Carlito/,
        /usr/local/share/fonts/dejavu/,
        /usr/local/share/fonts/Liberation/,
        /usr/local/share/fonts/LinLibertineG/,
        /usr/local/share/fonts/powerline-fonts/,
        /usr/local/share/fonts/terminus-font/,
        /usr/local/share/fonts/urwfonts/,
        /usr/local/share/fonts/urwfonts-ttf/,
        /usr/local/share/fonts/webfonts/,
        /usr/local/share/fonts/TTF/,
        /usr/local/share/fonts/OTF/,
        catalogue:/usr/local/etc/X11/fontpath.d

Xorg.0.log without FontPath set:
Code:
[   259.959] (==) FontPath set to:
        /usr/local/share/fonts/TTF/,
        /usr/local/share/fonts/OTF/,
        catalogue:/usr/local/etc/X11/fontpath.d

How do you and for which fonts you should edit xorg.conf ?
On all installed font packages pkg info -aD | grep FontPath >> /usr/local/etc/X11/xorg.conf.d/files.conf

Or on individual font packages: pkg info -D <font_package_name> | grep FontPath >> /usr/local/etc/X11/xorg.conf.d/files.conf

Afterwards edit files.conf accordingly.
 

Alain De Vos

Son of Beastie

Reaction score: 870
Messages: 2,826

Any idea for sway(wayland) ? If you don't have xorg installed but still want to use Liberation fonts.
 

Geezer

Aspiring Daemon

Reaction score: 512
Messages: 831

Those fonts mentioned in post #3 are not automatically detected by xorg without setting a font path, those need a font path set.

I have got those exact same fonts, and had not set a font path.

With previous versions of X, it seemed necessary.
 

Alain De Vos

Son of Beastie

Reaction score: 870
Messages: 2,826

Bye the way, i have an almost emty xorg.conf and using sway(wayland) i can choose Liberation fonts in firefox.
So someway,somehow they are automaticly known.
 
OP
T

tgl

Active Member

Reaction score: 40
Messages: 104

Which raises the following question. How do you and for which fonts you should edit xorg.conf ?

Sorry I made confusion, I didn't find it in the handbook but in a message after installing some packages as explained here:


For instance after installing LibreOffice you got the message to add these fonts:

Code:
FontPath "/usr/local/share/fonts/LinLibertineG/"
FontPath "/usr/local/share/fonts/Liberation/"
FontPath "/usr/local/share/fonts/GentiumBasic/"
FontPath "/usr/local/share/fonts/Carlito/"
FontPath "/usr/local/share/fonts/Caladea/"
 

Alain De Vos

Son of Beastie

Reaction score: 870
Messages: 2,826

I don't have those lines but i can select font liberation in openoffice under sway window manager.
[Libreoffice has a fontselection problem on my pc]
 

T-Daemon

Daemon

Reaction score: 991
Messages: 1,890

Generally you do not have to touch (or even have) xorg.conf. Fonts work perfectly without doing anything.
I confirm!

I only checked Xorg.0.log, without looking into the application. Despite the fact Xorg.0.log doesn't show the font path detection, the fonts are detected by the applications itself.

Without this thread I would not have noticed. Bottom line: No FontPath configuration needed.
 

T-Daemon

Daemon

Reaction score: 991
Messages: 1,890

Geezer

Aspiring Daemon

Reaction score: 512
Messages: 831

Over the last couple of years, X and setting up a desktop in general has become a lot more streamlined.
 

grahamperrin

Son of Beastie

Reaction score: 1,045
Messages: 3,504

The phrase fontpath appears in numerous package messages, for example <https://www.freshports.org/search.p...sc&search=Search&format=plaintext&branch=head>.

I don't have a point of reference handy, but I'm reliably informed that many such messages are outdated. I drafted part of what's required for a bug report, but I'm in no rush to make the report; without patch files, it might languish.

Generally you do not have to touch (or even have) xorg.conf. Fonts work perfectly without doing anything.

Generally true.

Unfortunately, the port of Google Fonts has a package message <https://www.freshports.org/x11-fonts/google-fonts/#message> that:
  • advises the user to do something that's (probably) no longer required
  • omits a requirement that involves ~/.config/fontconfig/fonts.conf
 

free-and-bsd

Daemon

Reaction score: 170
Messages: 1,016

I confirm!

I only checked Xorg.0.log, without looking into the application. Despite the fact Xorg.0.log doesn't show the font path detection, the fonts are detected by the applications itself.
Always had that problem with terminus fonts. The system did not always detect it smoothly. So, upon the ports update I'd end up with system not being able to use terminus fonts for my urxvt app every other time. And this is the worst scenario -- when things don't ALWAYS work the same way. So I ended up adding font path config file to xorg.conf.d directory.
 

kpedersen

Son of Beastie

Reaction score: 2,244
Messages: 3,070

For fonts I really want to exist on the machine, I put in my $HOME/.fonts directory and run

fc-cache -rv

I believe the freedesktop have new ideas on where the .fonts folder should be but it still works. Also, the command also seems to scan system fonts too so it might be enough just to run and get your terminus font discovered.
 

free-and-bsd

Daemon

Reaction score: 170
Messages: 1,016

Well, that's the problem of it. There is ~/.fonts folder. Then there is the fc-cache command. Which, BTW, is supposed to run automatically whenever X server starts or smth to that effect... isn't it? I mean, ALL these things are actually supposed to silently just work...

Only, every time I rebuild ports and freetype2 gets rebuilt (it's Synth), terminus-fonts can't be found by system and my urxvt pops up with some ugly big font instead. The only remedy is putting that fonts.conf file with FontPath into /usr/local/etc/X11/xorg.conf.d.

MAYBE the "problem" is in my using simple FVWM3 + startx to start X? Maybe. But I don't see why startx should fail to trigger ALL the processes and subprograms needed for running X smoothly. And with these multiple ways to make sure fonts are found & loaded, I'm still not sure which of them is THE one and only absolutely necessary.

...And yes, probably, now that I'm all set up, if I remove this FontPath config file, terminus font will still be found by the system. Until the next time freetype2 or terminus-fonts get rebuilt.
This is all rather confusing.
 

grahamperrin

Son of Beastie

Reaction score: 1,045
Messages: 3,504

terminus fonts

x11-fonts/terminus-font | x11-fonts/terminus-ttf

For me, both fonts became available after installation. Ignoring the FontPath advice in their package messages.

terminus-font results in xos4 Terminus:

1640260535364.png
 

kpedersen

Son of Beastie

Reaction score: 2,244
Messages: 3,070

This is all rather confusing.

Compared to macOS or Windows (where I have no idea of what is happening behind the scenes when I drag fonts around), I find it fairly straight forward.

Code:
mkdir ~/.fonts
cp gallant-demi-19.bdf ~/.fonts
fc-cache -rv

It should then show in fc-list ( fc-list | grep Gallant)

And finally, you can use it with, i.e xterm -fa Gallant

Admittedly the documentation can be hard to find because every desktop environment does it in a different, non-standard way. The above is the way standard Xorg/fontconfig does it *underneath* the clutter.

(works with bdf and ttf fonts as far as I have tested)
 

grahamperrin

Son of Beastie

Reaction score: 1,045
Messages: 3,504

… some DE …

KDE Plasma on slightly outdated FreeBSD 14.0-CURRENT (1400043, should be 1400045); no problem. <https://bsd-hardware.info/?computer=6fbb1f806232>

No problem with a minimal set of packages on 12.3-RELEASE:
1640269056958.png

I switched to ttyv3, logged in as root, installed terminus-ttf, switched immediately back to ttyv9, quit then restarted QTerminal, found the font available:

1640269307278.png
 

free-and-bsd

Daemon

Reaction score: 170
Messages: 1,016

KDE Plasma on slightly outdated FreeBSD 14.0-CURRENT (1400043, should be 1400045); no problem. <https://bsd-hardware.info/?computer=6fbb1f806232>

No problem with a minimal set of packages on 12.3-RELEASE:
View attachment 12358
I switched to ttyv3, logged in as root, installed terminus-ttf, switched immediately back to ttyv9, quit then restarted QTerminal, found the font available:

View attachment 12359
Yes. That "Terminal settings" application of yours seems to offer a choice of fonts. Meaning it pulls in with it some minimal DE utilities & scripts. So, fonts recognition WILL work all right.
My problem, however, is with urxvt relying solely on ~/.Xresources for fonts. And the problem with that is, for one thing, that X notation for terminus fonts (non-TTF) sometimes changes with every other pkg rebuild like this:
!URxvt*font: xft:xos4 Terminus:size=12:style=regular
!URxvt*font: -xos4-terminus-medium-r-normal--16-160-72-72-c-80-iso10646-1
Sometimes the one is recognized, sometimes the other one.
 
Top