diff options
author | Behdad Esfahbod <behdad@gnome.org> | 2009-01-08 01:33:23 +0000 |
---|---|---|
committer | Behdad Esfahbod <behdad@src.gnome.org> | 2009-01-08 01:33:23 +0000 |
commit | be5930770ee284b792137a7d7059a9ddb5bb8033 (patch) | |
tree | ebd66a87a7d97aada0a357302e6c6387593c2c84 /pango/pango-context.c | |
parent | a46d5ae6533e46d3522e0a45c3c9d5ded0ea5394 (diff) | |
download | pango-be5930770ee284b792137a7d7059a9ddb5bb8033.tar.gz |
Bug 566726 – Minor optimization
2009-01-07 Behdad Esfahbod <behdad@gnome.org>
Bug 566726 – Minor optimization
* pango/pango-context.c (get_shaper_and_font):
Don't walk the fontset if there are no engines.
svn path=/trunk/; revision=2794
Diffstat (limited to 'pango/pango-context.c')
-rw-r--r-- | pango/pango-context.c | 38 |
1 files changed, 22 insertions, 16 deletions
diff --git a/pango/pango-context.c b/pango/pango-context.c index 4ede1ad4..95916ebe 100644 --- a/pango/pango-context.c +++ b/pango/pango-context.c @@ -1133,28 +1133,34 @@ get_shaper_and_font (ItemizeState *state, info.font = NULL; info.engines = state->exact_engines; - if (state->enable_fallback) - pango_fontset_foreach (state->current_fonts, get_shaper_and_font_foreach, &info); - else - get_shaper_and_font_foreach (NULL, get_base_font (state), &info); - - if (info.shape_engine) + if (info.engines) { - *shape_engine = info.shape_engine; - *font = info.font; - - /* skip caching if fallback disabled (see above) */ if (state->enable_fallback) - shaper_font_cache_insert (state->cache, wc, *shape_engine, *font); + pango_fontset_foreach (state->current_fonts, get_shaper_and_font_foreach, &info); + else + get_shaper_and_font_foreach (NULL, get_base_font (state), &info); - return TRUE; + if (info.shape_engine) + { + *shape_engine = info.shape_engine; + *font = info.font; + + /* skip caching if fallback disabled (see above) */ + if (state->enable_fallback) + shaper_font_cache_insert (state->cache, wc, *shape_engine, *font); + + return TRUE; + } } info.engines = state->fallback_engines; - if (state->enable_fallback) - pango_fontset_foreach (state->current_fonts, get_shaper_and_font_foreach, &info); - else - get_shaper_and_font_foreach (NULL, get_base_font (state), &info); + if (info.engines) + { + if (state->enable_fallback) + pango_fontset_foreach (state->current_fonts, get_shaper_and_font_foreach, &info); + else + get_shaper_and_font_foreach (NULL, get_base_font (state), &info); + } *shape_engine = info.shape_engine; *font = info.font; |