summaryrefslogtreecommitdiff
path: root/pango/pango-context.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2015-09-13 11:28:33 -0400
committerMatthias Clasen <mclasen@redhat.com>2015-09-13 11:28:33 -0400
commitbbe896872189d6afb30f2fb6bec44e64eedc52ef (patch)
treec08763d572afa82396df46e30544aaddf12e5c2e /pango/pango-context.c
parent0bb2b5f4cf2264591657d2e0aead00955f9deb64 (diff)
downloadpango-bbe896872189d6afb30f2fb6bec44e64eedc52ef.tar.gz
Avoid some overhead in itemize_state_process_run
Avoid determining the Unicode type repeatedly. Instead, just get the type once and filter out the classes we want.
Diffstat (limited to 'pango/pango-context.c')
-rw-r--r--pango/pango-context.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/pango/pango-context.c b/pango/pango-context.c
index dafc5dd1..9d67b8e2 100644
--- a/pango/pango-context.c
+++ b/pango/pango-context.c
@@ -1387,6 +1387,7 @@ itemize_state_process_run (ItemizeState *state)
gboolean is_forced_break = (wc == '\t' || wc == LINE_SEPARATOR);
PangoEngineShape *shape_engine;
PangoFont *font;
+ GUnicodeType type;
/* We don't want space characters to affect font selection; in general,
* it's always wrong to select a font just to render a space.
@@ -1394,20 +1395,18 @@ itemize_state_process_run (ItemizeState *state)
* characters if they don't, HarfBuzz will compatibility-decompose them
* to ASCII space...
* See bugs #355987 and #701652.
- *
- * The exception of PrivateUse and Unassigned characters is necessary
- * to be able to render any of them. (for private or being encoded
- * scripts, etc.) (Recent glib returns true in isprint for PrivateUse.)
*/
- if (G_UNLIKELY (!g_unichar_isgraph (wc) &&
- g_unichar_type (wc) != G_UNICODE_PRIVATE_USE &&
- g_unichar_type (wc) != G_UNICODE_UNASSIGNED))
- {
+ type = g_unichar_type (wc);
+ if (G_UNLIKELY (type == G_UNICODE_CONTROL ||
+ type == G_UNICODE_FORMAT ||
+ type == G_UNICODE_SURROGATE ||
+ type == G_UNICODE_SPACE_SEPARATOR))
+ {
shape_engine = NULL;
font = NULL;
- }
+ }
else
- {
+ {
get_shaper_and_font (state, wc, &shape_engine, &font);
}