Slashdot Mirror


Font HOWTO For Linux

big-dog writes "The Register is running a good HOWTO on getting fonts to look better in Linux." Making things look purty is always good.

30 of 336 comments (clear)

  1. Licensing Issues by bookroach · · Score: 3, Informative
    --
    GTA3 is like the Sims to me - MC Hawking
  2. A suggestion for RH8 users. by e_n_d_o · · Score: 5, Informative

    Red Hat 8 appears to have most of this set up from the factory, with the exception of the MS fonts.

    There is an unbelievably irritating aspect of anti-alised fonts I've found with RH8 (and in previous experiences with Gnome2): GTK+2 apps will insist on using Anti-alised fonts for EVERYTHING, and there seems to be no way to turn it off. While I think anti-aliased fonts are wonderful most of the time, I believe most developers will agree they are not so great in terminal windows or when viewing source code.

    If you change your font preferences to "monochrome", you can then set source code editor/terminal fonts to non-anti-aliasable ones, like LucidaTypewriter. Then switch the font prefs back to your previous anti-aliased setting, and the modified programs will retain the non-antialiased font setting.

    I don't know whose fault it is that this workaround is required (GTK, Red Hat, the apps themselves, etc), but it would be most appreciated if non-antialiasable fonts appeared in the font-selection dialogs even when antialiasing is enabled.

    1. Re:A suggestion for RH8 users. by foonf · · Score: 4, Informative

      You can specify in /etc/XftConfig whether or not to anti-alias fonts based on name, type, and size. So for instance you can disable antialiasing on fonts size 12 and below, fixed-width fonts, italic fonts, etc. if you like.

      Everything that uses Xft to render anti-aliased fonts (and, except for a few programs with lame software freetype support, this is everything) will be affected by this.

      --

      "(Man) tries to live his own life as if he were telling a story. But you have to choose: live or tell." --Sartre
    2. Re:A suggestion for RH8 users. by zdzichu · · Score: 5, Informative

      GTK+2 apps will insist on using Anti-alised fonts for EVERYTHING, and there seems to be no way to turn it off.

      You can turn them off:

      export GDK_USE_XFT=0

      --
      :wq
    3. Re:A suggestion for RH8 users. by foonf · · Score: 3, Informative

      [CORRECTION]

      XftConfig is usually in /etc/X11, not /etc

      --

      "(Man) tries to live his own life as if he were telling a story. But you have to choose: live or tell." --Sartre
    4. Re:A suggestion for RH8 users. by KiwiSurfer · · Score: 2, Informative
      [CORRECTION]

      XftConfig is usually in /etc/X11, not /etc

      Who modded this up? It all depends on how you set up your system, there is NO standard filesystem structure for XFree86 configuration files. FreeBSD's port of XFree86 puts XftConfig in /usr/X11R6/share/X11/ for example -- and apparenly other OSes and/or disrributions (for some strange reason) decides to put it in /etc (despite the fact that /etc is for operating system-specific configuration files).


      - James

    5. Re:A suggestion for RH8 users. by CoolVibe · · Score: 3, Informative
      It's a compile-time setting. Oh, and FreeBSD's XftConfig is in /etc/X11, just like everywhere else. It's just a symlink to that far away place you name. /etc/X11/XftConfig is shorter :)

      Oh, minor nitpick wrt the screenshots: What is it with people taking screenshots with The Gimp?!? Surely there are better ways to dump one's screen to a file like using xwd, ImageMagick's import, Ksnapshot, or whatever. Takes less time too. Taking screenshots with Gimp is like swatting a fly with a tactical nuke. It works, but it's overkill.

  3. Some additional debian specific font info... by sc00p18 · · Score: 3, Informative


    ...can be found here. It's really easy to follow his instructions to get true type fonts working right.

  4. What about Xft? by nothing_23 · · Score: 5, Informative

    That HOWTO seems to ignore the best option for getting pretty fonts on X, Xft.
    I am currently running Redhat 8.0 with an XFT version of Mozilla, and I must may my screenies are much prettier.
    With Xft, FreeType, and some good TrueType fonts, I finally have a Linux desktop with fonts prettier than WinXP.

  5. Re:Step 1 by diamondc · · Score: 5, Informative

    On Mozilla's website, under the nightly/experimental directory, there are RedHat 8.0 rpms for Mozilla 1.2 beta with XFT support. Now Mozilla fonts look the same as in KDE/GNOME2 programs!

    --
    "I keep looking in the want-ads under 'revolutionary' but there don't seem to be any listings.. "
  6. Compiling as root again by sasquatchoflove · · Score: 2, Informative

    With the recent sendmail trojan (which trojaned your system when you ran make), I would assume people would be more careful of this. The howto author compiles as root, just a warning...

  7. Re:Strange by KnightStalker · · Score: 3, Informative

    No kidding. I hosed my system this morning with a little "I'll install True Type fonts... it can't hurt anything..."

    Now, KDE doesn't start, even after reinstalling it three times and reinstalling X once.

    Here I am, looking at /. from within FVWM, and the gods are taunting me.

    --
    * And remember, it's spelled N-e-t-s-c-a-p-e, but it's pronounced "Mozilla."
  8. Subpixel hinting by Doug+Neal · · Score: 5, Informative

    For those saying that ClearType style subpixel hinting is "too blurry", you should be aware that it only really works on TFT screens as the way it works requires a set pixel layout, which traditional CRTs don't have. Steve Gibson has a fairly good explanation of how it works on his website (if you can put up with his infuriating self-congratulatory writing style).

    So yes - regular antialiasing should be all that's needed on a CRT.

    And... I'm currently typing this from Konqueror 3, which renders subpixel antialiased Truetype and Type1 fonts absolutely beautifully, along with the rest of KDE 3, in fact I would say it looks a lot nicer than Cleartype. Especially on a 1600x1200 TFT. Mmm, shiny :D

  9. Re:Here is the HOWTO by Quikah · · Score: 3, Informative

    There are XFT builds of Mozilla 1.2b already, here.

    --
    Q.
  10. Another HOWTO by capnjack41 · · Score: 5, Informative
    The Linux Font De-Uglification Howto

    Mostly the same stuff, possibly?

  11. Strongly Recommended by mickwd · · Score: 5, Informative

    I've got to point out this site for improving fonts even more. The difference it made to my fonts was amazing - and I was already using sub-pixel rendering and a laptop display with freetype2-2.1.2 (with the bytecode interpreter compiled in).

    I STRONGLY recommend you try it out - he even includes a pre-compiled libfreetype (built for Red Hat, I think, but works great on Mandrake 9.0). You'll need to put it in the right directory, and create the right symbolic links to it.

    I don't know how much of the improvement is due to this guy's improvements, and how many are due to the upcoming freetype2-2.1.3, but whatever - Linux fonts are no longer inferior to look at.

  12. Re:Step 1 by GlassHeart · · Score: 5, Informative
    Congratulations, you're finished.

    Getting fonts right isn't just about installing them. Examine the screenshot from the article, and look at the Tahoma sample text (fifth from top). It is clear that the "q" and "r" and "Q" and "R" need more space between them. The "c" and "d" of Thorndale and Times New Roman, on the other hand, have too much space between them. Note also that you can probably spot these anomalies without even reading the text closely.

    Also, it's not hard to confuse Qt (and maybe also Gtk) or a window manager with fonts. Pick a strange font or size, and the resulting size of buttons and such often become ugly or overlap incorrectly with decorations.

    So, no, despite FreeType and friends (which are wonderful), we're not done with fonts yet.

  13. Re:Am I the only one... by Quarters · · Score: 5, Informative
    I want fonts to be antialiased on paper, not on the screen.


    You don't quite get the concept of anti-aliasing, do you? Aliasing is the stair-step pattern you get on non-orthogonal lines on a bitmap based display (e.g. a CRT or LCD). Anti-aliasing is the apparent removal of those artifacts by blending the line's color with the color behind it.

    Printers do not anti-alias printed lines on an offset press. You gain sharpness in printing by increasing the resolution of your source material. A 1200 dpi (or greater) typesetter (or direct to press digital system) will create typography that is, for all intents and purposes, perfect.

    Asking for anti-aliased letters on a printed page is like asking to buy someone's used Yugo. It's both dumb and useless.
  14. For high-res screens by be-fan · · Score: 5, Informative

    If you're running a high-res screen (currently this would be one of those 133 or 140 DPI LCDs) or if you like your fonts on the softer side, the TrueType hinting algorithm will tend to make your fonts too thin. I'm running a 1600x1200 LCD and the bytecode interpreter, which tends to snap fonts to integral numbers of pixels, distorts the shape and makes fonts too thin to read. A wonderful fix for this is to download and compile the FreeType2-current from FreeType's FTP site (under the unstable directory). Then, get some nice Type1 fonts (currently, a lot of fixes are in the pshinter) and make sure to disable the TrueType bytecode interpreter (it's disabled by default). Turn on AA, and you're treated to some wonderfully rendered fonts. Anti-aliased enough to be smooth, but still sharp enough to be easily readable. I've got a screenshot at: http://home.mindspring.com/~heliosc/fonts.png

    --
    A deep unwavering belief is a sure sign you're missing something...
  15. Re:Redhat makes adding fonts even easier by IdleTime · · Score: 3, Informative

    No problem.

    Find your unix.js file under the mozilla directory, then make sure your TrueType Section looks like this:

    // 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", true);
    pref("font.FreeType2.unhinted", true);
    // below a certian pixel size anti-aliased fonts produce poor results
    pref("font.antialias.min", 6);
    pref("font.embedded_bitmaps.max", 1000000);
    pref("font.scale.tt_bitmap.dark_text.min", 64);
    pref("font.scale.tt_bitmap.dark_text.gain", "0.1");
    // 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");


    Just remember to change the path to your TT font directories.

    --
    If you mod me down, I *will* introduce you to my sister!
  16. Completely OT, but... by Stauf · · Score: 3, Informative

    Trillian runs fine under wine, albiet without *any* alpha blending (not sure tho, it may work on a version of X that supports transparency)

    (Just realised I'm using WineX 2.2 - may make a difference, but it works for me)

  17. Re:Strange by Anonymous Coward · · Score: 1, Informative

    if I ssh to a different server and start emacs, I don't get a nice pretty X window :-) You're doing something wrong, then. I do.

  18. Re:Am I the only one... by Anonymous Coward · · Score: 1, Informative

    Too bad that's exactly what inkjet and laser printers do to overcome the limitations of the media or lower physical resolution to improve text output. Ever hear of iRet?

    Interesting about non-orthogonal lines causing a stair-step pattern. Does that mean if all of my lines were in a plane 37 degrees from horizontal, they would not exibit a stair-step pattern on the screen?

  19. Actually, those problems have been solved ... by shellbeach · · Score: 3, Informative
    Have a look at these XFT/Freetype hacks. The author of these initially started off hacking XFT to remove hinting, then added back an improved "slight-hinting" model, and is now working on making the changes directly to the FreeType library (which has the added advantage of fixing OOo's fonts and making them look decent (finally!)).

    I've been using this FreeType hack for a while now and Windows and MacOS look far worse in comparison. Just check out the screenshots on the page if you don't believe me!

  20. Just change unix.js by shellbeach · · Score: 2, Informative
    It's a simple matter of changing unix.js in *mozilla-directory*/defaults/pref/

    Here's a diff of the default unix.js file against my customised one - note that there's a size for minimum aa'ing (which I have set at 1, but you could set at 16 if that's what you want), and that you can change the "bluriness" via dark_text.gain/light_text.gain settings.

    Also note that this mod works with any version of mozilla - 1.0 or 1.1, you don't need to get 1.2b and you don't need to recompile - and all you have to do is edit this file. (And yes, I was cursing when I found out just how easy it was to enable aa'ing!)


    70,74d69
    231c226
    ---
    > pref("font.FreeType2.enable", true);
    235c230
    ---
    > //pref("font.FreeType2.autohinted", false);
    238c233
    ---
    > pref("font.antialias.min", 1);
    241c236
    ---
    > pref("font.scale.tt_bitmap.dark_text.gain", "0");
    245a241
    > pref("font.directory.truetype.1", "/usr/X11R6/lib/X11/fonts/drakfont");
    250,251c246,247
    ---
    > pref("font.scale.aa_bitmap.always", true);
    > pref("font.scale.aa_bitmap.min", 1);
    255c251
    ---
    > pref("font.scale.aa_bitmap.dark_text.gain", "0");

  21. Re:Am I the only one... by Ninja+Programmer · · Score: 2, Informative

    • I want fonts to be antialiased on paper, not on the screen.

    You don't quite get the concept of anti-aliasing, do you? Aliasing is the stair-step pattern you get on non-orthogonal lines on a bitmap based display (e.g. a CRT or LCD). Anti-aliasing is the apparent removal of those artifacts by blending the line's color with the color behind it.
    You don't quite seem to understand computer monitors, and human perception. Whether or not a particular solution to anti-aliasing works well or not, is dependent on the resolution you are at and the dot pitch of your monitor.

    As the resolution drops below the natural resolution of the monitor (dictated by its dot pitch) the typical anti-aliasing strategy of proportional sampling becomes percieved as smudging. For very small fonts this will actually worsen their appearance.

    As the resolution increases above the natural resolution of the monitor, the effect of anti-aliasing becomes unnoticable. I.e., its not worth the processing power to do it.

    Anti-aliasing by proportional sampling really works best if the desktop resolution is optimally set according to the dotpitch of the monitor. For 0.28, for example, 1280x1024 is the resolution you should pick. The reason is because that monitor is already doing a form of proportional sampling close to the resolution of the actual pixels. By performing the proportional sampling in the source pixels, it improves the accuracy of the sampling (from an information theory point of view) that the monitor performs.

    Anyhow the point of all this is that depending on the resolution the end user has set, and the actual dot pitch of their monitor, they can actually see "anti-aliased" fonts as looking worse (typically smudged.)
  22. Re:HOWTO violate microsoft and apple patents by JanneM · · Score: 2, Informative

    As I understand it, the patents have been granted in the US only. The Register is a British publication. So, for their target readership, there are no patent issues to worry about.

    --
    Trust the Computer. The Computer is your friend.
  23. Printers do anti-alias by wytcld · · Score: 4, Informative

    ... or something damn close to it. For an old HP LJIIIp that looks a lot better than an LJII, even though both are 300 dpi. It's because the IIIp uses smaller dots where appropriate at the edges. Many ink jet printers do the same thing. Not sure if anything at 1200 dpi bothers with this trick, but the trick's good enough that the quality difference between the IIIp at 300 dpi and a 600 dpi printer is very hard to see.

    --
    "with their freedom lost all virtue lose" - Milton
  24. Very screen specific by Looke · · Score: 2, Informative

    When this patch recently was included in Debian's freetype package, TrueType fonts became significantly more blurred on my 1024×768 LCD screen. Rebuilding with the patch disabled (and the bytecode interpreter turned on again) restored my fonts to normal.

    My point is that what looks good on my LCD monitor may look totally different on a hi-res 1600×1200 LCD or a normal CRT monitor. These things should be configurable, since there are different compile-time settings which give the best results on different screens.

    • Sub-pixel aliasing - is configurable, which is good.
    • Bytecode interpreter - is determined at compile-time, because of patent issues? That's not good :( (It does make a great difference, especially on small font sizes.)
    • "Ft slight" hack - is applied at compile-time, but should be made configurable when (if) included in the main freetype sources.
    • Anti-aliasing in general is very configurable, down to deciding which fonts in which sizes and variants should be anti-aliased. Great!

    What we need is a very configurable freetype, with good configuration/preview tools; and a general understanding of the highly different effects on different displays.

  25. Hmmm... isn't this a little dated now? by dabneyd · · Score: 2, Informative

    This is good if you're using KDE = 2 or Gnome 1, but if you're using the latest versions, it's find of obsolete. Actually, KDE has had font smoothing since sometime in v2. What I'm saying is, if you want really nice fonts, download the newest version of Gnome or KDE, whichever you prefer. Michael