diff options
author | Behdad Esfahbod <behdad@behdad.org> | 2008-12-31 20:16:40 -0500 |
---|---|---|
committer | Behdad Esfahbod <behdad@behdad.org> | 2009-02-13 16:54:05 -0800 |
commit | 6d764a3f9b89f21b5c2cdf48cbd913b9706d42b2 (patch) | |
tree | 3f0976ca0150dc91ae8b86a8e2a54239ee3dddcd /src/fcmatch.c | |
parent | a5a384c5ffb479e095092c2aaedd406f8785280a (diff) |
[fcmatch] Move FcFontSetMatch() functionality into FcFontSetMatchInternal()
Except for the final FcFontRenderPrepare(). This way we have more
flexibility to do caching in FcFontMatch() while leaving FcFontSetMatch()
intact.
Diffstat (limited to 'src/fcmatch.c')
-rw-r--r-- | src/fcmatch.c | 42 |
1 files changed, 29 insertions, 13 deletions
diff --git a/src/fcmatch.c b/src/fcmatch.c index 49dd0dda..556fffea 100644 --- a/src/fcmatch.c +++ b/src/fcmatch.c @@ -459,12 +459,12 @@ FcFontRenderPrepare (FcConfig *config, return new; } -FcPattern * -FcFontSetMatch (FcConfig *config, - FcFontSet **sets, - int nsets, - FcPattern *p, - FcResult *result) +static FcPattern * +FcFontSetMatchInternal (FcConfig *config, + FcFontSet **sets, + int nsets, + FcPattern *p, + FcResult *result) { double score[NUM_MATCH_VALUES], bestscore[NUM_MATCH_VALUES]; int f; @@ -481,12 +481,6 @@ FcFontSetMatch (FcConfig *config, printf ("Match "); FcPatternPrint (p); } - if (!config) - { - config = FcConfigGetCurrent (); - if (!config) - return 0; - } for (set = 0; set < nsets; set++) { s = sets[set]; @@ -537,6 +531,25 @@ FcFontSetMatch (FcConfig *config, *result = FcResultNoMatch; return 0; } + return best; +} + +FcPattern * +FcFontSetMatch (FcConfig *config, + FcFontSet **sets, + int nsets, + FcPattern *p, + FcResult *result) +{ + FcPattern *best; + + if (!config) + { + config = FcConfigGetCurrent (); + if (!config) + return 0; + } + best = FcFontSetMatchInternal (config, sets, nsets, p, result); return FcFontRenderPrepare (config, p, best); } @@ -547,6 +560,7 @@ FcFontMatch (FcConfig *config, { FcFontSet *sets[2]; int nsets; + FcPattern *best; if (!config) { @@ -559,7 +573,9 @@ FcFontMatch (FcConfig *config, sets[nsets++] = config->fonts[FcSetSystem]; if (config->fonts[FcSetApplication]) sets[nsets++] = config->fonts[FcSetApplication]; - return FcFontSetMatch (config, sets, nsets, p, result); + + best = FcFontSetMatchInternal (config, sets, nsets, p, result); + return FcFontRenderPrepare (config, p, best); } typedef struct _FcSortNode { |