[MPlayer-cvslog] r26742 - trunk/libass/ass_fontconfig.c

eugeni subversion at mplayerhq.hu
Sun May 11 22:17:21 CEST 2008


Author: eugeni
Date: Sun May 11 22:17:21 2008
New Revision: 26742

Log:
When building font pattern, treat both ' ' and '-' as word separators.


Modified:
   trunk/libass/ass_fontconfig.c

Modified: trunk/libass/ass_fontconfig.c
==============================================================================
--- trunk/libass/ass_fontconfig.c	(original)
+++ trunk/libass/ass_fontconfig.c	Sun May 11 22:17:21 2008
@@ -105,13 +105,15 @@ static char* _select_font(fc_instance_t*
 	// 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);



More information about the MPlayer-cvslog mailing list