hardware accelerated graphics and text in firefox!

| 31 Comments

With all the excitement around those two great articles on JagerMonkey yesterday, I forgot to blog about another amazing development, the DirectWrite & Direct2D landing in the nightly builds (though pref'd off.)

DirectWrite and Direct2D are Windows Vista and Windows 7 APIs for text and 2-D graphics that can be hardware accelerated.

This is brand new code and there are sure to be bugs. If you'd like to help us test these changes and you're on a supported platform, please download the latest nightly build and make these changes to enable the features:

  1. Enter 'about:config'
  2. Click through the warning, if necessary
  3. Enter gfx.font in the 'Filter' box
  4. Double-click on 'gfx.font_rendering.directwrite.enabled' to set it to true
  5. Below this, right click and select New > Integer to add a pref setting
  6. Enter 'mozilla.widget.render-mode' for the preference name, 6 for the value
  7. Restart

(To disable, set gfx.font_rendering.directwrite.enabled to false, delete mozilla.widget.render-mode, then restart.)

If you find bugs, please report them here or to Bugzilla.

note: Some extensions like stylish and adblock+ may break the new features. If you're not seeing the new DirectWrite and Direct2D changes, try starting in Safe Mode.

update: If you want to help others find and test this new feature, please digg it. Thanks.

update2: The fonts look really great with DirectWrite enabled. Really great.

31 Comments

Asa, where can I find more information on Adblock Plus breaking this feature? Particularly how I would see that it is broken? I guess that it is fixed in the latest development build (https://adblockplus.org/devbuilds/adblockplus/) but it would be nice to verify.

Wladamir, this might be a starting point https://bugzilla.mozilla.org/show_bug.cgi?id=549090

- A

Applying this changes to the nightly build made it crash upon start and also rendered my actual firefox 3.6 unusable. I had to research and manually modify the preferences file to make firefox work again for me.

You should do this under a different profile or inside a virtual machine...

Matias, can you type about:crashes in the addressbar and locate the crash report(s) that this change caused?

- A

Ah, ok, my guess was correct then. This issue is already fixed in the development builds of Adblock Plus then (because of https://bugzilla.mozilla.org/show_bug.cgi?id=542111).

Can we get some screenshots?

Sorry to be off-topic, but in Firefox 3.6, the back button fails to work on this blog Asa, any idea's as to why that could be?

what about the linux platform?

I am not sure if I am seeing any difference, maybe you could post some screenshots comparing the font quality?

Ionut: Linux doesn't offer comparable APIs yet.

The font rendering looks awful unless I zoom in.

And when I zoom in the text looks really, really nice.

Just to show an example.
http://i48.tinypic.com/25pog38.jpg
Normal rendering at the top.

I have the same problem as Matias Jose.

@Stuart Foy: The underline actually looks better with normal rendering. Assuming that the top text is without the Direct2D enabled.

Ugh. From Stuart Foy's screen capture, it looks like this is going to make the fonts as ugly and (at slightly smaller sizes, unreadable) on my PC as they are on my Mac. I appreciate the desire to show off your sub-pixel rendering, but below about 11-13 pixels fonts just look better aliased. (IMO, of course.) I'm glad this is off by default, but I'm guessing I'll need to bookmark this page so I can remember how to turn it off manually when the next major version of Firefox comes out.

Actually, I take it back, font looks really really nice now. I also noticed that certain pages, such as Ajaxian, scroll much smoother now (try zooming in 3x first) compared to without Direct2D.

Is there any equivalent API for Mac OS X?

Every thing does look really nice in some places, especially when zoomed in.

But iGoogle is an eye sore for me. Much faster though, when zoomed in, which is a god send!

the fonts look great with DirectWrite? Nope, for me it looks horrible. It becomes blurry and the edges of the fonts somehow "bleed out", especially the URL links, really really bad.

It also crashes all the time, or showing blank pages and strange things when navigating between pages. Currently it looks quite bad and it's way too crashy.

Hi

i get some strange graphic errors when scrolling:

http://s5b.directupload.net/images/100302/mluitfgn.jpg

the slower I scroll the closer the lines are

i used firefox-3.7a3pre.en-US.win32.zip
no addons or other stuff

@wechrome

"This is brand new code and there are sure to be bugs."

I can confirm the issue that Akira has experienced with seeing lines when scrolling. I think that it was Fx 2 that had a similar or same problem.
I'm not technically knowledgeable enough (about anything) to know what's up, but it's like the page is being drawn/rendered too fast because,
the lines seem to show up (more often than not) towards the end of pages, and,
the lines hardly appear at all when the page is refreshed a few times.
Each time that the page is refreshed, the lines appear lower and lower on the page until they're gone completely and the issue goes away (somewhat, and not always) except for the very bottom of the page. Zooming in or out (by any factor) works the same as refreshing.

Anything to do with caching?
The lines appear right through and regardless of what the content is (text, graphics, etc).

Is there a specific bug filed for this issue yet?

@ Matias anything with the word nightly associated with it should be done in a new profile first.
In case you didn't know about this, I left some comments about how to run multiple versions of Firefox simultaneously here.
http://lifehacker.com/comment/19906785

I've had a major issue with page scrolling speed slowing to a crawl when pages are zoomed in 3.6. I didn't notice this in the nightly. Perhaps it's an add-on causing the issue for me.

@ Chris
History altogether doesn't work (back or forward).
That's odd.

I've had 3.7 running for 30-40 minutes now and it hasn't crashed. It's actually very fast on the slowest sites that I visit the most (AMO, deviantART.com and others).

As far as the quality of the appearance of fonts, I'm afraid that I can't offer any feedback on that. I need to zoom pages to read them.


Oh, one other thing, it would be cool if the about:config changes showed up in about:support under Modified Preferences to know what to remove and revert back to as far as settings.
I guess that it's still very early though.

@José

from my experience, "there are sure to be bugs" is quite an understatement, "it may likely be completely unusable" sounds more appropriate...

well, maybe it has something to do with the nVidia GT240M mobile GPU I have in my notebook...

http://img59.imageshack.us/img59/5121/flashavisnapshot0003201.png

Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.3a3pre) Gecko/20100302 Minefield/3.7a3pre


The comparable api for 2d and text is formed by OpenGL and OpenVG.
(OpenGL can render images and glyphs very fast. OpenVG is svg almost completely natively accelerated. The svg file is almost sent to the graphic card and rendered there, it's svg on steroids. )

Come on Firefox, support SVGFONTS and use OpenGL+OpenVG.
It's the alternative API for Linux, UNIX, MAC, (ES version for iPhone and Google's Android.)


Don't forget to work on letting the text have motion blur when scrolling.
Strange as it sounds, this makes scrolling (moving) text better readable.

The fonts are smoooooth. Firefox's back button does not work on this page though, really weird.

I don't like the new font rendering. It makes it harder to read.

Why didn't they just make the Cairo library more hardware accelerated ? It already had some acceleration if I'm not mistaken.

hello.
i use fx4b10. i have turned everything on (D2D etc..).
WIN7 Dx10.1 ATI mob Radeon 3400.

i had never thought something simple like this would make internet niver,lol.
it looks cleary better now.
thanks for this. now i dont have to zoom in all the time. the fonts have brighter colors.

Monthly Archives