Slashdot Mirror


Xft Support For Mozilla

keithp writes "The results of a few short hours of hacking by blizzard (with a bit of help from me) can be seen here." According to Keith, "The hope is to have a patch of less than 100 lines; currently it's more like 400 lines. ... The patch uses a new version of the Xft library available at http://keithp.com. That will be integrated into the XFree86 CVS tree after 4.2 stablizes; the existing Xft library will remain in place for backwards compatibility. One feature of the new library is that it works with older X servers that don't have the Render extension, providing AA text (including the LCD optimizations) for any screen with a TrueColor visual." Chris Blizzard provided a link to the patch itself, as it stands right now.

21 of 190 comments (clear)

  1. Nice link... by FortKnox · · Score: 4, Funny

    the first link autocloses the window...

    And am I the only one that thought "Wow, Blizzard stopped coding for WarCraft 3 to help Mozilla out?!?"

    --
    Good quote, too many chars. Seriously, the slashdot 120 char limit sucks!
  2. VERY exciting by kwj8fty1 · · Score: 5, Informative

    This patch looks very promising. One of windows XP's big claim was better LCD support; they are right, it does look quite sharp on any type of square pixel display.

    As I'm sure most of you know, most monitors use round pixels, whereas most LCDs use square or the more typical rectangular pixels. So what this means from a GUI standpoint: You need to optimize for the output device. The end result in the screenshot looks GREAT.

    Good work guys!

    1. Re:VERY exciting by Booker · · Score: 4, Informative

      An excellent explanation of antialiasing for LCDs can be found here, and a HOWTO for implementing this on Linux is here. The screenshots in the article do look better than I have been able to achieve, though.

    2. Re:VERY exciting by Otter · · Score: 5, Insightful
      From the HOWTO:
      Now, edit your /etc/X11/XftConfig file, and add a line at the end. Most LCD screens will look better with R-G-B LCD Sub-Pixel Rendering. If yours does, add this line:
      match edit rgba = rgb;

      See, this is what I love and hate about Linux. The good news is someone hacked this up and someone else documented it and now Konqueror looks *sweet* on my TiBook.

      The bad news is -- how the hell was I supposed to know to do this? I mean, besides reading every comment on Slashdot until someone posted a link. (Thank you, by the way, for two excellent links.)

    3. Re:VERY exciting by Khalid · · Score: 4, Informative

      No ! you could have looked for it in goups.google.com by sarching for something like this "LCD, TrueType, Xfree86" you would have found it in some seconds !!

      searching in groups.google.com has become a "reflex" for me, and it pays !!

  3. Oh dear by Tony+Hoyle · · Score: 4, Insightful

    Whoopee.... blurry text, just what I needed.

    Luckily I never load Render & I never intend to - after about 5 minutes of looking at KDE with it enabled I had a bad headache. That font smoothing stuff is *really* hard on the eyes.

    I remember when the old archimedes did the same thing... it kinda worked there because they were crappy monitors anyway. With a sharp 17" it's not an improvement.

    1. Re:Oh dear by damiam · · Score: 5, Informative
      If you don't read AA fonts at normal sizes, then don't use them. I only enable them for larger fonts, where they look good.

      Put this into /etc/X11/Xftconfig:

      match
      any size > 8
      any size < 15
      edit
      antialias = false;

      --
      It's hard to be religious when certain people are never incinerated by bolts of lightning.
  4. Gdkxft has had this for a while by ronmon · · Score: 5, Informative

    It anti-aliases your GNOME widget fonts and there is a separate patch for Mozilla (good up to 0.9.6), which works nicely with Galeon, BTW.

    Check it out.

    1. Re:Gdkxft has had this for a while by matman · · Score: 4, Interesting

      Well it's not too bad. Xwindows supports a generic interface for rendering things that are accelerated by hardware (falling back to software when need be). Now, please, if I'm wrong, someone correct me, but I believe that it works like this: XFT is an API for drawing fonts in XWindows - it replaces X's old font interface. XFT talks to freetype to turn a string into a vector image (font file) into a bitmap image. The bitmap image that freetype produces can either be a monochrome pixmap (what normal X font routines use) or a 256 colour pixmap with antialiasing). XFT takes the 256 colour (greyscale) image and gives it an alpha channel (through some kind of an operation like multiply or darken only in GIMP. It then passes this image to XRender to have it rendered on the screen. Right now, most QT or GTK apps use QT and GTK font rendering routines. These routines used to use the normal x font stuff... if you patch them to use XFT, they all get anti-aliasing. Mozilla has it's own widget set, so it needs it's own patch to use the better font rendering mechanisms.

      The font support is in the right place, it's just that applications need to be changed to use the new, better interface, instead of the old interface that can't do hardware accelerated alpha channel stuff.

  5. Already possible, sourt of. by foonf · · Score: 4, Interesting

    Look here. This is with the version of mozilla included in Debian unstable, patched to work with the gdkxft hack. The real question is will this new patch actually be included in any commonly distributed Mozilla binaries. Because if it isn't, I don't think many are going to recompile the whole damn thing just for anti-aliasing (but that won't stop people from complaining about the lack of it!).

    --

    "(Man) tries to live his own life as if he were telling a story. But you have to choose: live or tell." --Sartre
  6. Re:LCD what? by chabotc · · Score: 5, Insightful

    This patch patches mozilla to fully use Xft rendering. The other patch patched mozilla to use GDK rendering.

    Mozilla is trying to move away from using gdk for its font rendering to make it more portable and less reliant on gdk. Also it should be more flexiable and faster.

    I gues the difference in size comes from the fact that it takes more code to use Xft directly then to use libgdkxft. (this is kinda obvious, since the Xft using code is then in libgdkxft).

    Bottom line though, the libgdkxft patch didnt have a chance to get included in main stream mozilla, where as this ones probably does.

  7. Lets get some facts straight first. by clump · · Score: 4, Insightful
    That Linux has to kludge in a feature that Windows has had for seven years?

    So basically, we are still waiting for it to be a standard feature?

    What I think people should keep in mind is that you are comparing a multi-billon-dollar corporation with access to all kinds of patents and trade secrets to what *volunteers* do in their spare time. Keep in mind access to good fonts are what corporations like Microsoft and Apple *slow down* to keep people on their platforms.

    If you want to stick your head out against possible liability so others can *freely* use something be my guest. At least don't criticize when others do.
    1. Re:Lets get some facts straight first. by Graff · · Score: 5, Interesting
      Microsoft distributes the base true type fonts at no cost, in fact they either invented or popularized the (usually inexpensive) true type font system to compete with expensive fonts from other vendors.

      Well, actually Microsoft only agreed to use TrueType when it came out. It was actually developed by Apple. They developed it for Windows and Macintosh in order to combat Adobe's strangle hold on the market. Here's an intresting quote on Microsoft's site on TrueType:
      The TrueType digital font format was originally designed by Apple Computer, Inc. It was a means of avoiding per-font royalty payments to the owners of other font technologies, and a solution to some of the technical limitations of Adobe's Type 1 format.

      You can see a pretty detailed history of TrueType on this web page.

  8. This is actually a new feature for Mozilla... by OneFix · · Score: 5, Informative

    Yea, the tree closed for 0.9.8 like a week ago. Tree Closes for 0.9.8. For those that don't want to click the link, here's what it says...

    ...0.9.8 will have a variety of new items including new natively drawn widgets on WindowsXP, Mac OS X, and GTK, when you are in the classic skin (We will have more on this later, including screenshots)...

    If you're really interested in what's going on with the project, try the latest Build Comments

    Yesterday was the last of the frozen trunk builds. And if that's not enough, the Tree Is Opened for 0.9.9 checkins.

    And there's now a Mozilla 1.0 Manifesto that lays down precisely what Mozilla 1.0 should be (which will come right after 0.9.9).

    Of course, it's nice to see a change in SlashDot change its view of the project. But, then again, maybe I was right all along. :)

  9. Re:Huh? by keithp · · Score: 5, Informative
    Why don't you concentrate on making sure the code works instead of aiming for some arbitrary patch size?


    It's not arbitrary; I believe about 3/4 of the patch consist of unnecessary changes to code that shouldn't be executed in the Xft code path. Unfortunately, the internal abstractions for dealing with fonts are somewhat strained in the current code base, making this assertion testable but not easily verified by visual inspection.

  10. Mozilla just keeps getting cooler. by BgCntry · · Score: 4, Insightful

    No matter what gets said here about feature bloat and endless delays, Mozilla is just the coolest and most ambitious browser out there. At this rate it's well on its way to becoming the Emacs of the browser world, and it might even be there now. I've been using it as my main browser for god-knows-how-long. It's been fascinating to watch it evolve from the early milestone releases up to now.

    Hell, Mozilla's never going to be finished, and I don't really care to see it finished either. I'd have to find a new religion.

    1. Re:Mozilla just keeps getting cooler. by pergamon · · Score: 5, Funny

      I'm pretty sure emacs fanatics will tell you that emacs already is the emacs of the browser world.

  11. Depends by jeti · · Score: 5, Informative

    Antialiased fonts can look extremely good and
    make reading less stressful for the eyes.

    Look at text in newer versions of MacOS, BeOS
    or Windows XP. Especially at LCD screens the
    quality is absolutely convincing.

    BUT you need not only a good font renderer, but
    also fonts that are hinted correctly.

  12. XFT is... by skia · · Score: 5, Informative
    For the uninitiated:

    Xft is a simple library designed to interface the FreeType rasterizer with the X Rendering Extension.


    FreeType is a software font engine that can be used in graphics libraries, display servers, font conversion tools, text image generation tools, etc. to produce high quality glyphs and characters. The important thing here is that FreeType supports Adobe Type1 and TrueType (that is, Windows) scalable fonts.


    the X Rendering Extension is a protocol that represents a new way to render (that is, draw) stuff on your screen in X windows.


    thus, Xft's incorporation into Mozilla gives us smooth, high quality, Windows compatible fonts while surfing the web on Linux or *BSD

    --

    --

  13. Unfortunately .. by Eloquence · · Score: 5, Insightful
    .. the screen-shot still shows the flaws of anti-aliasing under Linux. Take a look at the "k" in the "Bookmarks" text on the toolbar, or at the "W" in Wednesday -- this is what it actually looks like if you turn on anti-aliasing under KDE. Some fairly standard fonts just get really ugly and you have to search a long time until you have disabled all of them everywhere without removing them (webpages can probably still use them), or you have to disable anti-aliasing entirely at certain font sizes (haven't figured out how to do that yet, but haven't really looked either, KDE doesn't seem to have an option for it at least, but somewhere in the mess that is X configuration I'm sure it's possible).

    Even if Linux desktop installations weren't so horribly deployed as they are by most distributors (I completely lost faith in SuSE after their handling of the Euro-Sign, I think that they are no longer interested in ordinary desktop users), anti-aliasing algorithms itself could probably be much improved, although the Freetype page points out that Apple patents are a problem and some features had to be disabled (damn you, Apple!). All in all, I'm not happy with anti-aliasing support at all, except for subpixel rendering, which works very well on my Notebook. (And don't give me the "You didn't pay, don't complain" bullshit -- I paid a lot of cash to distributors already, but they seem to prefer to spend it on the server end).

    1. Re: Unfortunately .. by Sandmann · · Score: 4, Informative

      > the screen-shot still shows the flaws of antialiasing under Linux

      You are right that the k and the W don't look good, but that does not have anything to do with your kernel, but rather the fact that Verdana and Times should not be antialiased at that size. Antialiasing these fonts at that size with hinting enabled is really font murder.

      You don't want hinting enabled with antialiasing at that size, because hinting is a way to distort the fonts so that they can be rendered at very low resolution, and antialiasing is essentially a cheasy way to increase resolution. That is why you see the weird "k": the hints don't expect the resolution to be this high.

      Here is a piece of an actual screenshot, showing Verdana mostly un-antialiased, and antialiased in the preview box in the fontselector.

      As others pointed out, to match Windows in quality you will need high quality fonts. Of couse, the MS/Monotype fonts (Ariel, Verdana, Trebuchet, etc) are well done and especially well-hinted (if you don't antialias them at sizes where they shouldn't be), but actually the Luxi fonts that are shipping with XFree86 4.2 are not bad - their hints just need some work.

      For fun, I hinted Luxi Sans (with the Gimp) at a few sizes. This is not a real screenshot, but it does show how it could look with better hints. (Note that the bold antialiased Luxi Serif is not hinted at all - a bit of careful hinting would probably improve it somewhat).

      > anti-aliasing algorithms itself could
      > probably be much improved, although the
      > Freetype page points out that Apple patents

      This is nonsens. The Apple patent covers the interpreter for the hints in TrueType fonts. Most distributions turn the interpreter on, regardless of the patent, and in fact the bad rendering of the "k" that you complain about is there precisely because both interpreter and antialiasing were used.