Evas Fontconfig changes

* Move evas fontconfig changes out of the search loop
 * Use the whole font name for the search pattern this allow things like
   "Bitstream Vera Serif,Kochi Gothic" so you can manually setup fallbacks


SVN revision: 21407
This commit is contained in:
stffrdhrn 2006-03-19 11:17:43 +00:00 committed by stffrdhrn
parent 241fa61949
commit b1e03e8791
1 changed files with 35 additions and 37 deletions

View File

@ -238,43 +238,6 @@ evas_font_load(Evas *evas, const char *name, const char *source, int size)
}
#ifdef BUILD_FONT_LOADER_EET
}
#endif
#ifdef HAVE_FONTCONFIG
if (!font) /* Search using fontconfig */
{
FcPattern *p_nm = NULL;
FcFontSet *set;
FcResult res;
int i;
p_nm = FcNameParse(nm);
FcConfigSubstitute(NULL, p_nm, FcMatchPattern);
FcDefaultSubstitute(p_nm);
/* do matching */
set = FcFontSort(NULL, p_nm, FcTrue, NULL, &res);
/* Do loading for all in family */
for (i = 0; i < set->nfont; i++)
{
FcValue filename;
FcPatternGet(set->fonts[i], FC_FILE, 0, &filename);
if (font)
evas->engine.func->font_add(evas->engine.data.output, font, filename.u.s, size);
else
font = evas->engine.func->font_load(evas->engine.data.output, filename.u.s, size);
}
FcFontSetDestroy(set);
FcPatternDestroy(p_nm);
if (font)
{
break;
}
}
#endif
}
else /* Base font loaded, append others */
@ -342,6 +305,41 @@ evas_font_load(Evas *evas, const char *name, const char *source, int size)
evas_stringshare_del(nm);
}
evas_list_free(fonts);
#ifdef HAVE_FONTCONFIG
if (!font) /* Search using fontconfig */
{
FcPattern *p_nm = NULL;
FcFontSet *set;
FcResult res;
int i;
p_nm = FcNameParse(name);
FcConfigSubstitute(NULL, p_nm, FcMatchPattern);
FcDefaultSubstitute(p_nm);
/* do matching */
set = FcFontSort(NULL, p_nm, FcTrue, NULL, &res);
/* Do loading for all in family */
for (i = 0; i < set->nfont; i++)
{
FcValue filename;
FcPatternGet(set->fonts[i], FC_FILE, 0, &filename);
if (font)
evas->engine.func->font_add(evas->engine.data.output, font, filename.u.s, size);
else
font = evas->engine.func->font_load(evas->engine.data.output, filename.u.s, size);
}
FcFontSetDestroy(set);
FcPatternDestroy(p_nm);
}
#endif
fd = calloc(1, sizeof(Fndat));
if (fd)
{