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

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@26742 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
eugeni 2008-05-11 20:17:21 +00:00
parent 38836c7837
commit 8a5ba8d99c
1 changed files with 9 additions and 7 deletions

View 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);