How To: Quick New Font Guide

Forum rules
Share your brain ;)
User avatar
dkeg
Configurator
Posts: 3782
Joined: Sun Nov 18, 2012 9:23 pm
Location: Mid-Atlantic Grill

How To: Quick New Font Guide

Unread post by dkeg » Mon May 04, 2015 11:40 am

Fonts can be unnecessarily difficult. We all know this to be true. The following are the steps I take when I grab a new font.

Please note this is what I do. This is what works for me. If you have something to add that will add value, please do.


Step 1:
Download the font and extract if necessary.

Step 2:
cp the appropriate .pcf (preferrably) or .bdf file to

Code: Select all

/usr/share/fonts/local
Note that you may need to create that directory first. Also note that we are not using ~/.font. That does not seem to consistently work and apparently is now deprecated.

Step 3:

Run the following commands as root (thanks to GekkoP)

Code: Select all

sudo fc-cache -fs
sudo mkfontscale /usr/share/fonts/local
sudo mkfontdir /usr/share/fonts/local
Step 4:
Log out and back in

Step 5:
In your terminal run

Code: Select all

xlsfonts | grep [your new font]
Step 6:
Paste in your .Xresources (or where applicable)

Step 7:
Now, to trick your system and like your font directory, place the following in your .xinitrc

Code: Select all

# font bullshit
xset +fp /usr/share/fonts/local
xset fp rehash 
Bonus:
Of course it is hard to remember the commands. Please do the following
  • Subscribe to this thread
    Make a quick script and place in your $PATH. I named mine newFont

    Code: Select all

    #! /bin/bash
    ## Run this script for new fonts
    sudo fc-cache -fs
    sudo mkfontscale /usr/share/fonts/local
    sudo mkfontdir /usr/share/fonts/local
    
Now, when you add your new fonts to the proper directory (above), simply run newFont. And b/c its in your $PATH, you can run from anywhere.

Now adding fonts is not a headache. Enjoy!

Reference: http://linuxbbq.org/bbs/viewtopic.php?f ... &hilit=pcf
Last edited by dkeg on Tue May 05, 2015 11:04 am, edited 2 times in total.
Reason: Added a step 7

Work hard; Complain less

machinebacon
Baconator
Posts: 10253
Joined: Thu Sep 16, 2010 11:03 am
Location: Pfälzerwald
Contact:

Re: How To: Quick New Font Guide

Unread post by machinebacon » Mon May 04, 2015 11:52 am

important and helpful post, thanks a lot drew!
..gnutella..

User avatar
GekkoP
Emacs Sancho Panza
Posts: 5877
Joined: Tue Sep 03, 2013 7:05 am

Re: How To: Quick New Font Guide

Unread post by GekkoP » Mon May 04, 2015 1:02 pm

Very useful, especially for fonts addicts such as many honest men and women here. Thanks a lot.

User avatar
rhowaldt
Dog
Posts: 4565
Joined: Wed Oct 17, 2012 9:01 am
Contact:

Re: How To: Quick New Font Guide

Unread post by rhowaldt » Mon May 04, 2015 1:07 pm

thanks drew!
All statements are true in some sense, false in some sense, meaningless in some sense, true and false in some sense, true and meaningless in some sense, false and meaningless in some sense, and true and false and meaningless in some sense.

User avatar
ChefIronBelly
Approved BBQer
Posts: 1044
Joined: Mon Jan 13, 2014 6:01 am
Location: Michigan

Re: How To: Quick New Font Guide

Unread post by ChefIronBelly » Mon May 04, 2015 1:09 pm

Very nice Thank You - bookmarked
(1/1) Installing: LinuxBBQ...................................[69%]==============[/]

User avatar
wuxmedia
Grasshopper
Posts: 6445
Joined: Wed Oct 17, 2012 11:32 am
Location: Back in Blighty
Contact:

Re: How To: Quick New Font Guide

Unread post by wuxmedia » Mon May 04, 2015 5:41 pm

good stuff, better than install it all and hope ;)
"Seek, and Ye shall find"
"Github | Chooons | Site"

User avatar
dkeg
Configurator
Posts: 3782
Joined: Sun Nov 18, 2012 9:23 pm
Location: Mid-Atlantic Grill

Re: How To: Quick New Font Guide

Unread post by dkeg » Tue May 05, 2015 3:35 am

I experimented and it is indeed necessary to add the snippets I had in the 'troubleshooting' section in your .xinitrc. I have edited the OP and changed the troubleshooting to a step 6 as it appears to be required. When I commented out, my beautiful fonts were gone.

Work hard; Complain less

User avatar
Dr_Chroot
Alfalfa
Posts: 1100
Joined: Mon Jun 09, 2014 9:49 pm
Location: among the sagebrush
Contact:

Re: How To: Quick New Font Guide

Unread post by Dr_Chroot » Tue May 05, 2015 4:10 am

Wonderfully helpful post; something I really needed help with when I started playing with wm's. Thanks, dkeg!
Fight internet censorship.
EFF | Tor Project | Bitcoin

"There have been times throughout American history where what is right is not the same as what is legal. Sometimes to do the right thing you have to break the law." - Edward Snowden

pidsley
Hermit
Posts: 2539
Joined: Wed Oct 17, 2012 12:31 pm

Re: How To: Quick New Font Guide

Unread post by pidsley » Tue May 05, 2015 4:36 am

Thank you for the how-to dkeg.

Deprecated or not, I always put my user fonts in ~/.fonts/<font-name>, then run mkfontscale and mkfontdir on the individual directory. Keeping them in separate directories lets me add and remove fonts more easily, and only load the font I want to use.

Then as in your example, I add code to .xinitrc:

Code: Select all

xset +fp ~/.fonts/tamsyn-font-1.10
xset fp rehash
And the font becomes available at the next X start. The xset code can also be run with X already running (to load a new font) and then a modified Xresources can be reloaded with "xrdb ~/.Xresources" to change the terminal font. This seems to always work for me without problem.

As you say "Please note this is what I do. This is what works for me."

Of course these fonts are only available to my user; putting fonts in /usr/share/fonts/local (as in your example) makes them available to all users, and putting them all in one directory means you can load them all at once and not worry about reloading if you decide to change. Different paths to the same end.

Wherever you put the fonts, The important steps are as you showed -- running mkfontscale and mkfontdir, then "xset +fp <dir>" and "xset fp rehash".

The Arch wiki has some useful font information. It appears to be possible to use xorg.conf to tell X where fonts are located, but I have not tried this (as xset works well for me).

https://wiki.archlinux.org/index.php/Fonts

User avatar
GekkoP
Emacs Sancho Panza
Posts: 5877
Joined: Tue Sep 03, 2013 7:05 am

Re: How To: Quick New Font Guide

Unread post by GekkoP » Tue May 05, 2015 9:44 am

@dkeg: yes, as Pidsley said, I too put those lines in my .xinitrc. Always works for me. :)

(two steps 6?)

User avatar
dkeg
Configurator
Posts: 3782
Joined: Sun Nov 18, 2012 9:23 pm
Location: Mid-Atlantic Grill

Re: How To: Quick New Font Guide

Unread post by dkeg » Tue May 05, 2015 11:09 am

Thanks GP fixed.

Pidsley, thanks for the tip to pick up new fonts while in X. Funny how you don't see what's right in front of you. And yes, ~/.fonts does work for me *sometimes*, well mostly, but I wrote the tut this way b/c this particular method been my no fail route. Maybe its something I'm doing wrong (probably), but finally fonts are not an issue for me. And I hope others too now.

Work hard; Complain less

Post Reply