Is Beauty Only Pixel Deep?, Part 2
Welcome back, everyone, to another installment of the SysAdmin's Corner, where knowledge and discovery are keywords and mysticism and impossible are not. It is time once again to pull back the curtain from Linux fonts and have a nice long chat with the gentleman at the controls. Judging from some of the responses I received from my last column, it seems that fonts are a nightmare to many (and I can't say I blame you). Nevertheless, it's time to put away fear and learn to enjoy your font experience.
As many of you already know, I firmly believe in learning by doing, by trying out things and seeing what happens when you type this command or that one. On that note, I'm going to have you play with your fonts. I'm going to have you try some things here, some of which may wind up producing some strange-looking results when it comes to your X display's fonts. I'm not trying to scare you, I simply want to make sure you back up your files before you start.
One of the questions that came up repeatedly was that of the font server, specifically xfs. Why would you want to use xfs when XFree86 4.X already knows how to deal with TrueType fonts? I agree that it seems to be an overly complicated thing to do, but remember Linux's server roots (so to speak). The idea is that you can run a font server on one machine in your office and have all the other Linux clients take advantage of its resources. Why? Because each machine then uses the same fonts, thus providing a consistent environment. You might remember that xfs, the X font server, runs on port 7100 by default. That's what this line in your XF86Config-4 file is all about.
FontPath "unix/:7100"
As you might have guessed by the fact that a port is specified, it is possible to run the font server from another port. In fact, you can run multiple font servers, each with its own configuration. In the following example, I started a second instance of xfs, this one running on port 7101 as opposed to the default 7100.
xfs -config /etc/X11/fs/configtest -port 7101
Yes, I added something else to the command. That -config parameter tells the program to read its information from a different config file since I don't really want to muck up my original when I'm experimenting. In this case, the file is called configtest, and I could put it in any directory that amuses me. If you'll remember from the first part of this series, xfs uses a file called config, which can be found in /etc/X11/fs or /usr/X11R6/lib/X11/fs depending on your system. By specifying a second file, we can tweak and experiment at will.
Using the xlsfonts command, you were able to get a list of all the fonts on your system. You can also get that list with a query to the font server directly by typing fslsfonts -server unix/:7100.
Depending on your Linux distribution and your installation of X, this may or may not work. For instance, on my notebook computer (which runs Red Hat 7.2), the X font server does not allow TCP connections by default. This is done for security, but it does kind of negate the advantage I spoke of a few paragraphs back. That setting is controlled with the following line from your fs/config file.
no-listen = tcp
Just delete the tcp from the above line, save your changes, then stop and start the font server. Now you should be able to use the fslsfonts command without a hitch. In fact, you even can use it to query your system remotely or another system altogether. For instance, I can get a list of all the fonts served by my main development machine (scidev) by using the command fslsfonts scidev:7100.
Before we move on to the next step, I want to show you how you can start a second X session on your system without touching the one you are currently using. Your X session is most likely running on virtual terminal 7. That's because your virtual terminals from 1 to 6 are busy providing text logins for additional sessions. You can jump out of your current session by typing Ctrl-Alt-F1, and get back in by typing Ctrl-Alt-F7. Give it a try.
Back safe and sound? Great. Now go to your second (or third or fourth) terminal session and login to a test account. Since I do crazy things like this all the time, I create a handful of additional logins, test users so that my own work environment remains somewhat stable. Using an alternate login, type this command at the shell prompt:
startx -- :1
A complete second X session will start on your system, running on virtual terminal 8. To switch to your first session, you can use Ctrl-Alt-F7; Ctrl-Alt-F8 will take you back to your second session.
We'll use same principle for the X server itself. By default, it uses a file called XF86Config (or XF86Config-4). What I do is take a copy of that file and bring it into a work directory. I called mine Xperiment.
cd $HOME/fontplay
cp /etc/X11/XF86Config-4 Xperiment
Open your new file and look for the FontPath line. Then, change the font server from port 7100 to port 7101.
FontPath "unix/:7101"
Now, let's start our play X session to use the new config file and the new X server.
startx -- :1 -xf86config $HOME/tmp/Xperiment
What you have now is a separate xfs environment to play with, one that doesn't affect your current running session. You can now safely remove fonts from the catalogue (as defined in your new config file), change the load order and so on. The order, by the way, does make a difference. Look at the top of your xfs config file, and you'll see something that looks like this:
catalogue = /usr/X11R6/lib/X11/fonts/misc:unscaled,
/usr/X11R6/lib/X11/fonts/75dpi:unscaled,
/usr/X11R6/lib/X11/fonts/100dpi:unscaled,
/usr/X11R6/lib/X11/fonts/misc,
Before you change anything, start up Netscape or the GIMP or anything that uses native X fonts. The reason I mention this is that various desktop environments (such as KDE) control their own fonts for their own applications. Unfortunately, merely running KDE and having all your fonts nicely defined doesn't mean that the GIMP necessarily will use those fonts. That said, once you've fired up the GIMP, you should get something that looks like the image below.

Now go back into your xfs config file and swap the 75dpi line at the top with the 100dpi line. Save your changes, stop and restart xfs. Then restart your desktop and get the GIMP rolling again. You should see something that looks this image:

Note that while the KDE desktop fonts look the same (the window title bar where it says The GIMP), the menu fonts (where it says File, Xtns, Help) are much larger. Some of you will be saying, "Yes, but you can change the dpi setting of your X session with a command-line option", and you are correct. What I wanted to demonstrate here is that the order of the font list matters. When the system calls for a 12 pt. regular Times font, it grabs the first one that it finds and that may not be what you want. Here's something else to try. Notice that your FontPath list includes 75dpi, 100dpi and miscellaneous fonts in both a regular version and an unscaled version.
/usr/X11R6/lib/X11/fonts/75dpi:unscaled
/usr/X11R6/lib/X11/fonts/75dpi
Try putting the unscaled fonts at the top of the list instead of their scaled counterparts; you may be pleasantly surprised. In fact, consider removing the scaled fonts from the list entirely. Stop and start your font server on port 7101, then launch X. When you are happy with the results, you can migrate those changes to your real xfs configuration file.
That pretty much covers my allocation of electrons for now, so I am going to pause here. Next time around, we'll concentrate specifically on TrueType fonts. I'll tell you where you can get them and how to work with them. I may even have to mention that other OS and square away a few things. In the meantime, remember that beauty is more than pixel deep.
Marcel Gagné's book, Linux System Administration; A User's Guide (ISBN 0-201-71934-7, Addison Wesley) is in stores now (including your favorite on-line vendor). You can download a free excerpt from his web site at http://www.marcelgagne.com.
email: mggagne@salmar.com
Realizing the promise of Apache® Hadoop® requires the effective deployment of compute, memory, storage and networking to achieve optimal results. With its flexibility and multitude of options, it is easy to over or under provision the server infrastructure, resulting in poor performance and high TCO. Join us for an in depth, technical discussion with industry experts from leading Hadoop and server companies who will provide insights into the key considerations for designing and deploying an optimal Hadoop cluster.
Sponsored by AMD
Built-in forensics, incident response, and security with Red Hat Enterprise Linux 6
Every security policy provides guidance and requirements for ensuring adequate protection of information and data, as well as high-level technical and administrative security requirements for a system in a given environment. Traditionally, providing security for a system focuses on the confidentiality of the information on it. However, protecting the data integrity and system and data availability is just as important. For example, when processing United States intelligence information, there are three attributes that require protection: confidentiality, integrity, and availability.
Learn more about catching the bad guy in this free white paper.
Sponsored by DLT Solutions
| Dynamic DNS—an Object Lesson in Problem Solving | May 21, 2013 |
| Using Salt Stack and Vagrant for Drupal Development | May 20, 2013 |
| Making Linux and Android Get Along (It's Not as Hard as It Sounds) | May 16, 2013 |
| Drupal Is a Framework: Why Everyone Needs to Understand This | May 15, 2013 |
| Home, My Backup Data Center | May 13, 2013 |
| Non-Linux FOSS: Seashore | May 10, 2013 |
- RSS Feeds
- Making Linux and Android Get Along (It's Not as Hard as It Sounds)
- Using Salt Stack and Vagrant for Drupal Development
- Dynamic DNS—an Object Lesson in Problem Solving
- New Products
- Validate an E-Mail Address with PHP, the Right Way
- Drupal Is a Framework: Why Everyone Needs to Understand This
- A Topic for Discussion - Open Source Feature-Richness?
- Download the Free Red Hat White Paper "Using an Open Source Framework to Catch the Bad Guy"
- Tech Tip: Really Simple HTTP Server with Python
- myip
26 min 42 sec ago - Keeping track of IP address
2 hours 17 min ago - Roll your own dynamic dns
7 hours 31 min ago - Please correct the URL for Salt Stack's web site
10 hours 42 min ago - Android is Linux -- why no better inter-operation
12 hours 57 min ago - Connecting Android device to desktop Linux via USB
13 hours 26 min ago - Find new cell phone and tablet pc
14 hours 24 min ago - Epistle
15 hours 53 min ago - Automatically updating Guest Additions
17 hours 1 min ago - I like your topic on android
17 hours 48 min ago
Enter to Win an Adafruit Pi Cobbler Breakout Kit for Raspberry Pi

It's Raspberry Pi month at Linux Journal. Each week in May, Adafruit will be giving away a Pi-related prize to a lucky, randomly drawn LJ reader. Winners will be announced weekly.
Fill out the fields below to enter to win this week's prize-- a Pi Cobbler Breakout Kit for Raspberry Pi.
Congratulations to our winners so far:
- 5-8-13, Pi Starter Pack: Jack Davis
- 5-15-13, Pi Model B 512MB RAM: Patrick Dunn
- 5-21-13, Prototyping Pi Plate Kit: Philip Kirby
- Next winner announced on 5-27-13!
Free Webinar: Hadoop
How to Build an Optimal Hadoop Cluster to Store and Maintain Unlimited Amounts of Data Using Microservers
Realizing the promise of Apache® Hadoop® requires the effective deployment of compute, memory, storage and networking to achieve optimal results. With its flexibility and multitude of options, it is easy to over or under provision the server infrastructure, resulting in poor performance and high TCO. Join us for an in depth, technical discussion with industry experts from leading Hadoop and server companies who will provide insights into the key considerations for designing and deploying an optimal Hadoop cluster.
Some of key questions to be discussed are:
- What is the “typical” Hadoop cluster and what should be installed on the different machine types?
- Why should you consider the typical workload patterns when making your hardware decisions?
- Are all microservers created equal for Hadoop deployments?
- How do I plan for expansion if I require more compute, memory, storage or networking?



Comments
Re: using Xfs
Hey, I do! Rather than going through all the bs to enact the Font Deuglification Howto on several machines, I point the other X terminals to my machine (where all the cool fonts live) and then default to whatever Redhat puts in their configurations. It's a great patch, and if I'm off installing new hardware or messing with my machine, it's still able to run, albiet not quite as pretty.
These days people are using fractions of a Gig of ram and running P3 machines and faster...xfs is a tiny TINY hit to my resources, and it makes sense to spread the wealth around without going to all the extra trouble.
To combat real resource hogging, I got rid of Netscape and Java...even on "UT breaks" during the day when I stop what I'm doing (without closing anything) and go kill things, I never see more than 512M used. I don't know what I'd do with a full Gig if I still had it installed!
Don't be too hard on the guy; you and I might be old hands at this, but when people take the time to teach newbies, it's better for everyone. I wish I had the time and/or opportunity to do it, myself.
Re: Is Beauty Only Pixel Deep?, Part 2
All these discussions will soon be obsolete.
If you follow the work done on XFree, you'll know that the problems with fonts are well known. A solution has been launched since last year. Since CVS after 4.2.0, XFree now use fontconfig, which replaces all the ancient font system, which was mostly poor hacks.
The only problem now, is for TrollTech to adapt their qt lib and the Gnome guys to adapt their pango lib, so that they can work with fontconfig.
However, they do not seem to do anything about it right now...
Re: Is Beauty Only Pixel Deep?
The fact that an article, or in this case, a series of articles are needed to explain how to make fonts look good in Linux indicate that there is a real problem with the current system's useability! I love Linux. I am known as the Linux zealot at the office. However, this is one thing that really needs to be fixed. Like it or not, Linux is becoming more mainstream. I consider myself to be a rather advanced Linux user and even I am intimedated by XFree86. When will fonts just work "out of the box" without all of this extra crap to get it working? I know KDE has everything working, but Netscape and the Gimp always look like crap on my system, basically because I'm too lazy to spend a couple of hours reading documentation on how to fix it. I do have a life and plenty of other things to do!!! Hopefully someone will step up to the plate and fix this problem once and for all! Until then, Linux on the desktop will continue to be a distant dream.
-- tale
Xft/XRENDER
Surely all the old server-side font stuff is obsoleted by the much better designed Xft/XRender combo?
Personally, I deliberately cut my legacy 1-bit fonts FontPath down to almost nothing and
just use Xft/Xrender .
Re: Fonts and the common guy
All said and done, if there is a solution to getting Linux fonts to look great, the packaging Siegfrieds and Roys should do it and fast. I don't care if it is XFS or 75 dpi or whatever... All I want is nice fonts... everywhere! Just like there are nice icons for KDE, Gnome etc. that people are developing, let us have a nice effort for getting the font problem fixed.
Re: Fonts and the common guy
Indeed. The whole area of font rendering seems to be one thing that the distro makers always either ignore or screw up. (I must see what the differences are between RH6.x and RH7.x, for example, to see if it's the former or the latter.)
Re: Is Beauty Only Pixel Deep?, Part 2
In Debian I have to specify which vt to run the new instance of X on - ie
startx -- :1 vt8
or it doesn't work. It's trying to start on vt7 and finding that already in use won't start another X session. Otherwise good article.
david sowerby
Re: Is Beauty Only Pixel Deep?, Part 2
try this :
startx -- :2
Re: Is Beauty Only Pixel Deep?, Part 2
Interesting article, but everything I tried on RH7.2 (exactly word for word as the author described) did not make true type fonts go here. I even used gpm to cut and paste stuff out of the article into the bash window. Does not go. True type fonts don't work on RH7.2. They just don't. Good try and thanks for the article, but it just doesn't work. Tried restarting xfs, shutting down/restarting X (both logging out/in and also powering off/on). Doesn't go.
Re: Is Beauty Only Pixel Deep?, Part 2
An easy way is to add Microsoft's true type fonts from the internet using the included script "fetchmsttfonts". Web pages, which these fonts are for, will look much better after you do that. Don't forget to press q when the license agreement is piped through less!
Re: Is Beauty Only Pixel Deep?, Part 2
Yes they do. Copy your TT fonts to your TT font directory (like /usr/share/fonts/truetype for example, or perhaps some other directory you've set up for this... just make sure the directory is listed in your xfs config file... /etc/X11/fs/config... if it's not, add it), then as root, change to that directory and run these two commands:
ttmkfdir -o fonts.scale
mkfontdir
These will create the two font information files, "fonts.scale" and "fonts.dir", in the directory. Once you've done this, restart your xfs server ("service xfs restart"), log out of root, fire up X and enjoy your fonts.
Re: Is Beauty Only Pixel Deep?, Part 2
I still don't get why I need the font server,
as I can't use it in modern X setups with
antialiased fonts anyway. Or can I?
What I mean is that the /etc/X11/XftConfig
specifies font directories on local disk anyway.
E.g dir "/usr/X11R6/lib/X11/fonts/Type1"
Or is there some way to use fonts from a
font server here?
Re: Is Beauty Only Pixel Deep?, Part 2
I love the topic!
Unfortunately, my experiments didn't succeed (on Mandrake 8.2). My xlsfonts doesn't take a -server option. A discussion of the -display option to xlsfonts would be useful...
- Chuck
Re: Is Beauty Only Pixel Deep?, Part 2
That's because Mandrake uses a different port as a check of the XF86Config-4 file would reveal. fslsfonts -server unix/:-1 works for me.
Re: Is Beauty Only Pixel Deep?, Part 2
Time and again have I tried to use 100dpi fonts, rather than 75dpi ones, and have always returned to 75dpi. The 100dpi fonts look ugly as hell - they are way too large, take up too much room, and get generally in the way, in all the boxes I have access to, from 800x600 at 75dpi all the way up to 1600x1200 at 112dpi.
This, together with the purported benefits of anti-aliased fonts, is one of those spurious fads that plague this industry.
Re: You did it a wrong way
You should choose a 100dpi resolution for your display, not 100dpi fonts at 75dpi (which makes them look ugly and bigger). The 100dpi fonts at 100dpi have the same size as the 75dpi fonts at 75dpi.
I also used 110dpi resolution, which looked as good as 100dpi. Have you installed 100 dppi fonts?
I never used the AA fonts, because switching display resolution to 100dpi makes fonts enough good looking (not worse that TTF fonts in MS Windows). And it works in all applications (GTK, X native, Open Office).
Chris
PS. MS Windows used 96dpi by default regardless resolution or display size. Why not do the same with X?
Re: Is Beauty Only Pixel Deep?, Part 2
This is quite a useless article. These things have been covered years ago in the Font deuglification HOW-TO. I don't understadn why I would use two instances of xfs on my computer, anyway.
Re: Is Beauty Only Pixel Deep?, Part 2
This is quite a useless article. These things have been covered years ago in the Font deuglification HOW-TO.
You obviously know a lot about this. So why are you reading for-beginners articles? I'm still learning my system and learnt a few things here.
I don't understand why I would use two instances of xfs on my computer, anyway.
So you can muck about with the second font server without stuffing up your usual one. I think this is the only reason the author did it.
Re: Is Beauty Only Pixel Deep?, Part 2
Not to take away from Marcel's nice work, but he never really answered the core question - why run xfs by default? The majority of us are not sharing font servers, and never will. Its a waste of my system resources to fire up xfs when all you need to do is add the paths to your XF86Config-4 file.
And on a related note, if your fonts look ugly when you upgrade to RH 7.3 try setting the DPI for your monitor by adding the DisplaySize command to the XF86Config-4 file in the Monitor section. The width and height are specified in mm and allow the X (server/client?) to figure out the correct DPI setting.
Before doing this my fonts in AbiWord, etc. Looked streched on my 19" monitor. They had been looking fine in RH 7.2
Resist the urge to clutter up your running system with unneeded apps like xfs (and all the garbage that KDE and GNOME start, but more on that from me later).
Brian
Re: Is Beauty Only Pixel Deep?, Part 2
Another reason I can think of for running xfs is if, heaven forbid, there's a bug that causes xfs to quit then your X server will just hang. It's a simple matter to rectify that by flipping across to a vt and restarting xfs, allowing you to carry on where you left off.
Assuming the X server and xfs use largely the same code to render fonts, if this happened without the X server using xfs, the X server would abort, taking your applications with it.
That's usually a Bad Thing.
Re: Is Beauty Only Pixel Deep?, Part 2
Once I asked the same thing to mharris, the X guy from redhat. He said that using xft keeps X from blocking when rendering fonts. Supposedly if you use non latin fonts, X will briefly lock up while rendering them (watch for mouse stalls). xft keeps this from happening.
That said, I've never had a problem with it (possibly due to the uncomplicated fonts I use), and prefer not to use xft. So while I agree with your preference to not use it, do realize that xft is necessary for redhat's distro to perform well in all settings.
Re: Is Beauty Only Pixel Deep?, Part 2
This is precisely correct. Obnoxious font rendering requests are effectively a (often inadvertent) DoS in X. This includes rendering Asian fonts and rendering large fonts (as in the recent Mozilla style-sheet DoS). Running xfs, it is a simple matter to set limits on the font server that differ from the X server, including RAM, CPU, etc.
Re: Is Beauty Only Pixel Deep?, Part 2
Indeed. A recent example of why separation of font rendering from X rendering is at:
"X-windows remote DoS with big fonts"
http://www.theregister.co.uk/content/55/25689.html
Those folks with xfs just restart xfs and move on. Those with internal font rendering generally end up with a runaway X server.