Ubuntu Forums ubuntu.com - launchpad.net - ubuntu help  

Go Back   Ubuntu Forums > The Ubuntu Forum Community > Other Community Discussions > Tutorials & Tips
Register Reset Password Forum Help Forum Council Search Today's Posts Mark Forums Read

Tutorials & Tips
The place to find Ubuntu related Tips & Tricks.

 
Thread Tools Display Modes
Old March 19th, 2005   #1
deelerious
5 Cups of Ubuntu
 
Join Date: Mar 2005
Location: Detroit, MI, USA
Beans: 7
HOWTO: Hoary ClearType-like fonts

Q: How can I make my fonts in Hoary more Windows like?

A: See immediately below for a ClearType look. See end note for non-antialiased look.

Note: Much of this can be simplified if not using Tahoma. It is included here since Tahoma is used extensively in XP.

For comparison, here's Windows with ClearType:


And here's Ubuntu showing the same page:


Many thanks to all the people who contributed to the links below, most of this is simply adapted to Ubuntu from there.
http://www.linuxquestions.org/questi...5&pagenumber=1
http://avi.alkalay.net/linux/docs/font-howto/Font.html
http://convexhull.com/mandrake_fonts.html
http://www.ubuntuforums.org/showthread.php?t=4456

Step 1. Configure X and Gnome to 96 dpi
Code:
sudo cp /etc/X11/xorg.conf /etc/X11/xorg.conf.bak
sudo gedit /etc/X11/xorg.conf
Locate Section "Monitor" and add the following lines before EndSection:
Code:
#	DisplaySize	270	203	# 1024x768 96dpi
#	DisplaySize	338	254	# 1280x960 96dpi
#	DisplaySize	338	270	# 1280x1024 96dpi
#	DisplaySize	370	277	# 1400x1050 96dpi
#	DisplaySize	423	370	# 1600x1400 96dpi
Uncomment the line corresponding to your current resolution.

To get other values, use the following formula:
displaysize = <pixelsize>/96*25.4

Either restart X or reboot, after which verify the dpi setting is correct:
Code:
xdpyinfo | grep dimensions
xdpyinfo | grep resolution
If the resolution is not 96x96 dots per inch slightly adjust the DisplaySize values until correct.

Configure Gnome to run at 96 dpi in System > Preferences > Font > Details

Step 2. Install Microsoft fonts

Install msttcorefonts package (Microsoft TrueType core fonts)

OPTIONAL - If you own a licensed copy of Windows you may also add Tahoma which is not present in msttcorefonts. You can install it in your home directory by simply copying it into ~/.fonts. If so, you're done, skip to the next step. Alternatively, you can follow the more involved steps below and install it system-wide, which has the advantage of making it available to GTK1 appplications.

NOTE: If there's a better way to do this please correct me. Thanks.
Code:
sudo mkdir /usr/share/fonts/truetype/custom
Copy tahomabd.ttf and tahoma.ttf into /usr/share/fonts/truetype/custom/
Create Tahoma hints:
Code:
sudo gedit /etc/defoma/hints/custom.hints
Paste this:
Code:
category truetype
begin /usr/share/fonts/truetype/custom/tahoma.ttf
  Family = Tahoma
  FontName = Tahoma-Regular
  Encoding = Unicode
  Location = Magyar Dutch Spanish Czech Russian English Catalan Slovak Italian Turkish Danish Slovenian Basque Portuguese German Polish Swedish Norwegian French Finnish Greek
  Charset = ISO8859-1 ISO8859-2 ISO8859-3 ISO8859-4 ISO8859-5 ISO8859-7 ISO8859-9 ISO8859-10 ISO8859-13 ISO8859-14 ISO8859-15 KOI8-R KOI8-U CP1251 VISCII1.1-1 TCVN-5712 ISO10646-1
  UniCharset = ISO8859-1 ISO8859-2 ISO8859-3 ISO8859-4 ISO8859-5 ISO8859-7 ISO8859-9 ISO8859-10 ISO8859-13 ISO8859-14 ISO8859-15 KOI8-R KOI8-U CP1251 VISCII1.1-1 TCVN-5712
  GeneralFamily = SansSerif
  Weight = Medium
  Width = Variable
  Shape = NoSerif Upright
  Foundry = Microsoft
  Priority = 20
end
begin /usr/share/fonts/truetype/custom/tahomabd.ttf
  Family = Tahoma
  FontName = Tahoma-Bold
  Encoding = Unicode
  Location = Magyar Dutch Spanish Czech Russian English Catalan Slovak Italian Turkish Danish Slovenian Basque Portuguese German Polish Swedish Norwegian French Finnish Greek
  Charset = ISO8859-1 ISO8859-2 ISO8859-3 ISO8859-4 ISO8859-5 ISO8859-7 ISO8859-9 ISO8859-10 ISO8859-13 ISO8859-14 ISO8859-15 KOI8-R KOI8-U CP1251 VISCII1.1-1 TCVN-5712 ISO10646-1
  UniCharset = ISO8859-1 ISO8859-2 ISO8859-3 ISO8859-4 ISO8859-5 ISO8859-7 ISO8859-9 ISO8859-10 ISO8859-13 ISO8859-14 ISO8859-15 KOI8-R KOI8-U CP1251 VISCII1.1-1 TCVN-5712
  GeneralFamily = SansSerif
  Weight = Bold
  Width = Variable
  Shape = NoSerif Upright
  Foundry = Microsoft
  Priority = 20
end
Register Tahoma:
Code:
sudo /usr/bin/defoma-font -v register-all /etc/defoma/hints/custom.hints
Step 3. Configure system-wide fontconfig rendering method
Code:
sudo dpkg-reconfigure fontconfig
Select Bytecode interpreter or Subpixel rendering

Step 4. Configure Gnome font preferences to your liking. Example:


Step 5. Turn autohinting on for fonts larger than 12 pts (this will include the Firefox fonts) and perform font substitution for websites using Bitstream, Helvetica and Palatino fonts. Feel free to adjust these to your liking.

With autohinting on, Tahoma loses proper spacing and the letters mush together. Tweaking .fonts.conf turns off autohinting for smaller font sizes.
Code:
gedit ~/.fonts.conf
Paste this:
Code:
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<match target="font">
 <test compare="more" name="pixelsize" qual="any">
  <double>12</double>
 </test>
 <edit name="autohint" mode="assign" >
  <bool>true</bool>
 </edit>
</match>
<match target="pattern">
            <test qual="any" name="family">
                    <string>Bitstream Vera Sans</string>
            </test>
            <edit name="family" mode="assign">
                    <string>Arial</string>
            </edit>
</match>
    <match target="pattern">
            <test qual="any" name="family">
                    <string>Helvetica</string>
            </test>
            <edit name="family" mode="assign">
                    <string>Arial</string>
            </edit>
</match>
<match target="pattern">
            <test qual="any" name="family">
                    <string>Palatino</string>
            </test>
            <edit name="family" mode="assign">
                    <string>Georgia</string>
            </edit>
</match>
</fontconfig>
Log out of Gnome and log back in.

Step 6. OPTIONAL - Configure GTK1 applications to use Tahoma
Code:
gedit ~/.gtkrc.mine
Paste this:
Code:
style "user-font"
{
  fontset="-microsoft-tahoma-medium-r-normal-*-10-*-*-*-p-*-*"
}
widget_class "*" style "user-font"
Substitute with Verdana or other font as desired.

Step 7. Configure Firefox fonts. Example:


END NOTE: This could also be used to turn anti-aliasing off alltogether for the smaller fonts that are used in the menus, dialog boxes, toolbar text, etc. I've seen that question asked a few times, so I'll address it below. Doing so will make Gnome look exactly like Windows without ClearType, while still antialiasing large fonts used for example in website titles and headings. Use this .fonts.conf in Step 5:
Code:
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<match target="font">
 <test compare="more" name="pixelsize" qual="any">
  <double>0</double>
 </test>
 <test compare="less" name="pixelsize" qual="any">
  <double>15</double>
 </test>
 <edit mode="assign" name="antialias">
  <bool>false</bool>
 </edit>
</match>
<!-- UNCOMMENT THIS SECTION TO ENABLE ANTIALIAS FOR BOLD FONTS
<match target="font">
 <test name="weight">
  <const>bold</const>
  <const>black</const>
 </test>
 <edit name="antialias" mode="assign">
  <bool>true</bool>
 </edit>
</match>
-->
<match target="pattern">
            <test qual="any" name="family">
                    <string>Bitstream Vera Sans</string>
            </test>
            <edit name="family" mode="assign">
                    <string>Arial</string>
            </edit>
</match>
    <match target="pattern">
            <test qual="any" name="family">
                    <string>Helvetica</string>
            </test>
            <edit name="family" mode="assign">
                    <string>Arial</string>
            </edit>
</match>
<match target="pattern">
            <test qual="any" name="family">
                    <string>Palatino</string>
            </test>
            <edit name="family" mode="assign">
                    <string>Georgia</string>
            </edit>
</match>
</fontconfig>

Last edited by deelerious; March 20th, 2005 at 02:00 AM.. Reason: Shortened intro blurb
deelerious is offline   Reply With Quote
Old March 19th, 2005   #2
deelerious
5 Cups of Ubuntu
 
Join Date: Mar 2005
Location: Detroit, MI, USA
Beans: 7
Re: HOWTO: Hoary ClearType-like fonts

I reached the limit of screenshots in the original post, so here is another comparison to Windows, this time with antialias turned off. Using the same steps and the .fonts.conf in the end note.

Windows:


Hoary:
deelerious is offline   Reply With Quote
Old March 20th, 2005   #3
Julius
Gee! These Aren't Roasted!
 
Join Date: Oct 2004
Beans: 165
Re: HOWTO: Hoary ClearType-like fonts

Great Howto! What I've been doing until now is just disable antialiasing for all fonts smaller than a certain size. I use Tahoma 8 as app. font so it looks exactly like windows. In firefox it works perfectly because it looks like in windows (I'm used to it ).
The only problem is that some apps will still use antialiased fonts (like Openoffice) so they become unreadable. I'd have to set a higher font size as the "antialiasing limit", which will turn off AA in some big font sizes depending on the application.
It's as if not the size of fonts wasn't the same for all applications.

Is the same problem present with your method? I guess I can disable AA for Tahoma in all its sizes and turn it off on the other fonts for small font sizes...

Last edited by Julius; March 21st, 2005 at 07:26 AM..
Julius is offline   Reply With Quote
Old March 20th, 2005   #4
basse1989
A Carafe of Ubuntu
 
basse1989's Avatar
 
Join Date: Nov 2004
Location: Sundsvall, Sweden
Beans: 99
Re: HOWTO: Hoary ClearType-like fonts

Are you guys crazy? Why don't you install windows instead? Who would want their ubuntu installation to look like windows?

I think ubuntu works GREAT as it is (read my signature).
__________________
I love my ubuntu.

Last edited by basse1989; March 20th, 2005 at 05:42 PM..
basse1989 is offline   Reply With Quote
Old March 20th, 2005   #5
telmo
Ubuntu Extra Shot
 
Join Date: Dec 2004
Location: Braga-Portugal
Beans: 332
Re: HOWTO: Hoary ClearType-like fonts

Just one question... can i do this for a different resolution? I'm currently using 1280x800 with an ATI driver.
__________________
Linux user #383892

(\ /)
(O.o)
(> <)

This is Bunny. Copy Bunny into your signature to help him on his way to world domination.
telmo is offline   Reply With Quote
Old March 21st, 2005   #6
deelerious
5 Cups of Ubuntu
 
Join Date: Mar 2005
Location: Detroit, MI, USA
Beans: 7
Re: HOWTO: Hoary ClearType-like fonts

Quote:
Originally Posted by telmo
Just one question... can i do this for a different resolution? I'm currently using 1280x800 with an ATI driver.
To get other values, use the following formula:
displaysize = <pixelsize>/96*25.4

In your case:
1280/96*25.4 = approx 338
800/96*25.4 = approx 211

So, in xorg.conf use this:
DisplaySize 338 211 # 1280x800 96dpi

After restarting X, use xdpyinfo | grep resolution as shown above to make sure the dpi is 96 and, if needed, tweak the displaysize values until you get 96x96.
deelerious is offline   Reply With Quote
Old March 27th, 2005   #7
bored2k
Skinny Extra Sweet Ubuntu
 
bored2k's Avatar
 
Join Date: Feb 2005
My beans are hidden!
Re: HOWTO: Hoary ClearType-like fonts

Wicked, awsome .
bored2k is offline   Reply With Quote
Old March 21st, 2005   #8
Julius
Gee! These Aren't Roasted!
 
Join Date: Oct 2004
Beans: 165
Re: HOWTO: Hoary ClearType-like fonts

Quote:
Originally Posted by basse1989
Are you guys crazy? Why don't you install windows instead? Who would want their ubuntu installation to look like windows?

I think ubuntu works GREAT as it is (read my signature).
I've been using the same fonts for the past 13 years or something, so that's why I want my fonts to look the same. I like Linux, and I think Linux fonts are more 'powerful' than TrueType. THe thing is that most of websites have been designed using true type fonts, so many of them would look really ugly. If there's a way to make them look the same as they do in other operative systems, why not?
Julius is offline   Reply With Quote
Old March 30th, 2005   #9
angrykeyboarder
Quad Shot of Ubuntu
 
angrykeyboarder's Avatar
 
Join Date: Mar 2005
Location: Phoenix, Arizona, USA
Beans: 371
Ubuntu 9.04 Jaunty Jackalope
Send a message via ICQ to angrykeyboarder Send a message via AIM to angrykeyboarder Send a message via MSN to angrykeyboarder Send a message via Yahoo to angrykeyboarder Send a message via Skype™ to angrykeyboarder
Re: HOWTO: Hoary ClearType-like fonts

Quote:
Originally Posted by basse1989
Are you guys crazy? Why don't you install windows instead? Who would want their ubuntu installation to look like windows?

I think ubuntu works GREAT as it is (read my signature).
You obviously didn't read this very well did you? We're talking about fonts here.

Even the most die-hard *nix geek will tell you that X has not been the best when it comes to font rendering and will admit Windows has generally always done it better.

This doesn't mean any of us want Linux to be like Windows....
angrykeyboarder is offline   Reply With Quote
Old March 30th, 2005   #10
basse1989
A Carafe of Ubuntu
 
basse1989's Avatar
 
Join Date: Nov 2004
Location: Sundsvall, Sweden
Beans: 99
Re: HOWTO: Hoary ClearType-like fonts

Quote:
Originally Posted by angrykeyboarder
You obviously didn't read this very well did you? We're talking about fonts here.

Even the most die-hard *nix geek will tell you that X has not been the best when it comes to font rendering and will admit Windows has generally always done it better.

This doesn't mean any of us want Linux to be like Windows....
Windows font rendering looks ugly, ugly. But fonts in any linux distro I've ever tried have always looked nice. Same in OS X. Windows does most things ugly.
__________________
I love my ubuntu.
basse1989 is offline   Reply With Quote

Bookmarks

Thread Tools
Display Modes

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 On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 10:28 PM.


vBulletin ©2000 - 2009, Jelsoft Enterprises Ltd. Ubuntu Logo, Ubuntu and Canonical © Canonical Ltd. Tango Icons © Tango Desktop Project. bilberry