[cairo-bugs] [Bug 4674] ft-font-create-for-ft-face works by pure
chance
bugzilla-daemon at freedesktop.org
bugzilla-daemon at freedesktop.org
Mon Dec 19 08:33:53 PST 2005
Please do not reply to this email: if you want to comment on the bug, go to
the URL shown below and enter yourcomments there.
https://bugs.freedesktop.org/show_bug.cgi?id=4674
------- Additional Comments From cworth at cworth.org 2005-12-20 03:29 -------
The following message (with patch) is also significant:
http://lists.freedesktop.org/archives/cairo/2005-December/005814.html
The mail archive doesn't semm entirely reliable, so I'll include the message
inline here as well.
-Carl
From: sunmoon1997 <sunmoon1997 at gmail.com>
Subject: Re: [cairo] test ft-font-create-for-ft-face fails
To: Christian Biesinger <cbiesinger at web.de>
Cc: cairo at cairographics.org
Date: Thu, 08 Dec 2005 17:44:37 +0800
Sender: cairo-bounces at cairographics.org
Ãà 2005-12-07Ãýµà 21:04 -0800£¬Christian BiesingerôµÃ£º
> sunmoon1997 wrote:
> > hi,
> > while running testsuit in cairo, the test ft-font-create-for-ft-face
> > failed with a pretty crash. After a quick look, the problem is
> > FcPatternAddString in fontconfig 2.4 branch doesn't accept null string
> > any more. The fix should be trivial, but I don't know the fix should go
> > cairo or fontconfig, so I attached both of them for review.
>
> Note https://bugs.freedesktop.org/show_bug.cgi?id=4674
>
For this bug:
- I think this test is not correct. A fresh empty pattern is
*meaningless*, you should pass it to fontconfig as input pattern to
match a font, then fontconfig will return a resolved pattern. You can
use this pattern whatever you want.
- cairo_scaled_font_create should check font_face->status.
Index: src/cairo-scaled-font.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-scaled-font.c,v
retrieving revision 1.8
diff -u -p -r1.8 cairo-scaled-font.c
--- src/cairo-scaled-font.c 9 Nov 2005 01:16:21 -0000 1.8
+++ src/cairo-scaled-font.c 8 Dec 2005 09:32:33 -0000
@@ -405,6 +405,9 @@ cairo_scaled_font_create (cairo_font_fac
cairo_scaled_font_map_t *font_map;
cairo_scaled_font_t key, *scaled_font = NULL;
+ if (font_face->status)
+ return (cairo_scaled_font_t *)&_cairo_scaled_font_nil;
+
font_map = _cairo_scaled_font_map_lock ();
if (font_map == NULL)
goto UNWIND;
Index: test/ft-font-create-for-ft-face.c
===================================================================
RCS file: /cvs/cairo/cairo/test/ft-font-create-for-ft-face.c,v
retrieving revision 1.1
diff -u -p -r1.1 ft-font-create-for-ft-face.c
--- test/ft-font-create-for-ft-face.c 17 Aug 2005 16:51:09 -0000 1.1
+++ test/ft-font-create-for-ft-face.c 8 Dec 2005 09:32:34 -0000
@@ -35,7 +35,8 @@ cairo_test_t test = {
static cairo_test_status_t
draw (cairo_t *cr, int width, int height)
{
- FcPattern *pattern;
+ FcPattern *pattern, *resolved;
+ FcResult result;
cairo_font_face_t *font_face;
cairo_scaled_font_t *scaled_font;
cairo_font_options_t *font_options;
@@ -50,7 +51,14 @@ draw (cairo_t *cr, int width, int height
if (!pattern)
return CAIRO_TEST_FAILURE;
- font_face = cairo_ft_font_face_create_for_pattern (pattern);
+ FcConfigSubstitute (NULL, pattern, FcMatchPattern);
+ FcDefaultSubstitute (pattern);
+ resolved = FcFontMatch (NULL, pattern, &result);
+
+ if (!resolved)
+ return CAIRO_TEST_FAILURE;
+
+ font_face = cairo_ft_font_face_create_for_pattern (resolved);
cairo_matrix_init_identity (&font_matrix);
@@ -68,6 +76,7 @@ draw (cairo_t *cr, int width, int height
cairo_font_options_destroy (font_options);
cairo_font_face_destroy (font_face);
FcPatternDestroy (pattern);
+ FcPatternDestroy (resolved);
if (!ft_face) {
cairo_scaled_font_destroy (scaled_font);
_______________________________________________
cairo mailing list
cairo at cairographics.org
http://cairographics.org/cgi-bin/mailman/listinfo/cairo
--
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug, or are watching the QA contact.
More information about the cairo-bugs
mailing list