summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2015-09-13 11:26:19 -0400
committerMatthias Clasen <mclasen@redhat.com>2015-09-13 11:26:19 -0400
commit0bb2b5f4cf2264591657d2e0aead00955f9deb64 (patch)
treee1cfadd4c35f5828973f8d3451b4f502e8271520
parent0de37310ff335d49d8003dfb4008932142ec2bde (diff)
downloadpango-0bb2b5f4cf2264591657d2e0aead00955f9deb64.tar.gz
Avoid some overhead in pango_default_break
We already have the Unicode type, so we can determine isspace without doing the full type determination again.
-rw-r--r--pango/break.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/pango/break.c b/pango/break.c
index 1cc735cf..b4b3c822 100644
--- a/pango/break.c
+++ b/pango/break.c
@@ -639,10 +639,20 @@ pango_default_break (const gchar *text,
makes_hangul_syllable = (prev_end == this_start) || (prev_end + 1 == this_start);
}
- /* Can't just use the type here since isspace() doesn't
- * correspond to a Unicode character type
- */
- attrs[i].is_white = g_unichar_isspace (wc);
+ switch (type)
+ {
+ case G_UNICODE_SPACE_SEPARATOR:
+ case G_UNICODE_LINE_SEPARATOR:
+ case G_UNICODE_PARAGRAPH_SEPARATOR:
+ attrs[i].is_white = TRUE;
+ break;
+ default:
+ if (wc == '\t' || wc == '\n' || wc == '\r' || wc == '\f')
+ attrs[i].is_white = TRUE;
+ else
+ attrs[i].is_white = FALSE;
+ break;
+ }
/* Just few spaces have variable width. So explicitly mark them.
*/