Solved Installing Truetype fonts on FreeBSD

Hello, I would like to install a Truetype font, namely Monoisome-Regular.ttf from https://larsenwork.com/monoid/. I have done some searching of the archives here and Google, as well as consulting the FreeBSD handbook, specifically the section at https://www.freebsd.org/doc/handbook/x-fonts.html. The latter document talks about

Screen Shot 2018-03-23 at 01.48.14.png


The problem is that the directory /etc/X11 doesn't exist on my system. The closest I've got is an empty folder at /usr/local/etc/X11/xorg.conf.d/. Is this a situation where, if I create the folder and file, it will automatically be used?
 
If /etc/X11 doesn't exist then you must have removed it somehow because normally it's part of the base system, you can confirm this through /etc/mtree/BSD.root.dist. So I'd recommend re-creating that directory. But yeah, if you need specific changes then it's usually advisable to simply create an xorg.conf file manually and then adding the options you need to customize.

Now, I'm not sure from mind but there is a possibility that you don't have to load this font module yourself, but that depends on the Xorg default settings which I don't know from mind. The thing is: x11-fonts/xorg-fonts-truetype is a 'meta package' which gets installed by default (x11-fonts/xorg-fonts depends on it and the main Xorg port depends on that). So seems a bit odd to me that Xorg would install TTF fonts without using them. It's possible of course, but something worth looking into.

If you want to keep your downloaded fonts separated from the system fonts (which is advisable) then it makes sense to create a new directory and adding a new FontPath entry to the Files section. Otherwise you might be able to simply copy the font into the existing /usr/local/share/fonts/TTF directory and immediately start using it.

(edit)

If you have Gimp or Libre Office installed then it should be easy to test this theory. Pick an installed TTF font and see if you can already use it.
 
That's strange. I certainly don't remember any deliberate move to remove /etc/X11. Maybe it was as a by-product of some other action?

I'll try recreating it manually. I mean what's the worse that could happen as a result??!!
 
Well, I got intrigued so I figured I'd fire up X on the old Dell and what do you know... I learned something new today :)
aQWSC1V.jpg
I wasn't sure, but it seems my assumptions were on the mark: Xorg uses TTF by default, so there is no direct need to manually add certain modules if you don't want to. In theory you should be able to dump the new font(s) into the TTF directory after which Xorg should be able to use them.
 
Well, I got intrigued so I figured I'd fire up X on the old Dell and what do you know... I learned something new today :)

I'm glad to have helped in your learning 😉

I was able to install the font and have it available in my terminal preferences. The only problem is that there are some Powerline characters in there that are supposed to display customised images, but they are not working yet. I'm waiting to see if the prompt module author has any idea.

Screen Shot 2018-03-23 at 03.29.21.png
 

Attachments

  • Screen Shot 2018-03-23 at 03.40.05.png
    Screen Shot 2018-03-23 at 03.40.05.png
    13.9 KB · Views: 479
  • Screen Shot 2018-03-23 at 02.10.55.png
    Screen Shot 2018-03-23 at 02.10.55.png
    96.8 KB · Views: 610
  • Screen Shot 2018-03-23 at 02.04.26.png
    Screen Shot 2018-03-23 at 02.04.26.png
    94.4 KB · Views: 663
Add the font path to:

/usr/local/etc/X11/xorg.conf.d/10-files.conf
Code:
Section "Files"
   FontPath     "/usr/local/share/fonts/"
   FontPath     "/usr/share/fonts/100dpi"
   FontPath     "/usr/share/fonts/75dpi"
   FontPath     "/usr/share/fonts/TTF"
   FontPath     "/usr/share/fonts/encodings"
   FontPath     "/usr/share/fonts/misc"
   FontPath     "/usr/share/fonts/util"
EndSection

And the module can be loaded on this way.

/usr/local/etc/X11/xorg.conf.d/15-modules.conf
Code:
Section "Module"
   Load     "freetype"
EndSection

EDIT: Ah, do not forget to run fc-cache, or even better fc-cache -vf.
 
Yes, so far any addition of fonts has been via the installation of ports packages. If I add any individual font folders, I'll be sure to do this. Thanks!
 
When you install a font from ports (specially bitmap fonts) often you get a pkg-message about adding the font to that path.
 
That's strange. I certainly don't remember any deliberate move to remove /etc/X11. Maybe it was as a by-product of some other action?

I'll try recreating it manually. I mean what's the worse that could happen as a result??!!

I have the fonts issue in freebsd 13.0 release, followed the suggestion to create /etc/X11/xorg.conf with the line Load "freetype" and repeated the same under /usr/local/etc/X11/xorg.conf.d. During reboot, I didn't get to plasma, startx showed xorg errors. Then I deleted both the xorg.conf files, the computer started with plasma.
 
I've made some progress where fonts on FreeBSD are concerned. The key was to enable UTF-8 for the entire system. Have a look at this page https://www.b1c1l1.com/blog/2011/05/09/using-utf-8-unicode-on-freebsd/ in particular sections 2 and 3.

Here's a screenshot of vim. I think it's starting to look pretty good!

I tried to follow the instructions in the link above, but these are the problems:

locale -a | grep '\.UTF-8$' > localeagrepUTF.txt
Output is at pastebin

diff -u /usr/src/etc/login.conf /etc/login.conf
diff: /usr/src/etc/login.conf: No such file or directory

cat ~/.login_conf
# $FreeBSD$
#
# see login.conf(5)
#
#me:\
# :charset=iso-8859-1:\
# :lang=de_DE.ISO8859-1:

cat /etc/login.conf
default:\


:charset=UTF-8:\
:lang=C.UTF-8:

Do I have to run cap_mkdb /etc/login.conf despite the diff error?

Thank you.
 
Back
Top