Bug 13479 - Ugly Courier New font with cairo 1.4.12
Summary: Ugly Courier New font with cairo 1.4.12
Status: RESOLVED FIXED
Alias: None
Product: cairo
Classification: Unclassified
Component: freetype font backend (show other bugs)
Version: 1.4.12
Hardware: Other All
: medium normal
Assignee: David Turner
QA Contact: cairo-bugs mailing list
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-11-30 23:52 UTC by lonefox
Modified: 2008-01-11 14:58 UTC (History)
2 users (show)

See Also:
i915 platform:
i915 features:


Attachments
Screenshot of Courier New (xlib backend) (11.68 KB, image/png)
2007-12-17 00:28 UTC, Sylvain Pasche
Details
Screenshot of Sazanami Mincho (xlib backend) (9.98 KB, image/png)
2007-12-17 00:35 UTC, Sylvain Pasche
Details
Courier New on png backend (first glyph with bitmap strike) (10.61 KB, image/png)
2007-12-17 00:42 UTC, Sylvain Pasche
Details

Description lonefox 2007-11-30 23:52:11 UTC
With cairo 1.4.12, the Courier New font looks very ugly in various gtk-based programs.  I think it is rendered without any antialiasing at all.

It is caused by this change:
http://gitweb.freedesktop.org/?p=cairo;a=commitdiff;h=06af5c2891b89da28581c30afcde06c5442884db
I recompiled cairo with that code commented out and the font returned to normal.
Comment 2 Behdad Esfahbod 2007-12-16 22:24:16 UTC
Fixed on master.  Can you give it a try:

commit 83963d2a9ec445e23cfbe692b877177a9d9d135e
Author: Behdad Esfahbod <behdad@behdad.org>
Date:   Mon Dec 17 01:19:53 2007 -0500

    [cairo-ft] Revert "Force non-AA text when using a bitmap strike with only scaling transform." (#13479)
    
    The reasoning for that commit was that fonts with bitmap strikes should be
    rendered with antialiasing off for those (hopefully) few glyphs that don't
    have a bitmap.
    
    However, it turns out, there are fonts that have some, but very few, bitmaps,
    and this changed forces non-AA rendering on them.  We now support multiple
    glyph formats per font in the Xlib backend, so backing this out to let every
    glyph render as is.  Fontconfig rules can be used to force AA off on a per-font
    basis.
    
    This reverts commit 06af5c2891b89da28581c30afcde06c5442884db.

commit 805b668260c47e6d3d854361fcc53f12bd2a57e1
Author: Behdad Esfahbod <behdad@behdad.org>
Date:   Mon Dec 17 01:14:27 2007 -0500

    [cairo-xlib] Support scale fonts with glyphs of multiple formats (#13479)
    
    We maintain three Xrender glyphsets per scaled font, one for each of A1, A8,
    and ARGB32.  This is required to correctly support fonts with bitmaps for
    some glyphs but not all.

Comment 3 Sylvain Pasche 2007-12-17 00:28:39 UTC
Created attachment 13154 [details]
Screenshot of Courier New (xlib backend)

Thanks Behdad, this is now working as expected. The screenshot shows Courier New on the xlib backend. The first glyph has a bitmap strike and is not antialiased (source is a slight modification of the testcase on http://lists.cairographics.org/archives/cairo/attachments/20071212/230663a6/attachment.c)
Comment 4 Sylvain Pasche 2007-12-17 00:35:41 UTC
Created attachment 13155 [details]
Screenshot of Sazanami Mincho (xlib backend)

The third glyph here has a bitmap strike (U+8FE6), while the first has none and is antialiased (U+8FE8)
Comment 5 Behdad Esfahbod 2007-12-17 00:38:19 UTC
Thanks for testing.
Comment 6 Sylvain Pasche 2007-12-17 00:42:11 UTC
Created attachment 13156 [details]
Courier New on png backend (first glyph with bitmap strike)

On PNG surface, there is still the issue described by Keith: http://lists.cairographics.org/archives/cairo/2007-October/011788.html

"If the first glyph has a bitmap version, cairo assumes that all of the glyphs will and creates the font in A1 format."

In this screenshot, the first glyph has a bitmap strike, so the others are not antialiased. This issue with very rare with Courier New, as it has only three glyphs with bitmap, but that could occur more often with Sazanami which has a lot more of bitmaps.
Comment 7 Behdad Esfahbod 2007-12-17 09:23:26 UTC
Right.  Lets fix image backend too then.
Comment 8 Carl Worth 2008-01-11 14:58:26 UTC
I've fixed the image backend so that glyphs that should be antialiased will now be rendered with antialiasing even if the first glyph happens to have a bitmap strike.

Also, I noticed that when rendering sub-pixel antialiased glyphs, that bitmap-strike glyphs were not being rendered at all. My fix takes care of this additional problem by simply turning off the sub-pixel antialiasing in such cases, (though grayscaled antialiasing still occurs).

Behdad is palnning to do a more complete fix that would maintain the sub-pixel antialiasing. But that's a separate issue, so I'm closing this bug report now.

My fix is on the master (1.5) branch here:

http://cgit.freedesktop.org/cairo/commit/?id=ecb895803b9d2a3fd142f4a2c694ca08c5581f0e

and is also on the 1.4 branch (so will appear in the upcoming 1.4.14 release) here:

http://cgit.freedesktop.org/cairo/commit/?h=1.4&id=35ed062a6269feeebae70c98000b60630a9ec3bd

Thanks for your report, and have fun with cairo!

-Carl


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.