]> git.sesse.net Git - vlc/commitdiff
freetype: initialise fontresult to FcResultMatch
authorIlkka Ollakka <ileoo@videolan.org>
Sat, 1 Aug 2009 10:04:19 +0000 (13:04 +0300)
committerIlkka Ollakka <ileoo@videolan.org>
Sat, 1 Aug 2009 10:08:42 +0000 (13:08 +0300)
fontconfig doesn't really seem to set that result variable correctly
in allmost all cases, only few codepaths that it's setted to NoMatch,
but it doesn't get setted on valid paths or configerrors or any of
thosecases. Thanks to Laurent Aimar for this one.

modules/misc/freetype.c

index 00090cc9a82756c9386d570ed4683c46387f3841..d0f40115f691a7ac67b81fb5f2acc2df88700956 100644 (file)
@@ -298,7 +298,9 @@ static int Create( vlc_object_t *p_this )
 
 #ifdef HAVE_FONTCONFIG
     FcPattern     *fontpattern = NULL, *fontmatch = NULL;
-    FcResult       fontresult = FcResultNoMatch;
+    /* Initialise result to Match, as fontconfig doesnt
+     * really set this other than some error-cases */
+    FcResult       fontresult = FcResultMatch;
 #endif
 
 
@@ -362,6 +364,9 @@ static int Create( vlc_object_t *p_this )
         goto error;
     FcDefaultSubstitute( fontpattern );
 
+    /* testing fontresult here doesn't do any good really, but maybe it will
+     * in future as fontconfig code doesn't set it in all cases and just
+     * returns NULL or doesn't set to to Match on all Match cases.*/
     fontmatch = FcFontMatch( NULL, fontpattern, &fontresult );
     if( !fontmatch || fontresult == FcResultNoMatch )
         goto error;