How to Optimize Fonts in Slackware
The bulk of the information in this thread can now be viewed at Dugan's webpage http://duganchen.ca/writings/slackware/fonts
My Patches/info for 13.37 can be found at post #212 and beyond A while back during 12.0 I made this post about getting "cleartype" like results with slackware fonts, you can view the original post here http://www.linuxquestions.org/questi...kware.-539868/ I got some emails asking for updated packages for 12.1 so I decided to post them and give a quick detail of what I have done... First let me just say I think that slackwares default font rendering is great but I have always thought that font rendering is the one thing that windows did better than linux but that really is no longer the case because most of the fonts technologies that make the fonts look good in windows are now available for linux. The problem though is that those technologies are patented and cannot be made available "out of the box". Keep in mind also that you should only do or use the patches/packages if you live in a country where the patent doesn't apply or you have a license to do so. Ok on to the good stuff. (All patches and packages will be found at bottom of page) 1) You need to recompile freetype to include sub-pixel rendering and bytecode interpreter enabled, by default they are not enabled. 2) You need to recompile cairo with the sub-pixel rendering patch applied to the source. The patch was made by David Turner a few years ago and the patch was never updated. Luckily the guys over at arch linux have maintained the patch and have updated to work with cairo-1.4.14. 3) You need to recompile libXft with the sub-pixel rendering patch. 4) after all 3 packages are updated you need to set fonts DPI to something sane, 96x96 is what windows uses and is what I recommend, there are many ways to do this but I am only going to explain 2. the first way is to start xorg with the command "startx -dpi 96" you can also edit /usr/bin/startx/ and change to this sysserverrc=/usr/lib/X11/xinit/xserverrc defaultclient=xterm defaultserver=/usr/bin/X defaultclientargs="" defaultserverargs="-dpi 96" clientargs="" serverargs="" save and close, restart X or if you are using the nvidia drivers you can edit your xorg.conf file and under the "device" section you can add this Option "DPI" "96 x 96" There are other ways to change your dpi these are just the easiest IMO. to test that the dpi is set correctly type this command xdpyinfo | grep resolution if it says 96x96 you good. UPDATE ++ I just wanted to add that 96x96 is not necessarily the correct DPI it is just was the most common back in the CRT days, but now with LCD's and such depending on what your dot pitch is your native DPI could be as low as 75 or all the way up to 105+. For those of you that have a nvidia card and are using the latest drivers, the drivers should automatically poll the data from your monitors EDID and set the DPI correctly for you with out doing anything, that is what I did and right now nvidia is setting my dpi at "90x88" which is correct given what my monitors dot pitch is. A much more detailed explanation on this can be found at this post http://www.linuxquestions.org/questi...034/page4.html 5) you need to make a .fonts.conf file and put that in your home directory. I am going to post my .fonts.conf below for download, but you can make a lot of interesting changes to your fonts using different commands, but if you want to learn how you are going to have to read up on fontconfig. But I am assuming that most people who interested in getting my type of results will just use my .fonts.conf file. 6) you need to install some good quality fonts. Preferably the windows core fonts. If you dual boot with windows you can simply copy for fonts from windows to your linux system. 7) To get the desired results like my screenshots below you need to change the fonts in firefox here are my settings http://webpages.charter.net/daedra/12.1/firefox.png That really is all that I did, you can play around with your .fonts.conf file and change the appearance of the fonts. SCREENSHOTS http://webpages.charter.net/daedra/12.1/snapshot4.png http://webpages.charter.net/daedra/12.1/snapshot4.png http://webpages.charter.net/daedra/12.1/snapshot4.png PATCHES Cairo - http://webpages.charter.net/daedra/1...filter-1.patch ignore the version number, it works libXft - http://webpages.charter.net/daedra/l...type-like.diff (I have read around that this might not be needed for desired results, but I used it anyway) Freetype - There are not patches, you just have to follow step one, Pat's build script can take care of that for you with a simple edit of the build script. However there is one thing that need to be done if you are going to compile your self you need to edit two lines in the src/autofit/aflatin.c file. Find the lines that say this if ( mode == FT_RENDER_MODE_MONO || mode == FT_RENDER_MODE_LCD ) other_flags |= AF_LATIN_HINTS_HORZ_SNAP; if ( mode == FT_RENDER_MODE_MONO || mode == FT_RENDER_MODE_LCD_V ) other_flags |= AF_LATIN_HINTS_VERT_SNAP; and then change them to look like this if ( mode == FT_RENDER_MODE_MONO ) other_flags |= AF_LATIN_HINTS_HORZ_SNAP; if ( mode == FT_RENDER_MODE_MONO ) other_flags |= AF_LATIN_HINTS_VERT_SNAP; save and your ready to compile (assuming your using Pat's modified build script) Finally, if you want to save your self all this compiling and time please use my modified packages, cairo and freetype were compiled using Pat's build script and have been tested so you can use them with confidence. libXft was compiled using src2pkg but I used Pat's configure options from his X build script and it has also been tested. http://webpages.charter.net/daedra/1....14-i486-2.tgz http://webpages.charter.net/daedra/1...3.5-i486-2.tgz http://webpages.charter.net/daedra/1....12-i486-3.tgz this is my .fonts.conf file, just copy this text into your favorite text editor and save it as .fonts.conf in your home directory <?xml version="1.0"?><!DOCTYPE fontconfig SYSTEM "fonts.dtd"> <fontconfig> <match target="font" > <edit mode="assign" name="rgba" > <const>rgb</const> </edit> </match> <match target="font" > <edit mode="assign" name="hinting" > <bool>true</bool> </edit> <edit name="autohint"> <bool>true</bool> </edit> </match> <match target="font" > <edit mode="assign" name="hintstyle" > <const>hintmedium</const> </edit> </match> <match target="font" > <edit mode="assign" name="antialias" > <bool>true</bool> </edit> </match> </fontconfig> We'll I guess thats all there really is, I hope at least a few people find this information useful, please feel free to leave any comments or if I missed anything let me know. |
Nice work! I'll have to check these out sometime.
I did notice one weird thing with fonts in 12.1. Yahoo mail did not have good fonts in 12.0, but after I installed my fonts from Windows XP it looked just like it does in Windows. However, after I upgraded to 12.1 the fonts at Yahoo mail look crappy again. I just created a custom css file to have it show what I wanted. I like the fact that 12.1 has the Liberation fonts. Thanks again for this :) |
Ah, my favorite font stuff. :)
The old Turner-cairo-patch works btw. also on cairo 1.6.4; I just changed the dirname in the patch. I use the exact same patches and dpi resolution, just with "hintstyle" "hintfull" instead of "hintmedium". Same forum's screenshot Screenshot of "terminal" window (Xfce's xterm) with Unicode in "less" (FVWM). |
Quote:
Quote:
|
Quote:
|
wow... I didn't think firefox could look this good. Excellent write up. Thank you
|
Thanks for the guide, ;-)
|
Thanks for providing these patches here. I remember it took me quite a while to track them down when I was trying to improve the fonts on 11.0, and I've since mislaid them, so this will save me a heap of googling when I finally get around to upgrading to 12.1.
Just wanted to share that I get excellent results with the DejaVu fonts by using full hinting and leaving out this section from fonts.conf, which seems to give the font a thinner, sharper look. <edit name="autohint"> <bool>true</bool> </edit> |
Quote:
Daedra thanks for the patches and all the work you have done on this,it makes a big difference to me on the usability of slackware. regards Todders |
It's great! But I have something to further contribute.
In /etc/fonts/conf.d, rename 50-user.conf to 10-user.conf, and 51-local.conf to 11-local.conf. Then add the following to either .fonts.conf or local.conf: Code:
<!-- Replace serif, sans-serif, monospace with Liberation fonts --> Of course, doing everything Daedra posted above puts the desktop into overdrive! |
after doing all the above on my laptop everything looks worse, i may have done something wrong know ing me :p - but what is the difference between the patch you put above adn the one at http://www.freetype.org/freetype2/pa...filter-1.patch, although they have the same name there are a lot of differences between them
|
Quote:
|
the patch at www.freetype.org was for cairo 1.2.4. Some people said you could just edit it to make it work with the newest cairos. But luckily for us the guys over at arch linux already did that, they just didn't rename the patch, it says 1.2.4 but unlike the one at freetype it does work with 1.4.14. The one you are referring to will not work with 1.4.14 unless you want to fix the patch yourself. Also post a screenshot if you can
|
Our beautiful font stuff seems to have consequences with the use of Firefox 3.
I don't know how the usual Slack package was compiled when it came to FF2, but as FF3 obeys GTK theming from now on, it relies (even more) on GTK/Cairo/Pango/Freetype and therefore on our patched font stuff. The binary FF3 (RC1) seems to be linked statically; I just built it from source, linking against my own cairo (the patched version). The sources have all stuff needed included, but you can configure FF with --enable-system-cairo to avoid using their included version. (Or patch theirs...) If everything works font-wise BUT the firefox 3 binary, you'll probably have to compile. (Works perfectly fine on Slack 12, have no 12.1 yet...) Haven't seen a Slackware FF3 package yet to verify all this, but the self-compiled version looks now as I want it to. |
Quote:
|
All times are GMT -5. The time now is 04:12 PM. |