From 0705844bf8847bed46d2284b36e4e6537b1b445e Mon Sep 17 00:00:00 2001 From: "Reece H. Dunn" Date: Tue, 2 May 2017 18:58:24 +0100 Subject: [PATCH] tokenizer.c: Move general category classification that does not override property behaviour to the end, for generic classification. --- src/libespeak-ng/tokenizer.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/libespeak-ng/tokenizer.c b/src/libespeak-ng/tokenizer.c index a4dad475..b4a3ddea 100644 --- a/src/libespeak-ng/tokenizer.c +++ b/src/libespeak-ng/tokenizer.c @@ -117,16 +117,13 @@ static espeakng_CTYPE codepoint_type(uint32_t c) case 0x0085: return ESPEAKNG_CTYPE_NEWLINE; // NEW LINE (NEL) } - // 2. Classify codepoints by their Unicode General Category. + // 2. Override property types for codepoints by their Unicode General Category. ucd_category cat = ucd_lookup_category(c); switch (cat) { - case UCD_CATEGORY_Lu: return ESPEAKNG_CTYPE_UPPERCASE; - case UCD_CATEGORY_Ll: return ESPEAKNG_CTYPE_LOWERCASE; case UCD_CATEGORY_Zl: return ESPEAKNG_CTYPE_NEWLINE; case UCD_CATEGORY_Zp: return ESPEAKNG_CTYPE_PARAGRAPH; - case UCD_CATEGORY_Zs: return ESPEAKNG_CTYPE_WHITESPACE; } // 3. Classify codepoints by their Unicode properties. @@ -156,7 +153,15 @@ static espeakng_CTYPE codepoint_type(uint32_t c) return ESPEAKNG_CTYPE_ELLIPSIS; } - // 4. Classify the remaining codepoints. + // 4. Classify codepoints by their Unicode General Category. + + switch (cat) + { + case UCD_CATEGORY_Lu: return ESPEAKNG_CTYPE_UPPERCASE; + case UCD_CATEGORY_Ll: return ESPEAKNG_CTYPE_LOWERCASE; + } + + // 5. Classify the remaining codepoints. return ESPEAKNG_CTYPE_OTHER; }