Last Comment Bug 400265 - trunk uses wrong (unwanted) rendering engine for fonts
: trunk uses wrong (unwanted) rendering engine for fonts
Status: RESOLVED FIXED
:
Product: Core
Classification: Components
Component: Graphics (show other bugs)
: Trunk
: x86 Linux
: -- major with 5 votes (vote)
: ---
Assigned To: Karl Tomlinson (:karlt)
:
Mentors:
http://www.mozilla.org/projects/minef...
Depends on: 385263 404637
Blocks:
  Show dependency treegraph
 
Reported: 2007-10-18 03:30 PDT by m
Modified: 2011-10-09 22:21 PDT (History)
6 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
Incorrect font rendering with Manfield 3.0a9pre (136.26 KB, image/png)
2007-10-18 03:30 PDT, m
no flags Details
Correctly rendered fonts in Firefox 2.0.0.7 (174.97 KB, image/png)
2007-10-18 03:31 PDT, m
no flags Details
Manfield 3.0a9pre with hintslight (128.32 KB, image/png)
2007-10-18 16:16 PDT, m
no flags Details

Description m 2007-10-18 03:30:09 PDT
User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-GB; rv:1.8.1.7) Gecko/20070914 Firefox/2.0.0.7
Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-GB; rv:1.8.1.7) Gecko/20070914 Firefox/2.0.0.7

I have just downloaded latest version of manfield and noticed, that it uses different rendering engine for font rendering which actually makes fonts look ugly and difficult to read (see attachments). 

Reproducible: Always

Steps to Reproduce:
1. Run Manfield
2. Open i.e. http://www.mozilla.org/projects/minefield/
3. It affects all pages, every time.
Actual Results:  
Fonts are rendered incorrectly, doesn't look consistent with GNOME.

Expected Results:  
Consistent font rendering - if I like mac os style of font rendering, I would like to see Firefox using it too. Version 2.0.0.7 works fine, but newest Manfield doesn't. 

more information about font rasterization: http://antigrain.com/research/font_rasterization/index.html
Comment 1 m 2007-10-18 03:30:53 PDT
Created attachment 285344 [details]
Incorrect font rendering with Manfield 3.0a9pre
Comment 2 m 2007-10-18 03:31:22 PDT
Created attachment 285345 [details]
Correctly rendered fonts in Firefox 2.0.0.7
Comment 3 m 2007-10-18 03:52:49 PDT
maybe this will help:

(gecko:5298): Pango-WARNING **: failed to create cairo scaled font, expect ugly output. the offending font is 'Verdana 0'

(gecko:5298): Pango-WARNING **: failed to create cairo scaled font, expect ugly output. the offending font is 'Verdana 0'

(gecko:5298): Pango-WARNING **: shaping failure, expect ugly output. shape-engine='BasicEngineFc', font='Verdana 0', text='Polish   Dzień dobry, Hej'

(gecko:5298): Pango-WARNING **: pango_font_get_glyph_extents called with null font argument, expect ugly output
Comment 4 Karl Tomlinson (:karlt) 2007-10-18 14:03:36 PDT
What output do you see from: "xrdb -query | grep -i Xft"?
fontconfig can specify hinting too: does moving your ~/.fonts.conf make a difference.
Comment 5 m 2007-10-18 14:18:01 PDT
[marek@Mareg ~]$ xrdb -query | grep -i Xft
Xft.antialias:  1
Xft.dpi:        96.000000
Xft.hinting:    1
Xft.hintstyle:  hintfull
Xft.rgba:       rgb
[marek@Mareg ~]$ 

and moving ~/.fonts.conf makes firefox 2.0.0.7 fonts like in Trunk (ugly)
Comment 6 m 2007-10-18 14:19:47 PDT
also need to set layout.css.dpi to 96 because Manfield (Trunk) makes fonts larger with layout.css.dpi set to 0 or -1
Comment 7 Karl Tomlinson (:karlt) 2007-10-18 14:26:56 PDT
(In reply to comment #6)
> also need to set layout.css.dpi to 96 because Manfield (Trunk) makes fonts
> larger with layout.css.dpi set to 0 or -1

Yes, I suspect many people will be wanting to set that.


Comment 8 Karl Tomlinson (:karlt) 2007-10-18 14:37:02 PDT
(In reply to comment #5)
> and moving ~/.fonts.conf makes firefox 2.0.0.7 fonts like in Trunk (ugly)

"ugly" is a matter of opinion - I and probably a few other people prefer well hinted fonts.

But you can customize: "echo Xft.hintstyle: hintslight | xrdb -merge" should give you something close to what you prefer.  To set this more permanently, I believe gnome has a setting for it or I hope gnome reads ~/.Xresources.

The difference between 2.0.0.7 and trunk is probably that 2.0.0.7 selected helvetica (and maybe your ~/.fonts.conf mapped that to something else) but trunk uses fontconfig's default sans-serif (fc-match -v sans-serif).  If this is different to other GNOME apps then I guess you've (or someone else has) specified a different font for GNOME/gtk.  You can specify the same font in Mozilla preferences if you like, or .fonts.conf can be used to specify your preference for sans-serif.
Comment 9 m 2007-10-18 15:30:04 PDT
I don't think it is the matter of chosen font as it applies to all fonts rendered on the page - basically I use different FreeType - taken from http://avi.alkalay.net/linux/docs/font-howto/Font.html#freetype - which makes fonts look more natural. Please look at attached screenshots and compare text in bold - it's basically the same font, but rendered using different rendering engine. That one which looks more natural (usually called "Adobe style") is my preferred rendering engine, other one (usually called "Microsoft style") is not what I like to see. Unfortunately switching to 'hintslight' doesn't solve a problem as Trunk still uses wrong rendering engine (it looks better though).

All my Gnome Apps are rendering fonts in the way I want and I like it, and would love to see Trunk to behave in the same way.
Comment 10 m 2007-10-18 15:52:28 PDT
ok, as it still uses wrong font rendering engine the actual output looks much better. is there an easy way to force Trunk to use system default font rendering engine?
Comment 11 Karl Tomlinson (:karlt) 2007-10-18 16:00:21 PDT
Trunk will use freetype from your system.  The only component different in the font rendering stack is a different cairo, but I doubt that is the issue.

I can see the difference in the screen shots but its hard to tell whether exactly the same font is used.

Try Xft.hintstyle: hintmedium.

What was it in your fonts.conf that changed the behavior of firefox 2.0.0.7?
Comment 12 m 2007-10-18 16:16:15 PDT
Created attachment 285418 [details]
Manfield 3.0a9pre with hintslight

As you can see, it looks better but still it's a different rendering engine.

The behavior of Firefox 2.0.0.7 has changed after I've deleted .fonts.conf - when I restored it, Firefox 2.0.0.7 rendered fonts correctly.
Comment 13 Sylvain Pasche 2007-11-23 15:03:08 PST
(In reply to comment #11)
> Trunk will use freetype from your system.  The only component different in the
> font rendering stack is a different cairo, but I doubt that is the issue.

Cairo may be the issue. I did some comparison between cairo 1.4 (usually what's shipped on recent distributions) and cairo 1.5 (more or less what is included in Firefox) and there is a difference in rendering: see bug 375591 comment 6. This is what makes the font look thinner, in particular when using freetype bytecode interpreter for hinting (default on Ubuntu).

bug 404637 may also be of interest
Comment 14 Karl Tomlinson (:karlt) 2008-09-07 16:43:49 PDT
(In reply to comment #5)
> [marek@Mareg ~]$ xrdb -query | grep -i Xft
> Xft.antialias:  1
> Xft.dpi:        96.000000
> Xft.hinting:    1
> Xft.hintstyle:  hintfull
> Xft.rgba:       rgb
> 
> and moving ~/.fonts.conf makes firefox 2.0.0.7 fonts like in Trunk (ugly)

So it sounds like part of the issue here is that X resource settings are (incorrectly) taking priority over fontconfig settings, which is
https://bugs.freedesktop.org/show_bug.cgi?id=11838

Changes in bug 385263 should resolve that issue.

The remaining issues (comment 12) I think are covered by bug 404637.
Comment 15 Karl Tomlinson (:karlt) 2008-09-29 13:28:48 PDT
Changes in bug 385263 mean that fontconfig settings for hintstyle now take precedence over X resource settings (as they did for Xft).

But Mozilla's cairo is not yet built with lcdfilter support, which is bug 404637.
Comment 16 Karl Tomlinson (:karlt) 2011-10-09 22:21:14 PDT
Bug 404637 has also been fixed.

Note You need to log in before you can comment on or make changes to this bug.