]> granicus.if.org Git - libass/commitdiff
When building font pattern, treat both ' ' and '-' as word separators.
authoreugeni <eugeni@b3059339-0415-0410-9bf9-f77b7e298cf2>
Sun, 11 May 2008 20:17:21 +0000 (20:17 +0000)
committereugeni <eugeni@b3059339-0415-0410-9bf9-f77b7e298cf2>
Sun, 11 May 2008 20:17:21 +0000 (20:17 +0000)
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@26742 b3059339-0415-0410-9bf9-f77b7e298cf2

libass/ass_fontconfig.c

index 58dc10be6ed0607b234aee2ed75cfacb47b581d8..ed64d81171746c8e3107a340e7dcbd1602b96f03 100644 (file)
@@ -105,13 +105,15 @@ static char* _select_font(fc_instance_t* priv, const char* family, unsigned bold
        // An alternative approach could be to reimplement FcFontSort
        // using FC_FULLNAME instead of FC_FAMILY.
        family_cnt = 1;
-       if (strchr(family, ' ')) {
-               char *p, *s = strdup(family);
-               while (p = strrchr(s, ' ')) {
-                       *p = '\0';
-                       FcPatternAddString(pat, FC_FAMILY, (const FcChar8*)s);
-                       ++ family_cnt;
-               }
+       {
+               char* s = strdup(family);
+               char* p = s + strlen(s);
+               while (--p > s)
+                       if (*p == ' ' || *p == '-') {
+                               *p = '\0';
+                               FcPatternAddString(pat, FC_FAMILY, (const FcChar8*)s);
+                               ++ family_cnt;
+                       }
                free(s);
        }
        FcPatternAddBool(pat, FC_OUTLINE, FcTrue);