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:
|
Quote:
I wasn't questioning whether or not you understand what patches do and how to use them. Rather, I was asking if you really looked at the differences of the contents between the two patches concerned and knew how to interpret those differences (ie. read code). |
|
WOW,
What a huge difference! I literally cannot get my eyes off the screen. Thanks. Mark |
Quote:
Firefox 3 uses it's own internal version of cairo bypassing the one that we patched and installed that is why firefox 3 will look different than other programs in slackware, similiar to openoffice which uses its own internal font rendering. You can fix this by recompiling firefox 3 with the option I stated above. Also this isn't relevant at this moment (but it might be later) but to compile firefox 3 from source it requires Cairo < 1.6.0. I am experimenting with some things right now, I will report back when I got some more info. |
Quote:
Also I would really like to use openoffice, but the fonts are terrible and I'm not sure how to go about fixing that. The same goes for firefox(which also looks terrible and double loads for some reason). I guess I would have to compile from source, but I have been reading about doing that and I am a bit lost. Any success with building any of those programs, possibly a little howto:) |
Quote:
|
I had firefox 3 for a bit, the fonts were hurting my eyes. Also that double loading(that is what it appears is happening), So I went back to the good old 2. Samething with openoffice, I decided to stick with koffice until I figure out how to patch it.
|
Quote:
|
Okay, I just settled with this. Well at least for right now. I upgraded cairo and freetype to there most current versions. I didn't patch them and only enabled BCI in freetype. I used the patched libXft package from above. It is very readable and it is not hurting my eyes as of yet.
Also on a side note: The double loading can be eliminated by right clicking on the firefox icon and select configure firefox button. Go to Application, then advanced options and uncheck launch feedback. Since it doesn't try to load twice from the command line it had to be from the launcher. |
Quote:
Quote:
|
Quote:
|
Firefox 3 HOWTO
I have been experimenting and reading about firefox 3 for a few days now and I think now is a good time to update the howto so that you can get the fonts working correctly with the LCD patches.
You can see the problem here Built in Cairo FF3 http://webpages.charter.net/daedra/1...creenshot2.png Fixed FF3 from source http://webpages.charter.net/daedra/1...creenshot1.png First the problem... Firefox 3.0 ships with its own internal version of cairo that completely bypasses the one from Slackware or another distributions (if you use there precompiled binaries). So the solution is compile firefox from source. That really is not all that difficult but one problem is that you are going to need Cairo=>1.6.0 to compile it. Luckily for us there is a new maintainer of the David Turner cairo patch, the only difference is the new patch is also dependent on a patched or updated version of fontconfig (we will get to that). Ok so lets get started. Everything from here on is info assuming that you already did the steps on page 1 and that you know how to use slackware buildscripts and apply patches and compile from source. 1) We need to download and install the newest version of cairo (1.6.4 as of this writing) here is a link to the patch http://webpages.charter.net/daedra/1...d-filter.patch. Apply the patch and compile and install. You can just use Pat's buildscript all you need to do is edit the version number (after you patched the source). If you want save your self some time and use my package for cairo http://webpages.charter.net/daedra/1...6.4-i486-3.tgz 2) The new version of cairo and this patch depends on a new version of fontconfig, I did some reading and it looks like now that fontconfig's newest version has built in support for LCD filters, and for some reason unlike the old patch this new one is dependent on this new version of fontconfig. there are no patches to apply you just need to upgrade to fontconfig-2.6.0, if you want to save your self some time you can use my package http://webpages.charter.net/daedra/1...6.0-i486-2.tgz I had to tweak this package, I had to edit Pat's build script and adjust his patches to make everything work correctly, I did my best to test everything and I have had no issues here, but I want to give fair warning that I take no responsibility if your system bursts into flames :). 3) once you have the new cairo and fontconfig installed its time to compile firefox. Now I compiled this over 6 times testing different settings and configs to make sure that it works just like the one that ships with slackware. This is the best way that I found and it works. I have to give ALL the credit here to the BlueWhite64 team, as most of you know the BlueWhite64 is a 64bit port Based on Slackware. They have a Firefox 3.0 buildscript that I used to compile my firefox and it is a very good buildscript. Now like I stated above I am assuming you know how to use slackware buildscripts so I won't be explaining here how to, if you don't know how to use a build script them search the fourms and you will find many answers. Here is a link the slackware build script http://data.bluewhite64.com/bluewhit...zilla-firefox/. Don't start yet I modified the buildscript because there is a few required changes to make this work correctly on slackware, the main changes are the architecture and enabling system cairo so we can get our fonts back. Just replace the mozilla-firefox.slackbuild file with the edited one four here http://webpages.charter.net/daedra/1...fox.SlackBuild ok you are ready to compile once the package is made you can upgrade/install it and you should now have all three packages upgraded/installed. UPDATE AGAIN :) There is a bug in firefox 3 that causes the application panel to not properly work, this patch will fix that bug http://webpages.charter.net/daedra/1..._panel.diff.gz The patch has been added to the buildscript so all you need to do is download the patch and the buildscript will apply it for you. NOTE* I would like to upload my finished firefox 3 package, but according to mozilla if you compile a source version of FF with --enable-official-branding then that version comes with all logo's which are trademarked by mozilla and you need permission from them to distribute the package... and since I don't have permission and I am not sure if it is ok, I am not going to sorry :( 4) Last step, you need to "turn on" the LCD filtering to do this edit your .fonts.conf file in your home directory and add these lines, highlited in red <?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> <match target="font"> <edit mode="assign" name="lcdfilter"> <const>lcddefault</const> </edit> </match> </fontconfig> save and exit, restart X. Launch firefox and you should be good to go. Feel free to post any errors, problems, or anything I f*d up, lol. ONE LAST NOTE* I was trying to use one of the old cairo patches to use with the new cairo version because I had heard that they do work you just need to change the directory names to match the newer version, I wanted to see if this would work so that upgrading fontconfig would't be necessay but the above is the only way I found to make it work, if anyone has found an easier way please let us know. Thanks |
The Cairo 2.6.4 patch at http://aur.archlinux.org/packages.php?ID=16459 works with Fontconfig 2.4.
|
Really? because when I applied the cairo patch all my GTK+ apps were not displaying correctly, it was only when I compiled the newest fontconfig and added the lines to my .fonts.conf file did it finally work, but if it works without it that wold definitely be a lot easier.
|
Hmmm... the patch I just mentioned must have been for something else. I tried applying it, and I didn't get the font smoothing I was expecting.
|
Quote:
I suggest changing --enable-optimize=-O2 to Code:
--enable-optimize="-O2 -march=i686" Code:
--enable-optimize="$SLKFLAGS" Code:
elif [ "$ARCH" = "i686" ]; then |
Good call, thank you for that, I updated the file.
Thanks Again. |
You should enable jemalloc to for better memory mangement etc. It's default in the Mozilla builds. This is new in Firefox 3.
–enable-jemalloc |
Quote:
Bill. |
Quote:
--enable-application=browser --enable-update-channel=release --enable-update-packaging --enable-optimize --disable-debug --disable-tests --enable-official-branding |
Quote:
I would like to know of a way to query the source tree to find all the default configuration options of which there are many. Bill |
>If it is default in the mozilla builds, then my understanding is that it should not be necessary to add it to .mozconfig.
Otherwise it doesn't kill you ;-) I don't know whether it's activated by default so I enabled it myself just to be sure. |
When I built Firefox from source, I encountered this bug:
https://bugzilla.mozilla.org/show_bug.cgi?id=409192 Did this happen to anyone else? |
i've used slackware since 9.1, and i have to admit it has never looked this good. thanks! Great Post!!!
|
Just to update everyone, I changed the slackbuild. It seems if you have read the post "firefox 3.0 + thunderbird = no email links" it turns out the Pat's firefox/thunderbird patch doesn't seem to be needed anymore and in some cases (mine and otheres) it was causing problems, I now have removed the patch from the slackbuild and now my email problem is fixed. So on the safe side I changed the build however you can still download the original slackbuild from here http://webpages.charter.net/daedra/1...SlackBuild.old
|
To the SlackBuild, I recommend fixing the blank applications menu bug.
The Bugzilla entry: https://bugzilla.mozilla.org/show_bug.cgi?id=409192 The patch: https://bugzilla.mozilla.org/attachment.cgi?id=325195 I added the patch to my SlackBuild and now everything works perfectly. (The crashing problem I mentioned earlier seems to have solved itself). |
So this patch is all you need to fix the application problem? I thought I read that you had to compile a whole bunch of gnome stuff to get that working? Also where did you add the patch, before or after compile?
|
That so called subpixel rendering of colored pixels makes my eyes water... Its that bad. Blowing cigarette smoke in my face isn't nearly as bad.
I like my fonts with AA but no subpixel rendering. http://img384.imageshack.us/img384/148/fontsfv1.png That's how its done. |
Quote:
|
Quote:
NonAA renderings have their purpose... But not in a browser. Matter of taste I guess. It didn't seem like a biggie back in Win 98 days where I had a choice of nonAA and nonAA. |
Quote:
No, I haven't tested it on a GNOME-free Slackware system. I suspect that the presence of GNOME isn't actually a factor here. You apply it before compile. Use "patch -p1 < /path/to/patch", then run configure. |
Hi,
Quote:
|
Quote:
<const>rgb<const> bgr vrgb vbgr <match target="font" > <edit mode="assign" name="rgba" > <const>rgb</const> </edit> </match> It might be worth a try. |
Quote:
|
Quote:
|
All times are GMT -5. The time now is 08:39 PM. |