# HG changeset patch # User Thinker K.F. Li # Date 1285905923 -28800 # Node ID 74e3ba4d3fa1879b8d506658e584722c4a50a55c # Parent f4fd7a16361d39fabeb88b3dac8c8671b2b05cf4 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! diff -r f4fd7a16361d -r 74e3ba4d3fa1 src/graph_engine_cairo.c --- 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; }