# XFree anti-aliased font tips

## kerframil

EDIT: 16/12/2002. Two things - firstly, since the ebuild of XFree86 4.2.1 turned up, people have been noticing that Keith Packard has made some changes in the font management system, most noticeably the introducing of fontconfig. Although, this thread still makes very interesting reading, much of it is out-of-date. Please do not follow the examples given on configuring the XftConfig file. I have had time to look into the matter, and will be issuing a revised version of this guide soon, which will take into account the usful things others have pointed out too.

Secondly, some good news. David Chester (of the famed Xft slight patch) has succeeded in moving his excellent font engine patches into the heart of freetype itself. This looks to herald a significant development in the rendering of fonts in X. Just to show you how much, have a look at the two following links, one shows OpenOffice with and without his patch:

http://www.cs.mcgill.ca/~dchest/xfthack/oo-before.png

http://www.cs.mcgill.ca/~dchest/xfthack/oo-slight.png

Even better, this patch has been integrated into the new freetype-2.1.3 which is still masked. I am still testing this new engine, and will submit the new guide for all things font related soon. I'd be most pleased if others who don't mind living on the cutting edge could try it out too. You may need to re-build XFree afterwards to take full advantage of it ..!

This subject seems to cause a lot of confusion, so I'm passing on what I know as I have been getting very good results with font rendering on my system. From reading some of the posts in this forum, one could be forgiven for thinking that it's a lot harder than it actually is. I will not be going too deeply into the following topics (as there are many resources and postings on this forum already about such topics):

* Generating scale files for font directories

* Obtaining and installing Truetype font collections

* How to get best results from apps that don't play ball with Xft properly (yet)

What I am concentrating on here is how to configure Xft to anti-alias your chosen font sets, and optimising them for very nice display on your screen.

Firstly, a glossary:

Freetype: a font processing/rendering engine capable of rendering Adobe Type1 (postscript) and TrueType fonts. For X to display truetype fonts, Load "freetype" should be present in your XF86Config file.

XF86Config: XFree86 configuration file, font paths should be specified here (normally contained under /usr/X11R6/lib/X11/fonts) for X to be able to make your fonts available

Xft: Keith Packard's contribution to the XFree86 4.x series. Takes advantage of his "direct render extension" (also present in the 4.x series) for displaying fonts. It is built from Freetype2 code which is distributed with X (so it if you have emerged freetype it makes no difference to X font rendering). It is capable of rendering anti-aliased fonts, but configuration is required. The library is called libXft.so.

Xftconfig: the configuration file for the Xft library (libXft).

XFS: The X Font Server. A stand-alone font rendering system which X uses via a TCP socket. PLEASE NOTE: This isn't really needed now we have Xft (at least not unless you want your X Server to use a font server on a different machine), and is not used by default. Xft should be faster and more efficient.

XAA: X Acceleration Architecture. Attempts to take advantage of video hardware capabilities for accelerating the rendering of graphics (beyond simple blitting operations). Xft tries to take advantage of this where possible.

Bytecode interpreter/patent issue: Apple holds patents on Truetype rendering technologies. Use of a bytecode interpreter improves rendering of fonts at small sizes so they look as the designer intended. Because of the murky patent issue, the interpreter is normally disabled. In Gentoo however, it is enabled in freetype - both for X and for separately emerged freetype  :Smile: 

Prequisites:

* Preferably run XFree86-4.2-r11 or higher (r11 and higher comes with freetype-2.0.9 which is an improvement upon the earlier builds)

* Make sure you have some TrueType/Type 1 fonts. XFree build should automatically give you a reasonable selection under /usr/X11R6/lib/X11/fonts/Type1 and /usr/X11R6/lib/X11/fonts/truetype respectively.

* Make sure you have Load "freetype" and Load "Type1" directives specified in your /etc/X11/XF86Config file, somewhere in the Section "Module" part.

* Make sure your fontpaths are specified in XF86Config otherwise X will not see them. They go in the Section "Files" part. Example:

```
Section "Files"

# Other stuff ...

    FontPath   "/usr/X11R6/lib/X11/fonts/truetype"

    FontPath   "/usr/X11R6/lib/X11/fonts/Type1"

# Other stuff ...

EndSection
```

* Make sure font scaling files have been generated for the collections in those subdirectories. They should be, unless you have manually obtained fonts and put them in a given subdirectory.

* Make sure X is running with the direct render extension enabled. It will by default, if it isn't then it could be a limitation of your X Server (i.e. the video card driver).

In practice, very few modifications will have to be made to a default XFree86 installation on a Gentoo system. Having gotten that out of the way, it's quite simple:

* /etc/X11/Xftconfig will need to have the fontpaths specified, otherwise Xft will not anti-alias them properly, or at all.

* Specify pixel/font size ranges for X to anti-alias so that X doesn't gratuitously anti-alias fonts all the time. This is why some people complain that fonts look fuzzy on Linux, it doesn't have to be this way.

In my case, the only thing I did was to edit my Xftconfig file and add these trivial modifications:

```
# Render all fonts in these paths anti-aliased

# Note that Xftconfig uses dir, not FontPath

dir "/usr/X11R6/lib/X11/fonts/Type1"                                            

dir "/usr/X11R6/lib/X11/fonts/truetype"    

# There's no need for fonts to be anti-aliased at "normal' sizes,

# they cause eyestrain and don't really enhance the fonts. Tell Xft

# not to anti-alias fonts between 8pt and 14pt sizes

match

   any size > 8

   any size < 14

edit

   antialias = false;

# Same again, but enforced for KDE (specifically Konqueror/KHTML)

match

   any pixelsize > 8

   any pixelsize < 14

edit

   antialias = false;
```

Lo and behold, reboot X and the fonts should look great! Very nearly as good as certain other commercial operating systems. Try visiting http://www.microsoft.com for example, and compare it to how it would look before (at least it was a radical difference under Konqueror). Note that Xftconfig allows for many more powerful features such as font substitution, great if you cannot change the fonts used by some apps but you want to use a font that you know to look better on screen. You should experiment with various fonts, and configure your window manager to use the ones that look best.

Here's a link that describes further some of the ways in which you can customise Xftconfig (thanks to a post by mksoft): http://dot.kde.org/989808269/addPostingForm

The XFree86 Font Deuglification HOWTO also makes a good read, particularly this page:

http://www.tldp.org/HOWTO/mini/FDU/x-4x.htmlLast edited by kerframil on Mon Dec 16, 2002 12:09 pm; edited 1 time in total

----------

## mb

great   :Shocked: 

one question.... i tried to activate sub-pixel hinting on my notebook... but the result looks like the last shot in: http://www.xfree86.org/~keithp/render/clear.html

some blue margin... all in all ugly... so.. whats wrong ?? i thing the shot above should be the real result....

#mb

----------

## kerframil

I'm assuming you entered a line such as:

```
match edit rgba=rgb
```

Note to casual viewers: This enables sub-pixel sampling which can improve the legibility of text on LCD screens. Micro$oft call it ClearType technology <snigger>.

Anyway, my advice would be to try changing the rgb bit to any of bgr, vrgb, or vbgr. Find out which one looks best for you out of those four options.

----------

## tgnb

i have these files:

/etc/X11/XftConfig

/usr/X11R6/lib/X11/fonts/truetype/XftConfig

/usr/X11R6/lib/X11/XftConfig

Which one should i edit?

What do the other ones do? Are they just left over from upgrading?

When you say u "add rivial modifications" to the file, did you add those to the bottom of the XftConfig file or do you edit stuff inbetween?

What do the .xftcache files do?

How does all this come to play with mozilla's unix.js file?

Thanks

----------

## kerframil

 *Quote:*   

> i have these files: 
> 
> /etc/X11/XftConfig 
> 
> /usr/X11R6/lib/X11/fonts/truetype/XftConfig 
> ...

 

Make your changes in /etc/X11/XftConfig. As far as I can see, the contents of this file just get "mirrored" (copied) to /usr/X11R6/lib/X11/XftConfig. Alternatively, you can create a file called .xftconfig in your home directory and put your desired changes there. Why do this? Because individual user preferences can be established, rather than forcing all users to have a certain configuration. If you look at /etc/X11/XftConfig you'll see a line:

```
includeif "~/.xftconfig"
```

If the file exists in your home directory it will get sourced.

 *Quote:*   

> What do the other ones do? Are they just left over from upgrading?

 

As far as I can tell, if a font path is scanned (say, because you put it in /etc/X11/Xftconfig), and one of those paths contains an XftConfig file (such as the /usr/X11R6/fonts/truetype/XftConfig file to which you refer), then that instance will override the master XftConfig file. I had a look at the one in the truetype directory, and the first line is:

```
DIR "."
```

which means add the fonts in the path of the directory we're in at the moment. You might think why do we have to do that, if we already specifed the path of the truetype fonts in the master XftConfig file? Well, I think it's because it overrides rather than inherits the master file. The remainder of the file tells the font engine what to call the fonts, and what the actual filenames for the truetype fonts are (the .ttf files).

I'm glad you mentioned this because when I looked closer I found that the anti-aliasing (using the modifications I described) wasn't actually working on the truetype fonts properly. The Type1 fonts look really nice, but the Truetype ones looked jagged at large sizes. So I realised that you have to add the antialiasing directives to /usr/X11R6/lib/X11/fonts/truetype/XftConfig as well! Edit that file and add just the match directives for anti-aliasing. Let me be clear about that, edit that file and add just the following, at the bottom:

```
match 

   any size > 8 

   any size < 14 

edit 

   antialias = false; 

match 

   any pixelsize > 8 

   any pixelsize < 14 

edit 

   antialias = false;
```

I did this after reading your post, then I went to the KDE Font control panel. I chose Times New Roman (Ms) and previewed it at a very large size and a very small size - wow ... it looked absolutely fantastic in all cases!  :Very Happy: 

Before, it looked very jagged. I'm grateful that you (inadvertantly) brought this to my attention! CONCLUSION: If a font path contains its own XftConfig file, then make sure you put the "match" directives into that file also, otherwise the anti-aliasing rules will be ignored!

 *Quote:*   

> When you say u "add rivial modifications" to the file, did you add those to the bottom of the XftConfig file or do you edit stuff inbetween?

 It seems you can put them anywhere you like, top or bottom. Just make sure they're in there and that you don't remove the other stuff in the file. Having said that, I put the "dir" paths at the top, and the "match" stuff at the bottom. Sorry, I know I could have just quoted the whole file but I wanted to keep the post concise!

 *Quote:*   

> What do the .xftcache files do?

 

Well you could type man xftcache and find out  :Wink: 

It says "a cache is created which contains properties of each font and the associated filename. This cache is used to speed application startup when using the Xft library". So it's a performance enhancing feature, but has no effect on the nature of anti-aliasing/rendering. If you type xftcache at the console with no parameters, it will read your master XftConfig file and create a cache for all of the font paths referenced. Recommended then, for speed purposes!

I hope all that makes sense. I'll update the Tips above when I get a chance, adding what we've learnt here ...

 *Quote:*   

> How does all this come to play with mozilla's unix.js file?

 

Sadly, I am not qualified to answer that yet! I'll have to emerge it and have a go. There have been quite a few posts about this, search the forum and see what you can dig up. I know some people have been saying don't use XFree-4.2.0-r11 because older builds of Mozilla don't play ball with the new libXft based on freetype-2.0.9. Personally, if that's the case, I'd rather wait until Mozilla gets updated rather than limit X capabilities for the sake of one or two programs. But as I say, I'm not sure and need to learn more myself. I don't even have it emerged yet, so I'll check it out and see what I can do. If anyone has a comprehensive answer to this question, please tell me so that I can update my post. Too much of this important info is getting buried in the dark recesses of the forums ...  :Sad: 

----------

## amigadave

kerframil, it seems as though - by making the additions to /usr/X11R6/fonts/truetype/XftConfig - Mozilla's fonts look perfect again!  :Very Happy: 

Thanks so much for this great tip as I couldn't stand the yucky small anti-aliased fonts.

----------

## TheWart

thanks a ton for this tip, it is very thorough and in depth...now my fonts wont make me go blind!  :Smile: 

----------

## g2boojum

It would be great to have the font info as a guide doc on the Gentoo site.  The Gentoo guide xml is pretty straightforward, and I would be happy to add it to the site.

-g2boojum-

----------

## dook43

I happened to quickly browse through all of my config files and they all emerged to correctly be set.  I have some truetype fonts in the correct directory, now how do I choose them in gnome (sawfish configuration)

----------

## jay

Also remember to use the the new  iso8859-15 fonts instead of the old iso8859-1 ones. These will work properly with the new characters i.e. for the Euro symbol: 

----------

## jtmace

i installed gentoo..  emerged KDE and Mozilla and other common apps. 

Konqueror renders fonts beutifully but Mozilla applies no antialiasing what-so-ever. Is there a way to fix this or does Mozilla just no work with anti-aliasing? Thanks

----------

## Lovechild

 *kerframil wrote:*   

> I'm assuming you entered a line such as:
> 
> ```
> match edit rgba=rgb
> ```
> ...

 

You made my day, I now have a new project to take on - Gentoo on my laptop, and try this out  :Smile: 

----------

## Ian Goldby

As far as I can see, /etc/X11/XftConfig is not used at all. The actual settings are taken from /usr/X11R6/lib/X11/XftConfig. (I came to this conclusion after hiding the two files in turn and restarting X. Note though I don't use antialiasing size-dependent rules.)

Since I want /usr/X11R6/lib/X11/XftConfig to be backed up when I backup /etc/, I've made a symlink from /etc/XftConfig to it, but apart from that, there seems to be no reason to have a file called /etc/XftConfig.

(By the way, I perceived a loss of smoothness and some inconsistencies in stroke-weight after I upgraded from XFree86-4.2-r9 to XFree86-4.2-r12. I went back to r9 as a consequence. Did anyone else notice this? If so, can I fix it?)

----------

## kerframil

 *Quote:*   

> 
> 
> As far as I can see, /etc/X11/XftConfig is not used at all

 Oh but it is! Making changes to that file will alter the configuration accordingly. Otherwise the implication would be that it does nothing and that it's existence is pointless which seems rather unlikely and surely would have generated many topic replies to this end (and even more comments to the XFree86 team). Furthermore, the changes I made to my default setup were performed exactly as I stated and had the desired effect. At no point did I edit the XftConfig file under the X11 directory.

I suspect it would use the file from the X11 directory in the absence of one in the etc directory, but preference would be given to the latter. If you actually add the rules in question (or anything that results in an obvious visual change), I believe your results will support my assertion. Nonetheless I shouldn't make any assumptions so I will try some similar tests myself and see what happens (maybe it is a symlink and I didn't notice?) ...

 *Quote:*   

> (By the way, I perceived a loss of smoothness and some inconsistencies in stroke-weight after I upgraded from XFree86-4.2-r9 to XFree86-4.2-r12. I went back to r9 as a consequence. Did anyone else notice this?

 

Perhaps this is because the Xft slight patch (as it is known) is no longer applied in the build? Not so long ago I fiddled around with a pre-compiled libXft from an RPM that was intended for Mandrake. This resulted in superior strokes and weighting, and significantly improved the anti-aliasing effect. For some reason it was removed if I recall correctly. Check the ebuild files to confirm this. The author, David Chester, is intending to move his hack into the Freetype library, ostensibly so that more applications can take advantage of it. Here is his homepage:

http://www.cs.mcgill.ca/~dchest/xfthack/

Here is a shot which shows why his efforts may be a very good thing[tm] for us all (his hack is reflected in the third column of text):

http://www.cs.mcgill.ca/~dchest/abc-shint.png

An interesting characteristic of his hack is that it relies on the bytcode intepreter being disabled. One would assume that fonts rendered at small sizes suffer, but this is clearly not the case.

This is yet another thing on my list of things to look at, and has been for a while. There shouldn't be any reason why you can't get the patch and make your own modified XFree86 ebuild where the patch is applied, and the lines patching the bytecode interpreter in the bundled Freetype (with sed) are removed. If you do try this, do me a favour and let me know what your results are! Or just use the libXft.so in the RPM, but bear in mind that it is compiled for i586 arch only ...

jtmace said:

 *Quote:*   

> Konqueror renders fonts beutifully but Mozilla applies no antialiasing what-so-ever. Is there a way to fix this or does Mozilla just no work with anti-aliasing?

 

Yes it does, but the situation with Mozilla and anti-aliasing is certainly convoluted (if you look under /usr/portage/net-www/mozilla/files, you will see lots of font related patches, only one of which is used in the latest build). Hang in there, information on this will be forthcoming!!! In the meantime, see if swaun's tip works for you (from this post):

https://forums.gentoo.org/viewtopic.php?t=5630

----------

## kerframil

 *Quote:*   

> I happened to quickly browse through all of my config files and they all emerged to correctly be set. I have some truetype fonts in the correct directory, now how do I choose them in gnome (sawfish configuration)

 

Sorry, I don't use Gnome (I'll look at it when they finish Gnome2). Perhaps you would have more luck asking this question in the Desktop Environments forum area. BTW, anti-aliasing only works in Gnome2 (unless you are using some kind of hacked GTK library).

----------

## pbienst

I tried the tips to turn off aliasing for small and big fonts, and it works.

However, now I want to revert to the original behaviour, so I deleted the corresponding lines from /etc/X11/XftConfig and /usr/X11R6/lib/X11/XftConfig. I ran xftcache, restarted the X server, but the changes don't seem to take effect, small fonts are still unaliased.

Any ideas?

----------

## kerframil

UPDATE: OK, I'm testing Mozilla and the font rendering is disgusting! I have found out that Keith Packard's Xft patch is required. As I have already mentioned, such a patch is included in the Portage tree but has been commented out from the build because it requires a newer build of XFree86 (higher than 4.2). Why? Because Xft has been significantly revamped apparently, and the patch for Mozilla is for the new Xft. Have a look at:

http://keithp.com/mozilla/

So, I am going to look at three possible approaches:

1) Test the latest XFree86 code from CVS (4.2.99, I think) and if it seems stable, make an ebuild. Then it should simply be a matter of uncommenting the relevant patch lines in the Mozilla ebuild and font rendering should be as good as Konqueror.

2) It may be possible to download the latest Xft source code specifically, and to patch that into the regular XFree86 4.2 build process. In other words, replace the sub-directory in the unpacked source code which contains the Xft code.

3) I think there is a pre-built version on the link I've given (which is optimised for i686). That might be a nice candidate for an ebuild, especially for those who do not want to go through the lengthy process of compiling Mozilla (HINT: anyone want to try this out?)

The new Xft is supposed to be so much better. I really hope that David Chester gets Freetype hacked soon because this should hopefully put a stop to this issue of applications having to specifically support Xft.

 *Quote:*   

> However, now I want to revert to the original behaviour, so I deleted the corresponding lines from /etc/X11/XftConfig and /usr/X11R6/lib/X11/XftConfig. I ran xftcache, restarted the X server, but the changes don't seem to take effect, small fonts are still unaliased.

 

Not sure, I haven't been able to re-produce this behaviour. Are you using KDE/Qt? Try running qtconfig and ensuring the relevant tickboxes are disabled in the font configuration, as well as turning off the anti-aliasing tickbox in the KDE Control Center. Make sure you don't have a personalised config file in your home directory (.xftconfig) which may be getting sourced and overriding the settings.

----------

## djresonance

Hi, I've been battling with this problem for the past couple days.  For some reason unbeknownst to me, X has started displaying my truetype fonts squished along the horizontal axis.  It's hard to describe, so take a look at this screenshot from gEdit:

http://www.resynthesize.com/Screenshot.png

It is only the truetype fonts that look like this, the regular fonts that come with gnome/X look fine.  I've tried everything I can think of so far, completely removed the truetype fonts directory and recreated it, rebooted my workstation, etc... with no avail.  It's not just the microsoft TTf's, for instance luxi mono looks all squished as well.   

Has anyone seen this problem before?  I've looked all over the web and haven't been able to find anything.  I'm bashing my head against the wall and may just trash my whole install if I can't get it fixed. 

Thanks,

Brandon

----------

## wilbertnl

My compliments for such detailed information!

I just first started looking at anti-aliasing when gnome-2 was released. Why did I settle with less before??? 

At first I was confused, because it is my understanding that you need a font server running to get the truetype fonts working.

But you were not talking about ttf, but about anti-aliasing.

Is my understanding right that I need to start the xfs service to get the truetype fonts activated?

----------

## zojas

on my laptop the "match edit rgba=rgb;" in /etc/X11/XftConfig made a world of difference! my laptop fonts look almost as good as my desktop fonts now.

 *kerframil wrote:*   

> I'm assuming you entered a line such as:
> 
> ```
> match edit rgba=rgb
> ```
> ...

 

----------

## Ian Goldby

 *wilbertnl wrote:*   

> At first I was confused, because it is my understanding that you need a font server running to get the truetype fonts working.

 

You're doing well to be only confused 'at first' 8-) I thought a font-server was obligatory to use fonts, and that Xft (incorporating the freetype renderer for doing all that nice antialiasing for truetype fonts) was the one used by Gentoo. I guess that's not true...

I wonder if someone could provide a sketch of the Linux/X font architecture (and any Gentoo-specific stuff), because I'd love to know how all the bits fit together. In particular, I'm baffled as to why some X applications (such as KDE) get beautiful antialiased truetype rendering, others like Mozilla get antialiasing but not as good, and others like GIMP and xfontsel can't even seem to see truetype fonts at all. If anyone can tell me how to fix this, that would be great too.

----------

## Larde

Just as a small tip for people who experienced getting their fonts trashed with AA on and scrolling around in Mozilla (it looked like this on my system):

I changed the display resolution setting in Mozilla from "System Setting" to 96dpi. This totally solved my problem (which I only had with one of two machines).

----------

## wilbertnl

 *iangoldby wrote:*   

> In particular, I'm baffled as to why some X applications (such as KDE) get beautiful antialiased truetype rendering, others like Mozilla get antialiasing but not as good, and others like GIMP and xfontsel can't even seem to see truetype fonts at all. If anyone can tell me how to fix this, that would be great too.

 

Ehm... I'm running the XFS font server and here and now all the Microsoft Truetype fonts are available in xfontsel and Gimp.   :Rolling Eyes: 

I'm not a KDE user, but to me, Mozilla looks much better after I implemented the tip in this thread. Maybe XFS is worth giving a try?

----------

## Ivan Zenkov

Good manual on this subject - Good-looking fonts in X Windows

----------

## arkmch

 *kerframil wrote:*   

> 
> 
> ```
> 
> # There's no need for fonts to be anti-aliased at "normal' sizes,
> ...

 

Maybe this is a bug in my KDE installation, but I found that size is not the same as pixelsize. I got much better results in Konqueror with these settings:

```

# There's no need for fonts to be anti-aliased at "normal' sizes,

# they cause eyestrain and don't really enhance the fonts. Tell Xft

# not to anti-alias fonts between 8pt and 14pt sizes, and bold fonts

# between 8pt and 10 pt sizes.

match

        any size > 8

        any size < 15

edit

        antialias = false;

match

        any size > 10

        all weight == bold

edit

        antialias = true;

# Same again, with some fine-tuning, enforced for KDE (specifically

# Konqueror/KHTML) 

match

        any pixelsize > 8

        any pixelsize < 18

edit

        antialias = false;

# Verdana should also be antialiased at 17pts

match

        any family == "Verdana"

        any pixelsize = 17

edit

        antialias = true;

# Times New Roman Italic doesn't look good antialiased at larger sizes

match

        any family == "Times New Roman"

        all slant == italic

        any pixelsize > 15

        any pixelsize  < 20

edit

        antialias = false;

# Bold fonts

match

        any pixelsize > 12

        all weight == bold

edit

        antialias = true;

```

----------

## pjp

As far as I can tell, following these instructions hasn't helped.  I saw this link:

 *Ivan Zenkov wrote:*   

> Good manual on this subject - Good-looking fonts in X Windows

 However, in comparing two images, I think the After image looks more fuzzy 

than the Before image.

----------

## delta407

That's the idea, kanuslupus. Anti-aliasing uses partial pixel shading to reflect the fact that lines and curves don't line up on pixel boundaries, so it's supposed to be not as crisp as the standard on/off mode.

----------

## pjp

 *delta407 wrote:*   

> That's the idea, kanuslupus. Anti-aliasing uses partial pixel shading to reflect the fact that lines and curves don't line up on pixel boundaries, so it's supposed to be not as crisp as the standard on/off mode.

 Oh... I thought it was supposed to improve them  :Wink: 

----------

## Naan Yaar

Actually, the screenshots are a bit dubious.  The fonts used are totally different and I cannot see how you can really do a fair comparison  :Smile: 

Antialiasing works nicely at larger point sizes.  I use it for fonts > 18pts.  For smaller sizes, AA makes things fuzzy, at least as implemented in Xft+freetype.  If you look at AA'd lower case "k"s, upper case "M", "W", etc., the slanted strokes look awfully thin and bad.

 *kanuslupus wrote:*   

>  *delta407 wrote:*   That's the idea, kanuslupus. Anti-aliasing uses partial pixel shading to reflect the fact that lines and curves don't line up on pixel boundaries, so it's supposed to be not as crisp as the standard on/off mode. Oh... I thought it was supposed to improve them 

 

----------

## Ian Goldby

 *Naan Yaar wrote:*   

> Antialiasing works nicely at larger point sizes.  I use it for fonts > 18pts.  For smaller sizes, AA makes things fuzzy, at least as implemented in Xft+freetype.  If you look at AA'd lower case "k"s, upper case "M", "W", etc., the slanted strokes look awfully thin and bad.
> 
> 

 

Something happened to the antialiasing between XFree86-4.2-r9 and XFree86-4.2-r12 to screw up rendering of characters such as lower-case 'k', as you say. For this reason, I'm sticking with r9 until it is fixed. I don't have a comparison screenshot showing r12, but here is what it looks like with r9 (80kB png):

http://homepage.ntlworld.com/ian.goldby/misc/konqantialias.png

Very nice, IMO. Note the 'k' of 'Bookmarks'.

----------

## metalhedd

 *iangoldby wrote:*   

> 
> 
> Something happened to the antialiasing between XFree86-4.2-r9 and XFree86-4.2-r12 to screw up rendering of characters such as lower-case 'k', as you say. For this reason, I'm sticking with r9 until it is fixed. I don't have a comparison screenshot showing r12, but here is what it looks like with r9 (80kB png):
> 
> http://homepage.ntlworld.com/ian.goldby/misc/konqantialias.png
> ...

 

What is with those Hollow looking letters?  I dont think "very Nice" would be the words I would use to describe that.  I've been using KDE3/Konqueror and I've never seen fonts as ugly as ANY of the screenshots I've seen in this entire thread. all of my fonts look perfect all the time, I've never applied any hacks, patches or had to edit any config files.  I'm not sure what revision of X i'm running but I last emerged it about a a week ago.

----------

## Naan Yaar

Thanks.  The screenshot you have looks very good.  I really cannot see any bad artefacts (well, maybe the top of lowercase "a"s is a bit fuzzy, but I'm nitpicking  :Smile: )  May be I should revert to 4.2-r9 too!  Looks like you were using verdana too (?)  What font size was this?

 *iangoldby wrote:*   

> ...
> 
> Something happened to the antialiasing between XFree86-4.2-r9 and XFree86-4.2-r12 to screw up rendering of characters such as lower-case 'k', as you say. For this reason, I'm sticking with r9 until it is fixed. I don't have a comparison screenshot showing r12, but here is what it looks like with r9 (80kB png):
> 
> http://homepage.ntlworld.com/ian.goldby/misc/konqantialias.png
> ...

 

----------

## Ian Goldby

Sorry, I should have said. The menu font is Verdana 10. I use Verdana 9 for Kicker (not visible in the shot), which happens to be really crisp.

'metalhedd': I don't know what you mean by 'hollow-looking letters'. I can't see anything that I'd describe that way. I think it does go to show though what a subjective thing font-appearance is. I also wonder how much it may be affected by different monitors. In any case, I'd be very grateful if you ('metalhedd') would post a screen shot of your system. Perhaps we could all have something to learn from you.

Ian

----------

## metalhedd

I stand corrected.  It was the horrible PNG support of netscape navigator for windows.

next time I'm at work I'll see if I can get a screenshot of it.. Its horrible.. the screen shot you showed me looks alot like my system.

I have to use netscape to view all the screenshots cuz MSIE Doesn't support 90% of the PNG images out there.

----------

## Naan Yaar

There is mozilla for Windows, you know  :Very Happy: 

 *metalhedd wrote:*   

> I stand corrected.  It was the horrible PNG support of netscape navigator for windows.
> 
> next time I'm at work I'll see if I can get a screenshot of it.. Its horrible.. the screen shot you showed me looks alot like my system.
> 
> I have to use netscape to view all the screenshots cuz MSIE Doesn't support 90% of the PNG images out there.

 

----------

## metalhedd

Can't install stuff at work...

----------

## kerframil

I'm glad to see this has generated quite a bit of interest. I must apologise for not having gotten involved in the discussion recently (things have been completely hectic lately on all fronts and I've simply had no time to catch up on things in the forums, nor play with things on my Gentoo box - for some reason I haven't been getting notifications for this topic either).

Needless to say, I look forward to digesting the interesting comments that have been made when I get a nice slot of free time.

BTW, there is a DRI mailing list for the Direct Render Infrastructure which covers Xft and so forth. This is a great list to subscribe to for those interested in the topic, and the subscription page can be found here: http://www.xfree86.org/mailman/listinfo/render.

----------

## Ian Goldby

Folks,

This harks back to a previous comment I made that antialiasing is not as good in xfree-4.2.0-r12 as in xfree-4.2.0-r9. See here for a comparison of xfree-4.2.0-r12 as standard, and with the patch.

It is easy enough to modify the ebuild file to include the patch if you want it. The screen shots will help you decide if it is worth it. The patch was present in r9 - the maintainers just commented it out of the ebuild with r12.

 Ian

----------

## wilbertnl

 *jtmace wrote:*   

> i installed gentoo..  emerged KDE and Mozilla and other common apps. 
> 
> Konqueror renders fonts beutifully but Mozilla applies no antialiasing what-so-ever. Is there a way to fix this or does Mozilla just no work with anti-aliasing? Thanks

 

Mozilla works with antialiasing, but you need to tickle it!

The antialiasing is based on a gdkxft library, which actually replaces the mozilla rendering library.

Gentoo doesn't support gdkxft, it's masked. Because it's not working flawless with just any application. I installed gdkxft and activated it only for mozilla and galeon.

It works Great!

----------

## Naan Yaar

Mozilla, as installed out of the box in gentoo (mine is mozilla-1.0-r3 - no tweaks), has antialiasing support that works fine.  It renders a little bit differently from what happens in konqueror, but it seems OK overall.  The unix.js file in the preferences directory seems to set up freetype and antialiasing support by default.  I have used xmag to actually verify that antialiasing does happen in moz  :Smile: 

 *wilbertnl wrote:*   

> 
> 
> Mozilla works with antialiasing, but you need to tickle it!
> 
> The antialiasing is based on a gdkxft library, which actually replaces the mozilla rendering library.
> ...

 

----------

## wilbertnl

 *Naan Yaar wrote:*   

> Mozilla, as installed out of the box in gentoo (mine is mozilla-1.0-r3 - no tweaks), has antialiasing support that works fine.  It renders a little bit differently from what happens in konqueror, but it seems OK overall.  The unix.js file in the preferences directory seems to set up freetype and antialiasing support by default.  I have used xmag to actually verify that antialiasing does happen in moz 

 

Hm, maybe I did something wrong, then, but I noticed a big improvement with the gdkxft trick.

Did you set USE="gtk2" before you compiled mozilla-1.0-r3?

----------

## Naan Yaar

Actually I don't use gtk2 and did not compile mozilla with it.  Something that may be of interest:

http://groups.google.com/groups?q=mozilla+freetype+internal&hl=en&lr=&ie=UTF-8&selm=pan.2002.06.26.20.33.32.968347.450%40SPAM_killall.net&rnum=2

----------

## wilbertnl

 *Naan Yaar wrote:*   

> Actually I don't use gtk2 and did not compile mozilla with it.  Something that may be of interest:

 

The newsgroup post is clear. Mozilla doesn't render as pretty as straight xft or even gdkxft. They refer to nightly builds in rpm format, I would like to get the patches itself!!

----------

## Naan Yaar

I turn off AA below 18pts anyway.  For the sizes I am interested in, mozilla seems to be doing a credible job.  At smaller point sizes, freetype itself seems to have problems with rendering diagonal strokes correctly (as in "k", "M", etc.) regardless of whether it is kde or mozilla.

All a matter of taster anyway... whatever works!

 *wilbertnl wrote:*   

> 
> 
> The newsgroup post is clear. Mozilla doesn't render as pretty as straight xft or even gdkxft. They refer to nightly builds in rpm format, I would like to get the patches itself!!

 

----------

## dioxmat

mozilla is quite good even without gtk2/gdkxft ...

you just need to adjust your prefs a bit.

http://mpillard.free.fr/mozilla/mozmail.png for a shot of what it looks like on my desktop (well, used to, I changed it a bit to have aa for the toolbar buttons too :)

----------

## wilbertnl

 *dioxmat wrote:*   

> mozilla is quite good even without gtk2/gdkxft ...
> 
> you just need to adjust your prefs a bit.
> 
> http://mpillard.free.fr/mozilla/mozmail.png for a shot of what it looks like on my desktop (well, used to, I changed it a bit to have aa for the toolbar buttons too 

 

Can you show us some italic fonts too? Italic fonts are the real proof for anti-aliasing.

----------

## Ian Goldby

I discovered yesterday a small tweak to the /usr/lib/mozilla/defaults/pref/unix.js file that improved the consistency of character weight. I was previously bothered in some fonts with the strokes of letters like lower-case 'w' looking too heavy or thick.

[img:625861a8d1]http://homepage.ntlworld.com/ian.goldby/misc/gamma.png[/img:625861a8d1]

The left-hand images are with a gain of 0.0 and the right-hand images are with gain of 1.0. If you don't see any difference on your screen, then you needn't bother with the tweak.

pref("font.scale.tt_bitmap.dark_text.gain", "0.0");

The default is something like 0.8. Smaller values seem to reduce the weight on strokes away from 45 degrees to be more consistent with the other strokes. It didn't seem to make any difference to the feint 45 degree strokes such as in 'k' - at least it was not any worse.

Again, it's a case of what works best on your monitor and screen resolution. Lower screen resolution/sharper monitors seem to need more antialiasing than higher screen resolution/less sharp monitors, and are less tolerant of misplaced pixels (such as in the middle of the 'S').

----------

## davidblumberg

I have followed all the different instructions here and fonts look great everywhere except for Mozilla!!

Fonts > 8 and < 14 are still anti-aliased!

What can I do?

----------

## dioxmat

change your mozilla prefs. (check out unix.js ...)

btw, I would suggest that you leave aa enabled for bigs fonts... or it will look really bad :)

----------

## davidblumberg

Today I took a look around in the unix.js file and found something that really works! Somewhere in the file you'll find codes like this:

```

// below a certian pixel size outline scaled fonts produce poor results

pref("font.scale.outline.min",      17);

// 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", false);

pref("font.FreeType2.unhinted", false);

// below a certian pixel size anti-aliased fonts produce poor results

pref("font.antialias.min",        17);

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/truetype");

pref("font.directory.truetype.2", "/usr/X11R6/lib/X11/fonts/TTF");

pref("font.directory.truetype.3", "/usr/X11R6/lib/X11/fonts/truetype");

// below a certian pixel size anti-aliased bitmat scaled fonts

// produce poor results

pref("font.scale.aa_bitmap.enable", true);

pref("font.scale.aa_bitmap.always", false);

pref("font.scale.aa_bitmap.min", 17);

```

Do you see the 3 places where there is the number 17 written?

Anyway, insted of 17 the default was 10 and that's why Mozilla anti-aliased small fonts which I had disabled in Xftconfig but didn't understand why it didn't work in Mozilla.

So now Mozilla renders fonts great, whether small or big fonts!

----------

## wilbertnl

I was just simply thinking that I could collect all ttf fonts from any MS Windows version/application.

But it turns out that anti-aliasing is not always working.

Now it looks like the ttf fonts which come with the portage are working, but my own import don't. I created XftConfig files in the directories. But without aliases.

Does this sound familiar? Is there anything I need to do to get imported MS ttf's anti-aliased?

I'm using the fonts in Mozilla (and added the directory in unix.js)

----------

## dioxmat

you probably need to re-generate fonts.dir and fonts.scale ...

----------

## wilbertnl

 *dioxmat wrote:*   

> you probably need to re-generate fonts.dir and fonts.scale ...

 

I forgot to mention that, but I sure did.   :Smile: 

----------

## Kabuto

Here is a site to try.  http://www.dvdfile.com

I have most of the tweaks here but I had to change the AA minimum to 9 and set the smallest font shown in Mozilla to 9 for this site to show up readable.

----------

## keifir

@davidbloomberg: thanx for posting that unix.js file - now my moz looks really crisp   :Cool: 

----------

## meyerm

Hmm, I'm wondering if it is possible to only use TTFs and no longer any bitmap fonts in X...

Isn't it somehow possible to change the XftConfig to map those bitmap fonts "fixed" etc. all to some TTFs? But what about apps which aren't "build for Xft"?

(To be honest, I still didn't get the difference between freetype and Xft. Neither is a "real" font server and Xft even needs special treatment by the apps? Could someone perhaps explain this in a few words?  :Smile:  )

----------

## omie

this may seem like a dumb question...

how do i install NEW true type fonts?  what's the procedure?  i got some, changed their names to be lowercase without spaces, then put them in my /usr/X11R6/lib/X11/fonts/truetype directory

i edited the Xftconfig in that directory and added EDIT lines for them, then ran mkfontdir.  still nothing.  i tried running ttmkfontdir > fonts.scale as root, but that didn't seem to do anything.

is there anything else i need to do?  

thanks

----------

## kerframil

Omie,

First, make sure you've also referenced the fonts in your /etc/X11/XF86Config:

```
FontPath   "/usr/X11R6/lib/X11/fonts/truetype/"
```

Secondly, the correct command for generating TrueType scale files is actually ttmkfdir and you may need to emerge it first:

```
emerge x11-misc/ttmkfdir
```

You should be able to get a lot of info from these forums by searching for "install truetype". Someone called "okram" recommended checking the man page for the ttmkfdir command in detail before use. Apparently you should add the --encoding parameter if you use anything other than iso8859-1 charsets, and that you may also need to add the -o fonts.scale parameter.

----------

## omie

hrmm.  ok.  i did all of that.  gaim sees the font now, but gnome2 doesn't seem to.  any idea on how to get gnome to see the font?  do i need to edit the Xftconfig file in the font's directory?

----------

## kerframil

See Spider's (Gnome maestro extraordinaire) response in https://forums.gentoo.org/viewtopic.php?t=6137

----------

## omie

no dice.  i've been messing with gnome-font-install.  but i'll keep searching.  maybe the fonts i'm trying to install are invalid or something.  but gaim sees all of them.  gnome still doesn't.

----------

## kerframil

Oh joy! XFree 4.2.1 is out, and those lovely folks at Gentoo have customised the ebuild to build the font engine (Xft et al) against freetype-2.1.2   :Smile: 

Interestingly, the sed command which patches the freetype sources to enable the bytecode interpreter is not present in the xfree-4.2.1.ebuild file. Although I haven't checked yet, I'm pretty sure that the bytecode interpreter is still off by default in freetype, so those who believe in it may want to add that line in to the ebuild file.

Personally, I'm becoming wary of the assumption that the bytecode interpreter automatically makes things better. I'm still not convinced I'm getting the best out of freetype, so the quest continues. As iangoldby has shown with his valuable research, the xft-quality patch that is lurking in the Portage tree clearly shows improvements. So I need to see if that still works with the current XFree build. But I still maintain that David Chester's patch gave the best font rendering I have yet seen which, of course, doesn't want hinting anyway, and I've heard talk of the bytecode interpreter not really being very good in freetype. I wonder if that situation has changed.

While I'm on the subject, has anyone tried out the new OpenOffice 1.0.1 build? Gentoo have customised the truetype rendering, and IMO, it's abolutely appalling! The fonts are hideously weighted (think uber-bold), badly kerned and just don't look right at all. Has anyone else experienced this (before I file a bug)? It's so bad for me, that I have to specify font substitutions to use Type1 fonts instead on screen!

And finally, I was wondering if anyone had tried using "official" Adobe Type1 fonts in X (from Acrobat or whatever) to see how much of an improvement they would be on the "free" versions? I remember employing such a trick for Ghostscript years ago and it gave good results.

Oh, and thanks a million to davidblumberg for the Mozilla trick! I've converted to Gnome recently, so this is especially useful as I use Mozilla/Galeon pretty much exclusively now.

----------

## FusionGyro

With XFree 4.2.1, if you want to use subpixel rendering you're going to have to make a change to a file besides /etc/X11/XftConfig.

Instead, you need to modify the file /etc/fonts/fonts.conf and find the lines that say:

```

<!--

  Enable sub-pixel rendering

    <match target="font">

        <edit name="rgba" mode="assign"><const>rgb</const></edit>

    </match>

-->

```

and change that to this:

```

<!--

  Enable sub-pixel rendering

-->

    <match target="font">

        <edit name="rgba" mode="assign"><const>rgb</const></edit>

    </match>

```

(Thanks to José Fonseca for replying to my bug ticket so quickly!)

----------

## Carlo

Oh - I have XFree 4.2.1 running, but /etc/fonts/fonts.conf is empty.  :Confused: 

Carlo

----------

## tirantloblanc

 *Quote:*   

> Oh - I have XFree 4.2.1 running, but /etc/fonts/fonts.conf is empty. icon_confused.gif
> 
> 

 

I also have XFree 4.2.1 running, and /etc/fonts/fonts.conf is ok, but i don't have any /etc/X11/xftconfig...

----------

## IvanHoe

 *Quote:*   

> Instead, you need to modify the file /etc/fonts/fonts.conf...

 

I did a search for fonts.conf and found nothing.  Could this be a KDE only file (I use Gnome)?

----------

## zojas

i emerge xfree 4.2.1 and now I only have a few fonts.

the XFree86.0.log doesn't complain about my fontdirs being bad or anything. and fonts are still  antialiased.

but slashdot usually shows up with a nice times new roman italicized font. (I have a screenshot of mozilla showing slashdot under xfree 4.2.0-r12 at http://www.desertsol.com/~kevin/screens/020929_mozillaquasar.jpg

http://www.desertsol.com/~kevin/screens/020929_mozillaquasarfonts.jpg

now with xfree 4.2.1 I just got a plain sanserif font. Also I've been using "xterm -fa 'Andale Mono'" for xterm. under 4.2.1 though I get some non-monospaced font, so it looks like there is an extra 'space' character between each character.

I reemerged 4.2.0-r12 for now

----------

## tirantloblanc

 *Quote:*   

> I did a search for fonts.conf and found nothing. Could this be a KDE only file (I use Gnome)?

 

No, i think it comes with xfree. I dont have kde nor gnome (only fluxbox) and i do have /etc/fonts/fonts.conf ...

----------

## dioxmat

fontconfig and stuff is included with the Xfree 4.2.1 ebuild.

----------

## DarkJedi9

This whole font thing is irksome.  When I first installed gentoo, I emerged waimea, thinking it would grab everything I needed.  It sort of did.  I'm pretty sure it got freetype and truetype fonts but when I used waimea it gave me an error about not being able to load fonts and has to use the default, which is ugly.

So then I found this thread; I added the fontpaths to XF86Config and I don't even have /etc/X11/XftConfig.  I have /usr/X11R6/lib/X11/XftConfig but I'm not bothering with the anti-aliasing yet.  This is because now I don't get an error about loading fonts but they don't look right.  I compared against a screenshot of waimea from when I was using Slackware (all the X stuff was installed more or less without me doing anything) and I don't even think it's the same font.

I don't mean to sound like I'm bashing Gentoo - not looking for a "Go back to Slackware" response - I'm just wondering what's going on.  It seems odd that it wouldn't give me an error about fonts but give me something completely different from what it should.  Any suggestions?

----------

## H-Dragon

i do not have the XftXonfig file in any directory.... i installed gentoo.. i emerged gnome... (and then galeon) but i only got gnome to run in non-failsage mode after disabling aa fonts !!!!!!!!!!

any help?

----------

## tirantloblanc

 *H-Dragon wrote:*   

> i do not have the XftXonfig file in any directory.... i installed gentoo.. i emerged gnome... (and then galeon) but i only got gnome to run in non-failsage mode after disabling aa fonts !!!!!!!!!!
> 
> any help?

 

Last version of Xfree, Freetype, etc don't come with a Xftconfig. At least mine, i emerged everything last weekend and didn't have that Xftconfig, but i do have an /etc/fonts/fonts.conf, which i configured and added the paths for my fonts. I didn't need to do anything more, and when i compiled mozilla/gnome/metacity they supported automatically AA+truetype.

----------

## kerframil

 *Quote:*   

> Last version of Xfree, Freetype, etc don't come with a Xftconfig

 

You can get the XftConfig file back using this command (example assumes you're using XFree 4.2.1):

```
cp /usr/portage/x11-base/xfree/files/4.2.1/XftConfig /etc/X11
```

EDIT: I'm surprised by some of the issues reported here. I have started running Gnome recently. Everything looks pretty good, my imported fonts are displayed properly (and available) and the XftConfig file most definitely still applies. As far as installing fonts is concerned, I have found that KDE's font installer (yes, I know it is irritating to have to use it just for that) is quite excellent. It adds some nice XftConfig directives to deal with glyphs for special fonts such as WingDings, generates the necessary scale files, and creates Postscript font metric files, even for TT fonts. It puts the config file somewhere in your ~/.kde3 directory (can't remember because machine at work I'm using doesn't have KDE) but you can easily graft the XftConfig directives into your /etc/X11/XftConfig, and move the fonts to "/usr/X11R6/lib/X11/fonts/somedirectory". I imported my Windows fonts using that tool, and they look fine and dandy, and anti-aliasing does work. I've recently gone up to XFree 4.2.1, and I noticed the build bundles some extra TT fonts and now has a dependency on the ttmkfdir tool. I want to see if the ttmkfdir tool does everything as well as the KDE font installer tool does, because having KDE around just to install fonts is overkill   :Very Happy: 

Another thing I discovered is that you need to have something like:

```
exec `/etc/X11/chooser.sh`
```

in your ~/.xinitrc or ~/.xsession file for the X startup process to obey your window manager choice in /etc/rc.conf! If you're running Gnome this is quite important, because it has quite a sophisticated startup script (/etc/X11/Sessions/Gnome) which is also responsible for enabling the GDK_USE_XFT option! If that doesn't get turned on then Gnome won't use Xft at all. Before I was just running "exec gnome-session" and wondering why my fonts weren't anti-aliased ...

Hmm, tried X without the bytecode interpreter - what a waste of time   :Laughing: 

Having put it to the test, I can definitely say that the bytecode interpreter makes things a lot better in terms of rendering TrueType fonts aliased at smaller sizes, although the hinting process is definitely some way from Window$ quality.  Have yet to try the Xft quality patch on 4.2.1 though. Also tried the "official" Adobe Type1 fonts, took a long time to get them working and results weren't really any better than the built-in ones. It seems that Type1 font rendering is not too great in Freetype, although Ghostscript does a lovely job of printing them, of course. Look at Acrobat Reader to see what things could be like ... don't you just hate patents?

But, overally I'm getting more satisfied with the way things are looking. Most of the tricks are done in the XftConfig file. I might post mine once I've got it really good. And I would like to write a better guide for all of this in light of all the great new information we have here.

PS: I've put my fonts.conf and fonts.dtd up at these addresses for those who, for some reason, didn't get them. I'll put my XftConfig file up here some time soon as well. I'm not sure whether this new system is supposed to deprecate XftConfig or how these files are generated, more research needed here:

http://www.recruit2recruit.net/kerframil/fonts.conf

http://www.recruit2recruit.net/kerframil/fonts.dtd

----------

## Carlo

Thanks for uploading the files. 

In between I made emerge rsync && emerge -p xfree and voila:

```
Calculating dependencies ...done!

[ebuild  N   ] x11-misc/ttmkfdir-2.0

[ebuild   R  ] x11-base/xfree-4.2.1
```

Carlo

----------

## buttholio

I'm just gonna add that enabling subpixel rendering (as FusionGyro suggested) made a world of difference. Now the fonts look gorgeous, even the very small ones get very nice AA, certainly on par with ClearType. I wish I could post some screenshots ...

----------

## sqldr

Hi,

I'm new to gentoo, and I'm baffled..

whenever I try to run "xterm -fa '<some font>'" I get a segfault.  Never had this problem with debian.

I'm running xfree 4.2.1, I have the "RENDER", "type1", "freetype" modules installed, the apps all appear to be linked against Xft, I've got fonts (rather a large amount were installed, I must add..).  I have "USE" in /etc/make.conf set with "X" and "truetype", but no.. I get this:

spacepigs3 fonts # xterm -fa "lucida console"

Segmentation fault

or, in gdb:

spacepigs3 fonts # gdb xterm

GNU gdb 5.2.1

Copyright 2002 Free Software Foundation, Inc.

GDB is free software, covered by the GNU General Public License, and you are

welcome to change it and/or distribute copies of it under certain conditions.

Type "show copying" to see the conditions.

There is absolutely no warranty for GDB.  Type "show warranty" for details.

This GDB was configured as "i686-pc-linux-gnu"...

(no debugging symbols found)...

(gdb) run -fa 'lucida console'

Starting program: /usr/X11R6/bin/xterm -fa 'lucida console'

(no debugging symbols found)...(no debugging symbols found)...

(no debugging symbols found)...(no debugging symbols found)...

(no debugging symbols found)...(no debugging symbols found)...

(no debugging symbols found)...(no debugging symbols found)...

(no debugging symbols found)...(no debugging symbols found)...

(no debugging symbols found)...(no debugging symbols found)...

(no debugging symbols found)...(no debugging symbols found)...

(no debugging symbols found)...(no debugging symbols found)...

(no debugging symbols found)...(no debugging symbols found)...

Program received signal SIGSEGV, Segmentation fault.

0x4004cf85 in FcPatternPosition () from /usr/lib/libfontconfig.so.1

any ideas?

----------

## kerframil

 :Shocked:  OMG, exactly the same thing happens for me. And this is on a brand new installation (did it yesterday). It's not as though I used any exotic compilation options either (-march=pentium3 -O2 -pipe).

Very well spotted indeed ... I'm going to file a bug. I'll edit this post and put a link in when it's done.

----------

## ales

 *davidblumberg wrote:*   

> Today I took a look around in the unix.js file and found something that really works! .....
> 
> Do you see the 3 places where there is the number 17 written?
> 
> Anyway, insted of 17 the default was 10 and that's why Mozilla anti-aliased small fonts which I had disabled in Xftconfig but didn't understand why it didn't work in Mozilla.
> ...

 

Thanks for that info... since i don't have Xftconfig on my system (using PPC gentoo build).. antialiasing in mozilla was on for (what it seemed) all sizes... so changing the unix.js config to 17 did the trick... now small fonts that don't need antialiasing aren't are displayed without it, so they're much more legiable... thanks

ales

----------

## loz

OK. had lovely anti-aliased fonts in OO.o.

tried this hint to get AA fonts all over, especially in NS 7.0.

Now they're crappy jaggies.  very annoying.

what's worse.  I removed the extra lines from it and they still won't work..

How have my fonts been skrewd???

How on earth do I get them back.  This hint ain't all it's cracked up to be 'cos none of the things you people are going on about are working..

My /etc/X11/XftConfig file is full of loads of rules as it is and adding has had no effect.

What am I doing wrong.  It's not like I added anything to the XfConfig file from the original Gentoo install..

----------

## Thilo

Big thanks to you. I was never able to manage to find a REASONABLE howto on importing fonts. thumbs up!

----------

## kerframil

Bumping for topic watchers ... please note the edit I made on the very first post.

----------

## cpwins

Oh my fonts are looking bad! I hope your guide will be finished soon kerframil. In the meantime, what would be a good place to find more information on how to increase font quality? There is a lot of writing on this on the forum and even a Linux HOWTO, but I'm not sure which documents are up-to-date and which no longer apply.

For example, in the default XftConfig file the 75 dpi, 100dpi and other "usual" types are no longer specified. Only Type1 and TTF/truetype are there. Why's that? Also, the old "FontPath" variable (or something like that) is now repalced with "dir". Are they equivalent?

----------

## Ian Goldby

<unhelpful reply pointing out you didn't say which versions of the software you are using deleted. Apologies.>

----------

## kerframil

cpwins, XftConfig is of no relevance whatsoever with recent XFree86 builds. There is a new build called fontconfig which takes over the same role, and is related to xft support. Also, xft2 is coming our way and is even more exciting (it's currently experimental too).

I can tell you that the files you need to be looking at now are /etc/fonts/fonts.conf and ~/.fonts.conf. Generally you should try to leave the former along, and put your customisations in the latter. They are in XML format now, but this is a good move in my opinion.

Any fonts you put here will be available to xft compliant applications (including anything that uses Qt (KDE) or gtk-2 (gnome 2) libs). Older apps will use standard font support, and will only see fonts specified by FontPath in XF86Config.

Have a look at https://forums.gentoo.org/viewtopic.php?p=160706. That gives you a very basic idea of how to achieve what I've spoken about in this thread. And to see how fonts are imported, just look at /etc/fonts/fonts.conf for examples. I think you need to run fc-cache after changing things.

----------

## Naan Yaar

On upgrading to the latest version of kde that links to xft2 and fontconfig (through qt), fonts in konsole are borked (t h e y   l o o k   l i k e   t h i s).  Bug report and a workaround recorded here.

----------

## bps7j

I had my fonts installed but none of the fonts served by xfs were showing up in X, by which I mean no TT fonts. I had to add "unix/:7100" to my font path list in /etc/X11/XF86Config so it would actually listen to the font server! Damn. This took me like 3 months to figure out, I kid you not. Here's the section of the file:

```

Section "Files"

        RgbPath      "/usr/X11R6/lib/X11/rgb"

        ModulePath   "/usr/X11R6/lib/modules"

        FontPath     "/usr/X11R6/lib/X11/fonts/misc:unscaled"

        ..... more lines here .....

        FontPath     "unix/:7100"

EndSection
```

----------

## cpwins

Isn't xfs obsolete with recent versions of xfree?

----------

## kerframil

 *Quote:*   

> Isn't xfs obsolete with recent versions of xfree?

 

In a word, yes   :Wink: 

----------

## uziel

 *kerframil wrote:*   

>  *Quote:*   
> 
> As far as I can see, /etc/X11/XftConfig is not used at all Oh but it is! Making changes to that file will alter the configuration accordingly. Otherwise the implication would be that it does nothing and that it's existence is pointless which seems rather unlikely and surely would have generated many topic replies to this end (and even more comments to the XFree86 team). Furthermore, the changes I made to my default setup were performed exactly as I stated and had the desired effect. At no point did I edit the XftConfig file under the X11 directory. 

 

$ ls -l /usr/X11R6/lib/X11/XftConfig

lrwxrwxrwx    1 root     root           29 2003-02-11 20:03 /usr/X11R6/lib/X11/XftConfig -> ../../../../etc/X11/XftConfig

It actually seems to be a symlink.   :Smile: 

----------

## cbreaker

I've emerged Xfree86 4.3.0, and now all my fonts are being anti-ailiased.   I don't want small fonts to be anti-ailaised.

I have:

match 

   any size > 8

   any size < 14

edit 

   antialias = false;

# Same again, but enforced for KDE (specifically Konqueror/KHTML)

match

   any pixelsize > 8 

   any pixelsize < 14

edit 

   antialias = false; 

in my /etc/X11/XftConfig, and it's also in /usr/X11R6/lib/X11/XftConfig.   I don't have any other XftConfig files anywhere.

It was fine in Xfree 4.2.1.   It's ugly having all fonts antiailaised, and I'd rather turn it off completely then have the fonts I look at 98% of the time all blurry looking.

----------

## cbreaker

It seems that I need to make use of /etc/fonts/font.conf (or local.conf in that same directory) to change anti-alias settings.

Unfortunately I don't really know what I would type to disable anti-alias on certian font sizes.

Creating local.conf and dumping:

<match target="font">

    <edit name="antialias" mode="assign">

        <bool>false</bool>

    </edit>

</match>

into it turns off anti-alias for all fonts, which is acceptable for now..   I got that from http://www.xfree86.org/~dawes/4.3.0/fonts2.html#4 but it doesn't get into specifics on how to match on font size.

If anyone can help it would be greatly appreciated.

----------

## cbreaker

Okay so in the spirit of answering my own questions, I was able to put this into /etc/fonts/local.conf:

```

<match target="font">

    <test name="size" compare="more">

        <double>8</double>

    </test>

    <test name="size" compare="less">

        <double>14</double>

    </test>

    <edit name="antialias" mode="assign">

        <bool>false</bool>

    </edit>

</match>

<! for Konqueror but it doesn't seem to work>

<match target="font">

    <test name="pixelsize" compare="more">

        <double>8</double>

    </test>

    <test name="pixelsize" compare="less">

        <double>14</double>

    </test>

    <edit name="antialias" mode="assign">

        <bool>false</bool>

    </edit>

</match>

```

Unfortunately, Konqueror is still rendering all webpages with anti-alias turned on for all font sizes.   What a pain.

----------

## Steffen

Put a .fonts.conf in your home directory with the following content:

```
<?xml version="1.0"?>

<match target="font" >

 <test compare="more" name="pixelsize" qual="any" >

  <double>8</double>

 </test>

 <test compare="less" name="pixelsize" qual="any" >

  <double>14</double>

 </test>

 <edit mode="assign" name="antialias" >

  <bool>false</bool>

 </edit>

 <match target="font" >

  <test compare="more" name="size" qual="any" >

   <double>8</double>

  </test>

  <test compare="less" name="size" qual="any" >

   <double>14</double>

  </test>

  <edit mode="assign" name="antialias" >

   <bool>false</bool>

  </edit>

 </match>

</match>
```

Additionally, in the KDE Control Panel I've enabled anti aliasing, but excluded font sizes 8 - 14 pt. At least for me, only big fonts in Konqueror are anti aliased this way!  :Smile: 

----------

## boglin

I found this link to be a useful XFree-fonts howto:

http://www.xfce.org/Xft_and_Xfce_mini_Howto.html

Hope it helps someone.  :Smile: 

----------

## cyjoe

I just upgraded to xfree 4.3.0 and found the fonts

Charter

Clean 

Clearlyu

Fixed

Helvetica

Lucida

New Century Schoolbook

being invisible  :Neutral: 

Antialiasing still works fine for the other fonts (installing Xft 2.0.1 put a new XftConfig into the /etc/X11 directory but it is still just not used. Editing or renaming has no effect on the antialiasing)

----------

## arashb

I wonder if that promisse dguid published? We have an awefull lot of problems because of xft malfunctioning. Please inform give the guids url.

Thanx

----------

## eauclair

Where is the unix.js file?  I can't find it (yet).  I can't find where phoenix is installed, either, I did an "emerge phoenix-bin"  It runs, but I don't know where it is installed.   :Crying or Very sad: 

thx

 *ales wrote:*   

>  *davidblumberg wrote:*   Today I took a look around in the unix.js file and found something that really works! .....
> 
> Do you see the 3 places where there is the number 17 written?
> 
> Anyway, insted of 17 the default was 10 and that's why Mozilla anti-aliased small fonts which I had disabled in Xftconfig but didn't understand why it didn't work in Mozilla.
> ...

 

----------

## reesm

Yeah, my fonts work better now on Xfree86 4.3.0. They look spiffy on my fixed frequency HP 2094 A monitor too! See my webpage at http://www.ee.ualberta.ca/~reesm for details on getting this to work.

----------

## db7b5

 *reesm wrote:*   

> Yeah, my fonts work better now on Xfree86 4.3.0. They look spiffy on my fixed frequency HP 2094 A monitor too! See my webpage at http://www.ee.ualberta.ca/~reesm for details on getting this to work.

 

I would like to view your configuration.  It's not posted on your site however.  Thanks,

Dan

----------

## fbreuer

Does subpixel hinting only work with TrueType fonts? On my laptop the truetype fonts are rendered ok but the Type1 fonts have colorful borders. See also https://forums.gentoo.org/viewtopic.php?p=403146

I am using fontconfig 2.1, Xfree 4.30, and Xft 2.0.1.

----------

## static

 *kerframil wrote:*   

>  *Quote:*   Isn't xfs obsolete with recent versions of xfree? 
> 
> In a word, yes  

 

So why then, in the gentoo 1.4 desktop installation instructions do we

```
emerge xfs

rc-update add xfs default
```

 :Question:  Should I rc-update del xfs default and somehow unemerge xfs??

----------

