Mercurial > MadButterfly
changeset 901:74e3ba4d3fa1
Fix issue of unworking text style.
Text style is not working. It caused by miss understanding on usage
of fontconfig. I think, I had found a right way :P Fix me if I am
wrong!
author | Thinker K.F. Li <thinker@codemud.net> |
---|---|
date | Fri, 01 Oct 2010 12:05:23 +0800 |
parents | f4fd7a16361d |
children | e86b4d56ddea |
files | src/graph_engine_cairo.c |
diffstat | 1 files changed, 7 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/src/graph_engine_cairo.c Fri Oct 01 11:18:31 2010 +0800 +++ b/src/graph_engine_cairo.c Fri Oct 01 12:05:23 2010 +0800 @@ -19,7 +19,7 @@ */ static FcPattern *query_font_pattern(const char *family, int slant, int weight) { - FcPattern *ptn, *p, *fn_ptn; + FcPattern *ptn, *fn_ptn; FcValue val; FcConfig *cfg; FcBool r; @@ -32,8 +32,7 @@ cfg = FcConfigGetCurrent(); ptn = FcPatternCreate(); - p = FcPatternCreate(); - if(ptn == NULL || p == NULL) + if(ptn == NULL) goto err; val.type = FcTypeString; @@ -48,17 +47,17 @@ val.u.i = weight; FcPatternAdd(ptn, "weight", val, FcTrue); - r = FcConfigSubstituteWithPat(cfg, ptn, NULL, FcMatchPattern); + FcDefaultSubstitute(ptn); + + r = FcConfigSubstituteWithPat(cfg, ptn, ptn, FcMatchPattern); if(!r) goto err; - r = FcConfigSubstituteWithPat(cfg, p, ptn, FcMatchFont); + r = FcConfigSubstituteWithPat(cfg, ptn, ptn, FcMatchFont); if(!r) goto err; - FcDefaultSubstitute(p); - - fn_ptn = FcFontMatch(cfg, p, &result); + fn_ptn = FcFontMatch(cfg, ptn, &result); /* It is supposed to return FcResultMatch. But, it is no, now. * I don't know why. Someone should figure out the issue. @@ -73,15 +72,12 @@ goto err; FcPatternDestroy(ptn); - FcPatternDestroy(p); return fn_ptn; err: if(ptn) FcPatternDestroy(ptn); - if(p) - FcPatternDestroy(p); return NULL; }