LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices



Reply
 
Search this Thread
Old 05-07-2008, 04:04 AM   #1
Daedra
Senior Member
 
Registered: Dec 2005
Location: Springfield, MO
Distribution: Slackware64-14.1
Posts: 1,226

Rep: Reputation: 187Reputation: 187
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.

Last edited by Daedra; 02-17-2012 at 03:55 AM.
 
Old 05-07-2008, 05:24 AM   #2
shadowsnipes
Senior Member
 
Registered: Sep 2005
Distribution: Slackware
Posts: 1,442

Rep: Reputation: 70
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
 
Old 05-07-2008, 03:30 PM   #3
Su-Shee
Member
 
Registered: Sep 2007
Location: Berlin
Distribution: Slackware
Posts: 509

Rep: Reputation: 41
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).
 
Old 05-07-2008, 05:27 PM   #4
symatic
Member
 
Registered: May 2007
Distribution: Slackware
Posts: 242

Rep: Reputation: 32
Quote:
However, after I upgraded to 12.1 the fonts at Yahoo mail look crappy again
I believe the solution without installing ms fonts are to go the options in firefox fonts and remove the check from "allow websites to choose fonts...or something" and give it a go.

Quote:
f you want to save your self all this compiling and time please use my modified packages,
Also I used your pkgs nice work, I changed hinting to full I like that better. But works very nicely.

Last edited by symatic; 05-07-2008 at 06:30 PM.
 
Old 05-07-2008, 11:33 PM   #5
shadowsnipes
Senior Member
 
Registered: Sep 2005
Distribution: Slackware
Posts: 1,442

Rep: Reputation: 70
Quote:
Originally Posted by symatic View Post
I believe the solution without installing ms fonts are to go the options in firefox fonts and remove the check from "allow websites to choose fonts...or something" and give it a go.
Personally, I like to see most websites as they are intended to look. For the few that I don't, I can adjust them with custom CSS.
 
Old 05-10-2008, 11:15 AM   #6
slackb0t
Member
 
Registered: Apr 2005
Distribution: Slackware 13.37
Posts: 146

Rep: Reputation: 16
wow... I didn't think firefox could look this good. Excellent write up. Thank you
 
1 members found this post helpful.
Old 05-11-2008, 09:00 AM   #7
reikyv
Member
 
Registered: Oct 2007
Location: Malaysia
Distribution: Slackware
Posts: 80

Rep: Reputation: 15
Thanks for the guide, ;-)
 
Old 05-11-2008, 03:32 PM   #8
pg99
Member
 
Registered: May 2008
Location: UK
Distribution: Slackware
Posts: 73

Rep: Reputation: 18
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>
 
Old 05-11-2008, 04:37 PM   #9
todders
Member
 
Registered: Nov 2006
Location: watford
Distribution: Slackware 13 64Bit Multi-Lib KDE4.2.4
Posts: 83

Rep: Reputation: 18
Quote:
Originally Posted by pg99 View Post
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>
Hello yes i agree leaving out this line gives me a much crisper and sharper look as well,without leaving this line out the fonts look slighlty oversized and muddy for my tastes anyway.

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
 
Old 05-14-2008, 02:57 AM   #10
dugan
Guru
 
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 5,002

Rep: Reputation: 1560Reputation: 1560Reputation: 1560Reputation: 1560Reputation: 1560Reputation: 1560Reputation: 1560Reputation: 1560Reputation: 1560Reputation: 1560Reputation: 1560
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 -->
<alias>
	<family>serif</family>
	<prefer>
		<family>Liberation Serif</family>
	</prefer>
</alias>
<alias>
	<family>sans-serif</family>
	<prefer>
		<family>Liberation Sans</family>
	</prefer>
</alias>
<alias>
	<family>monospace</family>
	<prefer>
		<family>Liberation Mono</family>
	</prefer>
</alias>
It causes the generic font names (Sans, Serif, Monspace) to refer to Liberation fonts instead of DejaVu fonts. Personally, I like the results.

Of course, doing everything Daedra posted above puts the desktop into overdrive!

Last edited by dugan; 05-14-2008 at 03:03 AM.
 
Old 05-26-2008, 07:54 AM   #11
Carpo
Member
 
Registered: Aug 2003
Location: Somewhere
Distribution: Gentoo (for now)
Posts: 364

Rep: Reputation: 30
after doing all the above on my laptop everything looks worse, i may have done something wrong know ing me - 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
 
Old 05-26-2008, 12:40 PM   #12
shadowsnipes
Senior Member
 
Registered: Sep 2005
Distribution: Slackware
Posts: 1,442

Rep: Reputation: 70
Quote:
Originally Posted by Carpo View Post
after doing all the above on my laptop everything looks worse, i may have done something wrong know ing me - 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
Is it just me or did you answer your own question? Are you just saying you don't understand how to interpret what the patches do?
 
Old 05-26-2008, 03:18 PM   #13
Daedra
Senior Member
 
Registered: Dec 2005
Location: Springfield, MO
Distribution: Slackware64-14.1
Posts: 1,226

Original Poster
Rep: Reputation: 187Reputation: 187
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

Last edited by Daedra; 05-26-2008 at 03:21 PM.
 
Old 05-28-2008, 02:02 PM   #14
Su-Shee
Member
 
Registered: Sep 2007
Location: Berlin
Distribution: Slackware
Posts: 509

Rep: Reputation: 41
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.
 
Old 05-29-2008, 04:42 AM   #15
Carpo
Member
 
Registered: Aug 2003
Location: Somewhere
Distribution: Gentoo (for now)
Posts: 364

Rep: Reputation: 30
Quote:
Originally Posted by shadowsnipes View Post
Is it just me or did you answer your own question? Are you just saying you don't understand how to interpret what the patches do?
i am aware of what patches do and how to patch, just the patch in the first post and the one from the one i posted seem to have the same name and be for the same package and although are similar in many areas there are some differences, i was asking would there be any difference in using the patch in the first post or the one on the freetype site
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
If I were to recompile & arch-optimize Slackware, where to begin? GrapefruiTgirl Slackware 124 06-22-2007 10:46 PM
How to Optimize Slackware 10.2? zeroz52 Slackware 23 10-04-2005 07:42 PM
How to fully optimize Slackware? Introx Slackware 4 05-30-2004 05:23 AM


All times are GMT -5. The time now is 03:18 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration