diff options
author | Raph Levien <raph@google.com> | 2015-04-06 16:21:10 -0700 |
---|---|---|
committer | Raph Levien <raph@google.com> | 2015-04-15 20:19:10 -0700 |
commit | 40beb7744a61248de82a6077996c83c14e0122c2 (patch) | |
tree | 6d45fd7151ef6987bbf810642592d694473f0b3e /libs/minikin/GraphemeBreak.cpp | |
parent | bb86b433f97a301c11800806b1ce5331fa227d4a (diff) | |
download | android_frameworks_minikin-40beb7744a61248de82a6077996c83c14e0122c2.tar.gz android_frameworks_minikin-40beb7744a61248de82a6077996c83c14e0122c2.tar.bz2 android_frameworks_minikin-40beb7744a61248de82a6077996c83c14e0122c2.zip |
Add functions for measuring cursor positioning
New functions for computing the correspondence between cursor
position and advance, respecting grapheme boundaries.
Change-Id: I620378d5f64cd74300cd43db522adeb555825dff
Diffstat (limited to 'libs/minikin/GraphemeBreak.cpp')
-rw-r--r-- | libs/minikin/GraphemeBreak.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/libs/minikin/GraphemeBreak.cpp b/libs/minikin/GraphemeBreak.cpp index 5d8978d..f8f386c 100644 --- a/libs/minikin/GraphemeBreak.cpp +++ b/libs/minikin/GraphemeBreak.cpp @@ -41,7 +41,7 @@ bool GraphemeBreak::isGraphemeBreak(const uint16_t* buf, size_t start, size_t co uint32_t c2 = 0; size_t offset_back = offset; U16_PREV(buf, start, offset_back, c1); - U16_NEXT(buf, offset, count, c2); + U16_NEXT(buf, offset, start + count, c2); int32_t p1 = u_getIntPropertyValue(c1, UCHAR_GRAPHEME_CLUSTER_BREAK); int32_t p2 = u_getIntPropertyValue(c2, UCHAR_GRAPHEME_CLUSTER_BREAK); // Rule GB3, CR x LF @@ -54,7 +54,7 @@ bool GraphemeBreak::isGraphemeBreak(const uint16_t* buf, size_t start, size_t co } // Rule GB5, / (Control | CR | LF) if (p2 == U_GCB_CONTROL || p2 == U_GCB_CR || p2 == U_GCB_LF) { - // exclude zero-width control characters from breaking (tailoring of TR29) + // exclude zero-width control characters from breaking (tailoring of UAX #29) if (c2 == 0x00ad || (c2 >= 0x200b && c2 <= 0x200f) || (c2 >= 0x2028 && c2 <= 0x202e) @@ -83,12 +83,12 @@ bool GraphemeBreak::isGraphemeBreak(const uint16_t* buf, size_t start, size_t co if (p2 == U_GCB_EXTEND || p2 == U_GCB_SPACING_MARK) { if (c2 == 0xe33) { // most other implementations break THAI CHARACTER SARA AM - // (tailoring of TR29) + // (tailoring of UAX #29) return true; } return false; } - // Cluster indic syllables togeter (tailoring of TR29) + // Cluster indic syllables together (tailoring of UAX #29) if (u_getIntPropertyValue(c1, UCHAR_CANONICAL_COMBINING_CLASS) == 9 // virama && u_getIntPropertyValue(c2, UCHAR_GENERAL_CATEGORY) == U_OTHER_LETTER) { return false; |