diff options
Diffstat (limited to 'thirdparty/icu4c/common/ustrcase.cpp')
-rw-r--r-- | thirdparty/icu4c/common/ustrcase.cpp | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/thirdparty/icu4c/common/ustrcase.cpp b/thirdparty/icu4c/common/ustrcase.cpp index 537b5ba857..e4aec8a1c7 100644 --- a/thirdparty/icu4c/common/ustrcase.cpp +++ b/thirdparty/icu4c/common/ustrcase.cpp @@ -1130,14 +1130,18 @@ int32_t toUpper(uint32_t options, // Adding one only to the final vowel in a longer sequence // (which does not occur in normal writing) would require lookahead. // Set the same flag as for preserving an existing dialytika. - if ((data & HAS_VOWEL) != 0 && (state & AFTER_VOWEL_WITH_ACCENT) != 0 && - (upper == 0x399 || upper == 0x3A5)) { - data |= HAS_DIALYTIKA; + if ((data & HAS_VOWEL) != 0 && + (state & (AFTER_VOWEL_WITH_PRECOMPOSED_ACCENT | AFTER_VOWEL_WITH_COMBINING_ACCENT)) != + 0 && + (upper == 0x399 || upper == 0x3A5)) { + data |= (state & AFTER_VOWEL_WITH_PRECOMPOSED_ACCENT) ? HAS_DIALYTIKA + : HAS_COMBINING_DIALYTIKA; } int32_t numYpogegrammeni = 0; // Map each one to a trailing, spacing, capital iota. if ((data & HAS_YPOGEGRAMMENI) != 0) { numYpogegrammeni = 1; } + const UBool hasPrecomposedAccent = (data & HAS_ACCENT) != 0; // Skip combining diacritics after this Greek letter. while (nextIndex < srcLength) { uint32_t diacriticData = getDiacriticData(src[nextIndex]); @@ -1152,7 +1156,8 @@ int32_t toUpper(uint32_t options, } } if ((data & HAS_VOWEL_AND_ACCENT_AND_DIALYTIKA) == HAS_VOWEL_AND_ACCENT) { - nextState |= AFTER_VOWEL_WITH_ACCENT; + nextState |= hasPrecomposedAccent ? AFTER_VOWEL_WITH_PRECOMPOSED_ACCENT + : AFTER_VOWEL_WITH_COMBINING_ACCENT; } // Map according to Greek rules. UBool addTonos = false; @@ -1163,7 +1168,7 @@ int32_t toUpper(uint32_t options, !isFollowedByCasedLetter(src, nextIndex, srcLength)) { // Keep disjunctive "or" with (only) a tonos. // We use the same "word boundary" conditions as for the Final_Sigma test. - if (i == nextIndex) { + if (hasPrecomposedAccent) { upper = 0x389; // Preserve the precomposed form. } else { addTonos = true; |