Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
How to get TrueType fonts to work in Mozilla and xterm
View unanswered posts
View posts from last 24 hours
View posts from last 7 days

Goto page 1, 2  Next  
Reply to topic    Gentoo Forums Forum Index Desktop Environments
View previous topic :: View next topic  
Author Message
dpowers
Guest





PostPosted: Mon Apr 29, 2002 7:19 am    Post subject: How to get TrueType fonts to work in Mozilla and xterm Reply with quote

Weird title, yes, but that's all I've figured out so far.

First, a little history. I installed Gentoo for the first time on Saturday. What a great distro. But I like to make things pretty, so one of the first things I wanted to do (after getting multiple monitors to run), was get Truetype support going. Truetype is beautiful, and very pleasant on the eyes.

Since I was using mozilla 1.0_rc1, and like the stability and speed of it, my quest was to get TrueType to run in it. What a fight. What I am posting here is the process of how I got it working. I hope I don't leave out steps, and I figure this will be useful to many.

The first step is to get the fonts. There is a great script out there to do this for you. It is called webFonts.sh, and you can get it here:

http://gongolo.usr.dsi.unimi.it/~vigna/webFonts4Linux/

This script will download all of the Microsoft Truetype fonts for you. I let it do everything it wanted to do, and it installed all the fonts to /usr/share/fonts/monotype/TrueType. Is also creates the fonts.scale and fonts.dir file for you.

Now that that is setup, let's take a look at my XF86Config-4 file. I'm just going to post what I think is meaningful to getting fonts to run.

Under Section "Module", you should have the following things:

Code:
# This loads the Type1 and FreeType font modules
    Load        "type1"
    Load        "freetype"


You should also have the following under the Section "Files" portion of this file:
Code:

#     FontPath  "/usr/share/fonts/monotype/TrueType"
    FontPath    "unix/:7100"
#    FontPath   "/usr/X11R6/lib/X11/fonts/misc:unscaled"
#    FontPath   "/usr/X11R6/lib/X11/fonts/100dpi/:unscaled"
#    FontPath   "/usr/X11R6/lib/X11/fonts/75dpi/:unscaled"
#    FontPath   "/usr/X11R6/lib/X11/fonts/Type1/"
#    FontPath   "/usr/X11R6/lib/X11/fonts/Speedo/"
#    FontPath   "/usr/X11R6/lib/X11/fonts/misc"
#    FontPath   "/usr/X11R6/lib/X11/fonts/100dpi/"
#    FontPath   "/usr/X11R6/lib/X11/fonts/75dpi/"


Notice how I commented out all FontPaths except the unix one.

I used xfs as my font server. There's probably other ways, but I haven't gotten that far yet to figure that out. In any case, if you're following along with me, you're going to need to make some changes so xfs starts up correctly. I'm stealing this from the Truetype fonts thread on this forum, as that is where I got a bunch of information.

You need to edit /etc/init.d/xfs. In here change -1 to 7100. Do not put a dash before the 7100. Mine looks like this:


Code:
if [ "`grep xfs /etc/passwd`" ] ; then
                start-stop-daemon --start --quiet --exec /usr/X11R6/bin/xfs \
                        -- -port 7100 -daemon -config /etc/X11/fs/config \
                                -droppriv -user xfs 1>&2
        else
                start-stop-daemon --start --quiet --exec /usr/X11R6/bin/xfs \
                        -- -port 7100 -daemon -config /etc/X11/fs/config 1>&2
        fi
        eend $?


The next step is to edit /etc/X11/fs/config. You need to add /usr/share/fonts/monotype/TrueType to it like this:

Code:
catalogue = /usr/X11R6/lib/X11/fonts/75dpi,
        /usr/X11R6/lib/X11/fonts/100dpi,
        /usr/X11R6/lib/X11/fonts/misc,
        /usr/X11R6/lib/X11/fonts/Type1,
        /usr/X11R6/lib/X11/fonts/Speedo,
        /usr/X11R6/lib/X11/fonts/CID,
        /usr/X11R6/lib/X11/fonts/PEX,
        /usr/X11R6/lib/X11/fonts/util,
        /usr/X11R6/lib/X11/fonts/Type1,
        /usr/X11R6/lib/X11/fonts/local,
        /usr/X11R6/lib/X11/fonts/Speedo,
        /usr/X11R6/lib/X11/fonts/truetype,
        /usr/X11R6/lib/X11/fonts/TTF,
        /usr/X11R6/lib/X11/fonts/encodings,
        /usr/X11R6/lib/X11/fonts/cyrillic,
        /usr/X11R6/lib/X11/fonts/freefont,
        /usr/X11R6/lib/X11/fonts/sharefont,
        /usr/share/fonts/default/Type1,
        /usr/share/fonts/ttf/decoratives,
        /usr/share/fonts/ttf/western,
        /usr/share/fonts/monotype/TrueType


We're getting close now. Kill X. I do this by pressing Ctrl-Alt-Backspace. I don't know if this is safe or not, but it works for me. If you already have xfs running, I recommend you stop it by typing /etc/init.d/xfs stop.
Now, everyone should start xfs by typing /etc/init.d/xfs start. If you do a ps -ef | grep xfs, you should see the following:

Code:
bash-2.05a# ps -ef | grep xfs
xfs       3435     1  0 05:12 ?        00:00:04 /usr/X11R6/bin/xfs -port 7100 -d


Now, restart X. I startx by typing: startx -- -dpi 100 -depth 24 +xinerama, but I have dual monitors. You can just type startx, it doesn't really matter.

To check if your system now sees TrueType fonts, I recommend typing xfontsel. If you click the -fndry option and see Microsoft there, you're doing good.

Now let's test truetype in xterm. Type the following:

xterm -fa "Andale Mono" -fs 12

Is it pretty? I hope so, because it's pretty on mine.

Now to get Mozilla to run. You need to edit this file:
/usr/lib/mozilla/defaults/pref/unix.js

Search for freetype and make sure it looks like this:

Code:

// TrueType
pref("font.FreeType2.enable", true);
pref("font.freetype2.shared-library", "libfreetype.so.6");
// if libfreetype was built without hinting compiled in
// it is best to leave hinting off
pref("font.FreeType2.autohinted", true);
pref("font.FreeType2.unhinted", false);
// below a certian pixel size anti-aliased fonts produce poor results
pref("font.antialias.min",        10);
pref("font.embedded_bitmaps.max", 1000000);
pref("font.scale.tt_bitmap.dark_text.min", 64);
pref("font.scale.tt_bitmap.dark_text.gain", "0.8");
// sample prefs for TrueType font dirs
pref("font.directory.truetype.1", "/usr/share/fonts/monotype/TrueType");
pref("font.directory.truetype.2", "/usr/X11R6/lib/X11/fonts/TTF");
pref("font.directory.truetype.3", "/usr/X11R6/lib/X11/fonts/truetype");


Now, in an xterm, type the following: export MOZILLA_XFT=1. Now, when you start mozilla, you should see something like this:

Code:
bash-2.05a# mozilla&
[4] 15126
bash-2.05a# gEnableFreeType2 = 1, nsFontMetricsGTK.cpp 941
gFreeType2Autohinted = 1, nsFontMetricsGTK.cpp 957
gFreeType2Unhinted = 0, nsFontMetricsGTK.cpp 964
gAntiAliasMinimum = 10, nsFontMetricsGTK.cpp 971
gEmbeddedBitmapMaximumHeight = 1000000, nsFontMetricsGTK.cpp 979
initialize freetype, nsFreeType.cpp 308
.

If it don't look this, I don't know what to say. Post here, and maybe I can help. Now if you go to Edit->Preferences->Fonts, you should be able to see all your new fonts. ALL Truetype fonts start with all a capital letter. Here are the fonts I chose, but as I play more, I'll find better settings.

Fonts for: User defined
Proportional: Serif Size: 8
Serif: Microsoft-trebuchet ms-iso8859-1
Sans-serif: Agfa Monotype-arial black-iso8859-1
Cursive: adobe-courier-iso10646-1
Fantasy: adobe-courier-iso10646-1
Monospace: Microsoft-trebuchet ms-iso8859-1 Size: 8
Checked Allow documents to use other fonts

I really hope this works for you. Truetype is really pleasant on my eyes. I may have left something out, but I tried to make sure I didn't. However, it's late, so don't bite my head off if it doesn't work. Rather, post here and the community can try and help. Also, if my process can be refined further, or there are better options I can use, please let me know.

-dpowers
Back to top
AutoBot
l33t
l33t


Joined: 22 Apr 2002
Posts: 968
Location: Usually Out

PostPosted: Mon Apr 29, 2002 10:09 am    Post subject: Reply with quote

Nice article, thanks alot for sharing it.
_________________
This message self destructed a long time ago.
Back to top
View user's profile Send private message
lk42pro
Tux's lil' helper
Tux's lil' helper


Joined: 21 Apr 2002
Posts: 114
Location: New Jersey, USA

PostPosted: Mon Apr 29, 2002 4:01 pm    Post subject: Reply with quote

can i say...*BUmp*
_________________
"I am a wanderer, It's time for me to wander again"
Back to top
View user's profile Send private message
niyogi
Apprentice
Apprentice


Joined: 10 Apr 2002
Posts: 199
Location: Austin, TX

PostPosted: Mon Apr 29, 2002 6:37 pm    Post subject: Reply with quote

very nice of you to post this. in the meanwhile, I don't think it works for Xfree86 3.x. you can use webFonts though and change th Xf86config file and add the path to the truetype fonts as the first line in the FontPath and be set.

-S
Back to top
View user's profile Send private message
PaperCrane
n00b
n00b


Joined: 11 Apr 2002
Posts: 25
Location: Nova Scotia

PostPosted: Mon Apr 29, 2002 6:37 pm    Post subject: Reply with quote

If you don't want to run a font server you can do this instead.
Code:

emerge ttmkfdir
cd /usr/bin/X11R6/lib/X11/fonts/TrueType
ttmkfdir > fonts.scale
mkfontdir

Works for me :)
Back to top
View user's profile Send private message
dpowers
Guest





PostPosted: Mon Apr 29, 2002 6:43 pm    Post subject: Reply with quote

This is great. PaperCrane, can you explain the advantages/disadvantages of running a font server? I heard this on IRC as well, and am wondering the reasoning.

BTW, when I wrote this, I was running fluxbox as my window manager. I emerged kde, and got KDE3 running last night with the mosfet-liquid theme (emerge mosfet-something). Then I fixed all the fonts in the control panel. Let me just say that TrueType looks 10 times more beautiful in KDE3 than fluxbox. This includes Konqueror which kicks absolute ass (pretty-wise) over mozilla. In addition, the mosfet-liquid "theme" is just incredibly beautiful.
Back to top
PaperCrane
n00b
n00b


Joined: 11 Apr 2002
Posts: 25
Location: Nova Scotia

PostPosted: Mon Apr 29, 2002 6:52 pm    Post subject: Reply with quote

Well the only real advantage to not running a font server is well not having a font server running ;) (i.e another process)

Other then that I don't know what the pros/cons are.
Back to top
View user's profile Send private message
lk42pro
Tux's lil' helper
Tux's lil' helper


Joined: 21 Apr 2002
Posts: 114
Location: New Jersey, USA

PostPosted: Mon Apr 29, 2002 6:54 pm    Post subject: Reply with quote

i think if you want to use antialias in applications that supports them such as xterm you ahve to run a fontserver...
_________________
"I am a wanderer, It's time for me to wander again"
Back to top
View user's profile Send private message
PaperCrane
n00b
n00b


Joined: 11 Apr 2002
Posts: 25
Location: Nova Scotia

PostPosted: Mon Apr 29, 2002 7:15 pm    Post subject: Reply with quote

I don't think so, as long as your X server can understand your fonts. When I get home today I'll make sure and post here if it works without a font server.
Back to top
View user's profile Send private message
lk42pro
Tux's lil' helper
Tux's lil' helper


Joined: 21 Apr 2002
Posts: 114
Location: New Jersey, USA

PostPosted: Mon Apr 29, 2002 7:25 pm    Post subject: Reply with quote

PaperCrane wrote:
I don't think so, as long as your X server can understand your fonts. When I get home today I'll make sure and post here if it works without a font server.

thanks for looking up on it...i am not 2 sure about it either....if that worked then there is really no point for a font server..??
_________________
"I am a wanderer, It's time for me to wander again"
Back to top
View user's profile Send private message
PaperCrane
n00b
n00b


Joined: 11 Apr 2002
Posts: 25
Location: Nova Scotia

PostPosted: Mon Apr 29, 2002 8:24 pm    Post subject: Reply with quote

Nope, doesn't look like you need a font server for xterm or mozilla, both work for me with anti-aliased fonts.
Back to top
View user's profile Send private message
pjp
Administrator
Administrator


Joined: 16 Apr 2002
Posts: 20089

PostPosted: Tue Apr 30, 2002 8:12 am    Post subject: Reply with quote

Tried this out, I guess its working. After the EXPORT line for starting mozilla I saw similar results, but definately different.
I also saw a couple of error messages. I assume its working because I saw all the fonts (tho not Microsoft in the xfontsel (?)
program). Some fonts still don't look right in mozilla (I'm using fluxbox).

I have a question about the following:
PaperCrane wrote:
If you don't want to run a font server you can do this instead.
Code:

emerge ttmkfdir
cd /usr/bin/X11R6/lib/X11/fonts/TrueType
ttmkfdir > fonts.scale
mkfontdir

Works for me :)


Where and how do you change the previous instructions to implement this instead?

Thanks
Back to top
View user's profile Send private message
PaperCrane
n00b
n00b


Joined: 11 Apr 2002
Posts: 25
Location: Nova Scotia

PostPosted: Tue Apr 30, 2002 12:05 pm    Post subject: Reply with quote

Same as the previous instructions, but instead of starting an font server and chaning your FontPath to point to a socket, you just add you TrueType font directory to your FontPath. On a side note there is a nice collection of free fonts with the fonts.scale and fonts.dir already made here: http://keithp.com/~keithp/fonts/
Back to top
View user's profile Send private message
cr0nos
n00b
n00b


Joined: 22 Apr 2002
Posts: 36

PostPosted: Tue Apr 30, 2002 2:53 pm    Post subject: hmm Reply with quote

I have xfs installed, but there is no "unix:7100" type of line in my XF86Config. So I added one and followed the "guide", but when I tried to startx, it couldn`t find the path "unix:7100" and couldn`t find any fonts.

What do I do?
or rather, how do I set up my xfs?
Back to top
View user's profile Send private message
lk42pro
Tux's lil' helper
Tux's lil' helper


Joined: 21 Apr 2002
Posts: 114
Location: New Jersey, USA

PostPosted: Tue Apr 30, 2002 2:59 pm    Post subject: Re: hmm Reply with quote

cr0nos wrote:
I have xfs installed, but there is no "unix:7100" type of line in my XF86Config. So I added one and followed the "guide", but when I tried to startx, it couldn`t find the path "unix:7100" and couldn`t find any fonts.

What do I do?
or rather, how do I set up my xfs?


read the article titled TrueType Fonts which is also under the Dekstop forum...
_________________
"I am a wanderer, It's time for me to wander again"
Back to top
View user's profile Send private message
dpowers
Guest





PostPosted: Tue Apr 30, 2002 4:09 pm    Post subject: Reply with quote

cr0nos:

Quote:
I have xfs installed, but there is no "unix:7100" type of line in my XF86Config. So I added one and followed the "guide", but when I tried to startx, it couldn`t find the path "unix:7100" and couldn`t find any fonts.


It should be:
Code:
FontPath   "unix/:7100"


Notice the / in front of the colon. Let me know how it goes.
Back to top
zen_guerrilla
Guru
Guru


Joined: 18 Apr 2002
Posts: 343
Location: Greece

PostPosted: Tue Apr 30, 2002 6:18 pm    Post subject: Reply with quote

Very nice post (although I don't xfs and everything looks fine...) but I have a could-be related question. Does anyone knows if it possible to use truetype fonts on Eterm ?
Back to top
View user's profile Send private message
PaperCrane
n00b
n00b


Joined: 11 Apr 2002
Posts: 25
Location: Nova Scotia

PostPosted: Tue Apr 30, 2002 7:14 pm    Post subject: Reply with quote

I believe this is what you are looking for: http://www.themes.org/forums/eterm/56/

p.s I don't use eterm so don't blame me if it doesn't work :P
Back to top
View user's profile Send private message
Stalione
Guru
Guru


Joined: 21 Apr 2002
Posts: 335

PostPosted: Tue Apr 30, 2002 10:24 pm    Post subject: Reply with quote

Quote:

Now that that is setup, let's take a look at my XF86Config-4 file. I'm just going to post what I think is meaningful to getting fonts to run.

Under Section "Module", you should have the following things:


Did you mean XF86Config file?

I did not see Micro$oft listed in my Xfonsel list. So I want to make sure its just a typo...not some new file.
Back to top
View user's profile Send private message
dpowers
Guest





PostPosted: Tue Apr 30, 2002 11:27 pm    Post subject: Reply with quote

In /etc/X11/, you will find two files. One is XF86Config, and one is XF86Config-4. XF86Config-4 is the file used by XFree86 4.x and above. XF86Config is used for XFree86 3.x and below.

If you are using XFree86 4.2 (do a XFree86 -version, i think), then you will want to use XF86Config-4. If you don't have it, just copy XF86Config to XF86Config-4.

You should see see microsoft under the -fndry option in xfontsel. If you don't, most likely there's a problem.

-Dave
Back to top
kavel
n00b
n00b


Joined: 21 Apr 2002
Posts: 20
Location: Hillsboro, OR

PostPosted: Wed May 01, 2002 4:14 am    Post subject: Reply with quote

Just a tiny remark: If you install X version 4.x on a fresh system, you don't get the XF86Config-4 file. As version 4 is the only one on your system, the configuration file is called XF86Config.

Kavel
Back to top
View user's profile Send private message
Stalione
Guru
Guru


Joined: 21 Apr 2002
Posts: 335

PostPosted: Wed May 01, 2002 2:25 pm    Post subject: Reply with quote

XFree86 -version

XFree86 Version 4.2.0 / X Window System
(protocol Version 11, revision 0, vendor release 6600)
Release Date: 18 January 2002
If the server is older than 6-12 months, or if your card is
newer than the above date, look for a newer version before
reporting problems. (See http://www.XFree86.Org/)
Build Operating System: Linux 2.4.19-r1 i686 [ELF]
Module Loader present


So I do have XFree84 ver. 4.2! For a second you had me worried :)
Back to top
View user's profile Send private message
cr0nos
n00b
n00b


Joined: 22 Apr 2002
Posts: 36

PostPosted: Wed May 01, 2002 3:36 pm    Post subject: jippi Reply with quote

I just got it to work.
I take it I am supposed to use the microsoft fonts, they look great :D

Just tips I thought might be helpfull to add/remind of:

If your xfs script says "-7100" then you have to add "unix/:-7100" the - does not mean option.

When you add the microsoft fonts to /etc/X11/fs/config, then make sure you have a comma after. I added the FontPath in the middle of the others and put a comma (,) after. After that it is only a matter of choosing the fonts ;).
Back to top
View user's profile Send private message
pablored
Tux's lil' helper
Tux's lil' helper


Joined: 01 May 2002
Posts: 96

PostPosted: Wed May 01, 2002 7:23 pm    Post subject: abiword truetype fonts Reply with quote

Should add that to get the fonts in AbiWord, assuming TrueType fonts are setup and working in X...

backup the old /usr/share/AbiSuite/fonts dir
Code:
mv /usr/share/AbiSuite/fonts /usr/share/AbiSuite/oldFonts


copy across the new microsoft replacements
Code:
cp -r /usr/share/fonts/monotype/TrueType /usr/share/AbiSuite/fonts


and the final CRUCIAL step
Code:
/usr/bin/ttfadmin.sh /usr/share/AbiSuite/fonts


Now starting Abiword results in the same usable, beautiful fonts.
Back to top
View user's profile Send private message
Jeevz
Bodhisattva
Bodhisattva


Joined: 15 Apr 2002
Posts: 195
Location: Boston, MA

PostPosted: Wed May 01, 2002 8:15 pm    Post subject: Reply with quote

zen_guerrilla wrote:
Very nice post (although I don't xfs and everything looks fine...) but I have a could-be related question. Does anyone knows if it possible to use truetype fonts on Eterm ?


As far as I remember, it is possible. However anti-aliasing is not supported.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Desktop Environments All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum