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.

22 of 190 comments (clear)

  1. 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 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. Re:VERY exciting by spectecjr · · Score: 3, Informative

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

      An even better explanation not written by a muppet who doesn't seem to get it that NO, the Apple II did NOT have this first, and NO, his crappy implementation is NOT how it works -- he's only got a 1st order approximation -- can be seen here:

      http://research.microsoft.com/~jplatt/ClearType/de fault.htm

      Oh yeah; read the papers that he links to. That's where you'll get the real scoop on the technique.

      Simon

      --
      Coming soon - pyrogyra
  2. 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.

  3. Re:that you dont know what your talking about... by Quazion · · Score: 2, Informative

    Correct me if i am wrong, but isnt the framebuffer just a buffer ? that gets send to the videocard in a sertain way ?, yeah oke its a Grapical Function/Feature, but not a GUI ( Grapical User Interface ). Its just a layer to put an GUI interface on, Xft adjusts only the GUI interface not ? The framebuffer hasnt got functions to display text i hope, but i could be wrong...

    Quazion.

    Ps. sorry but i am a bad mood and yes i never played with the framebuffer before, i really love X :)

  4. 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. :)

  5. 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.

  6. 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.

  7. 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

    --

    --

  8. 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.
  9. Sooo, How do we build this? by stevek · · Score: 2, Informative

    I'm guessing what I need to do is get a fresh mozilla sourcebase from CVS (just updated to 0-9-8 branch), apply Blizzard's patch (change some paths), get keithp's "fonts" directory from his CVS, build that, then build mozilla..

    Anyone actually get it built?

  10. Re:Mozilla just keeps getting cooler. by LeBleu · · Score: 3, Informative

    Try control + page up or control + page down. They added those as shortcuts for switching tabs the milestone after they added tabbed browsing, as I recall. On an extended keyboard, I can easily do those with just my right hand. Of course, I use my right hand for the mouse, so I don't know if it would help with your dilemma.

    --
    --LeBleu

    If you're reading this you're part of the mass hallucination that is Kevin the Blue.

  11. Re:Mozilla just keeps getting cooler. by fawadhalim · · Score: 3, Informative

    Check out http://www.mozilla.org/projects/ui/accessibility/m ozkeyplan.html. It's got the exaustive list of keyboard shortcuts for Mozilla. (Works with mozilla, though).

  12. Re:Oh dear by jovlinger · · Score: 2, Informative

    Good hinting is key. And is really hard.

    I believe that M$ have several fundamental patents in the area of automatic hinting (which I seem to recall involves global minimazation).
    So don't hold your breath waiting for Linux to get it.

  13. Re:LCD what? by Brian+Kendig · · Score: 3, Informative

    I'm assuming that 'LCD optimizations' refers to antialiasing using specific units in a triad, as has been discussed here a long while ago (with regards to a technology from Microsoft known as 'ClearType', I think -- the only original idea I've ever heard of from Microsoft).

    If I remember correctly, it makes use of the concept that every pixel in a LCD display is made up of a red element, a green element, and a blue element, smooshed together horizontally. So if you antialias black-on-white text by breaking down each pixel into thirds like this, you can get much finer results than if you treated each pixel as an indivisible element. Each character antialiased in this way will be faintly edged with blue on the left and red on the right, but it's not noticeable to a casual user.

    I could be completely misinterpreting the meaning of 'LCD optimizations,' though.

  14. Re: X11 calls by spitzak · · Score: 3, Informative
    Xft does not cause old X11 programs to suddenly be antialiased. What the "native X11 calls" means is that Xft works (in that it produces readable output) if it talks to an X server that lacks the Xrender extension or that lacks the fonts.

    This won't help the end-user much, but it is a huge deal because it removes the main impediment stopping all programs from immediatly switching to xft.

    Normally when somebody makes an "extension" to an existing interface they write it so you cannot use the "extension" without also updating what you are talking to. This means that anybody writing a program using the new interface either has to say "you have to update your drivers" which is user-unfriendly, or they have to put in a big mess of code to "detect" the extension and then have to write two interfaces, one using the extension and one not. The real result is almost nobody uses the extension because it it too much of a pain to write to.

    X is horrid with these things. Shared memory images (an interface now 15 years old) required you to detect whether the server did it and write totally different code for non-shared. The result is that the majority of programs don't use shared memory images. If they had written the detection and emulation into it, I'm sure *EVERY* program would use shared images today.

    Congrats to Keith Packard for figuring this out!

    Now lets see the same thing done for the rest of XRender, so we can get anti-aliased lines and shapes without having to write everything twice.

  15. Re:No offense, but ... by spitzak · · Score: 3, Informative
    Typo there, here is the correct text (on one line like this works):

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

    This goes into ~/.xftconfig or into /etc/X11/XftConfig.

  16. 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.

  17. Re:AA? Goog grief... by BlueGecko · · Score: 3, Informative

    I'd really refrain from editing the prefs.js file directly. Instead, just create a file in the same directory called user.js and store your custom preferences there. user.js is parsed after prefs.js , and is not modified by the GUI when you alter preferences, so if you mess up it's much easier to fix. (And, conversely, you're guaranteed that the GUI won't mess it up for you.)

  18. Re:LCD what? by Reality_X · · Score: 2, Informative

    Unfortunately, Microsoft didn't come up with ClearType. Well, they came up with the name, but the technology was in use by many others before MS, see http://grc.com/ctwho.htm for some information.

    Also, the sub-pixel font rendering was in XFree86 before it was declared "ClearType" and used by MS.

  19. Re:what is this feature.. is it those nice fonts? by marmoset · · Score: 3, Informative
    MicroSoft deserves credit for implementing anti-aliased fonts while both Mac and X people were convincing themselves it was impossible or too slow.


    Um, MacOS >= 8.5 has supported antialiasing by default since 1998, and there was defacto support even earlier than that in Adobe Type Manager 3.x and up, IIRC. The CoreGraphics (Quartz) antialiasing in OSX is visually far superior to what was available in Classic, but AA in general certainly not a Johnny-come-lately feature on Apple's platforms.