LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 10-23-2013, 03:20 PM   #1
waddles
Member
 
Registered: Sep 2012
Posts: 372

Rep: Reputation: 1
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?
 
Old 10-25-2013, 12:41 AM   #2
gnashley
Amigo developer
 
Registered: Dec 2003
Location: Germany
Distribution: Slackware
Posts: 4,928

Rep: Reputation: 614Reputation: 614Reputation: 614Reputation: 614Reputation: 614Reputation: 614
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.
 
1 members found this post helpful.
Old 10-26-2013, 12:06 AM   #3
waddles
Member
 
Registered: Sep 2012
Posts: 372

Original Poster
Rep: Reputation: 1
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?

Last edited by waddles; 10-26-2013 at 12:09 AM.
 
Old 10-26-2013, 08:18 AM   #4
tronayne
Senior Member
 
Registered: Oct 2003
Location: Northeastern Michigan, where Carhartt is a Designer Label
Distribution: Slackware 32- & 64-bit Stable
Posts: 3,541

Rep: Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065
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
Code:
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.,
Code:
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
Code:
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<!-- /etc/fonts/local.conf file to configure system font access -->
<fontconfig>
	<dir>/usr/local/share/fonts/TTF</dir>
</fontconfig>
Almost done -- the last step is to execute fc-cache:
Code:
/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.
 
1 members found this post helpful.
Old 10-26-2013, 05:42 PM   #5
waddles
Member
 
Registered: Sep 2012
Posts: 372

Original Poster
Rep: Reputation: 1
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).

Last edited by waddles; 10-27-2013 at 04:19 AM.
 
Old 10-27-2013, 06:52 AM   #6
tronayne
Senior Member
 
Registered: Oct 2003
Location: Northeastern Michigan, where Carhartt is a Designer Label
Distribution: Slackware 32- & 64-bit Stable
Posts: 3,541

Rep: Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065
I may be wrong here but this sounds like you might want to get and use fontforge (from SlackBuilds.org, http://slackbuilds.org/result/?search=fontforge&sv=14.0). "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 http://fontforge.sourceforge.net/, there is an introduction, tutorial and other documentation to browse through.

Hope this helps some.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Dealing with a partition Ed Gray Linux - Newbie 1 09-19-2012 09:26 AM
dealing with the runlevels kellogs Linux - Networking 6 10-30-2008 09:11 AM
Dealing with NTP ryanlum Linux - General 3 12-10-2007 02:20 AM
dealing with arguments hammertime1983 Programming 2 11-02-2007 08:43 AM
Dealing with partitions. lvella Linux - General 4 07-22-2005 08:37 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 12:16 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration