-   Slackware (
-   -   Dealing with created fonts (

waddles 10-23-2013 04:20 PM

Dealing with created fonts
I have been told that I can save created fonts under $HOME/.fonts.
I checked and that is not a file created under the install.
Is that what I should have found?
Is it faster to have them stored under $HOME or should they be in a separate file under /usr/share/fonts/ ?

I notice that mkfontscale creates an index of files and mkfontdir does it for X. I can see the need for scale-able vs non-scale-able fonts.
Why the difference other than scale ability?
What is the need for an index?
How are font information cache files used as built by fc-cache?
Is fc-cache needed to be run after installing a new font file?
I gather fc-cache is run at bootup, is that correct under Slack?

gnashley 10-25-2013 01:41 AM

You must create the dir $HOME/.fonts in order to use it. If you have admin rights and want to, you can place fonts under /usr/share/fonts. You need to run mkfontdir inside the dir where the new fonts are. If they are scaleable then you need to run mkfontscale there also. Finally, you need to run fc-cache ther to make them available -or reboot since, yes, fc-cache gets run during bootup.

waddles 10-26-2013 01:06 AM

If I manage to create a set of 4 glyphs into a font and store it in $HOME/.fonts, then how are the individual glyphs referenced so as to be displayed with echo?
How do I find out which font is currently in use? That just in case everything falls apart and I need to be able to read what I write to the screen?

tronayne 10-26-2013 09:18 AM

Wherever you place font files, in ${HOME}/.fonts, /usr/local/share/fonts or /usr/share/fonts, you will need to "tell" the system where to find them (the font files you've added).

The system fonts are located in /usr/share/fonts

ls /usr/share/fonts
100dpi/  OTF/    TTF/    cyrillic/  kanjistrokeorders/  util/k
75dpi/  Speedo/  Type1/  encodings/  misc/

The /usr/share/fonts/TTF directory contains all the TrueType fonts; e.g.,

ls /usr/share/fonts/TTF/Malig*
/usr/share/fonts/TTF/Malige-b.ttf  /usr/share/fonts/TTF/Malige-n.ttf
/usr/share/fonts/TTF/Malige-i.ttf  /usr/share/fonts/TTF/Malige-t.ttf

are a few of them.

It's not a good idea to add any additional fonts to the system directories, that sort of thing can come back to haunt you, so it's better to install "local" font files in /usr/local/share/fonts (or in your ${HOME} but then they won't be available system-wide, only for you). Better system-wide than personal.

So, let's say you've acquired one or more TTF files from somewhere and you'd like to use them on your Slackware system:
  • su -
  • mkdir -p /usr/local/share/fonts/TTF
  • cd /usr/local/share/fonts/TTF
  • cp <path to font files>/*.[Tt][Tt][Ff] .
  • chown root.root *
  • chmod 644 *
  • mkfontscale
  • mkfontdir
That copies all the TTF files, makes root the owner and group, makes them readable and creates the fonts.scale and fonts.dir files in the directory for you. As @gnashley mentions, TTF fonts are scaleable, thus you need to run mkfontscale and mkfontdir.

OK, so now you need to tell the system how to find those fonts (still as su), save the following in a file named /etc/fonts/local.conf

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<!-- /etc/fonts/local.conf file to configure system font access -->

Almost done -- the last step is to execute fc-cache:

/usr/bin/fc-cache -f
(you probably won't need to type /usr/bin though).

Don't forget to exit from su.

Once you've done this, it's dirt simple to add more fonts -- if you acquire some additional TTF fonts, simply add them to /usr/local/share/fonts/TTF, run mkfontscale, mkfontdir, and fc-cache -f and you're good to go. If you happen to acquire some Type 1 fonts, just create the directory /usr/local/share/fonts/Type1, copy the font files into it, run mkfontscale and mkfontdir (in that order, by the way), add a line to /etc/fonts/local.conf and run fc-cache -f and you're done.

The local fonts you add will be available to everything, system-wide; LibreOffice, OpenOffice, whatever.

Hope this helps some.

waddles 10-26-2013 06:42 PM

Yes that will help when I grab a TTF font to modify. Most of what I am doing requires glyphs created. And right know I am perplexed as to how to address a particular glyph from a font set once created. I don't even know how a glyph gets put into a font set.
I presume it would addressed either by hex value or as the previous character which it replaces, if it is a replacement. But when I build glyphs with Slackware's bitmap and mkfontdir and fc-cache I have NO idea where the glyph gets put. I have no concept of why it needs both a filename and a basename but I see no way to say it is glyph number 147 of 255 when I build it. It does not seem to be pointed to by basename which is supposed to be for C usage (I am developing in shell script).

tronayne 10-27-2013 07:52 AM

I may be wrong here but this sounds like you might want to get and use fontforge (from, "fontforge - create and modify PostScript, TrueType and SVG fonts" from the manual page. Also, the manual talks about Glyph Bitmap Distribution (.bdf) among others. You will want to get and compile the software at the SlackBuild link.

You can have a look at the manual at, there is an introduction, tutorial and other documentation to browse through.

Hope this helps some.

All times are GMT -5. The time now is 06:17 AM.