Disable hyphenation when word overlaps style boundary
In cases when a word (as defined by the ICU break iterator) overlaps a style boundary, the returned wordStart can be extend before the range currently being measured for layout. When we try to hyphenate the resulting substrings, we get a negative range, which crashes. This patch disables hyphenation in this case. Bug: 27237112 Change-Id: I76d04b39dd3b4d6d267aaaf4bebc9ab361891646
This commit is contained in:
@@ -174,7 +174,8 @@ float LineBreaker::addStyleRun(MinikinPaint* paint, const FontCollection* typefa
|
|||||||
if (paint != nullptr && mHyphenator != nullptr &&
|
if (paint != nullptr && mHyphenator != nullptr &&
|
||||||
mHyphenationFrequency != kHyphenationFrequency_None &&
|
mHyphenationFrequency != kHyphenationFrequency_None &&
|
||||||
!wordEndsInHyphen && !temporarilySkipHyphenation &&
|
!wordEndsInHyphen && !temporarilySkipHyphenation &&
|
||||||
wordEnd > wordStart && wordEnd - wordStart <= LONGEST_HYPHENATED_WORD) {
|
wordStart >= start && wordEnd > wordStart &&
|
||||||
|
wordEnd - wordStart <= LONGEST_HYPHENATED_WORD) {
|
||||||
mHyphenator->hyphenate(&mHyphBuf, &mTextBuf[wordStart], wordEnd - wordStart);
|
mHyphenator->hyphenate(&mHyphBuf, &mTextBuf[wordStart], wordEnd - wordStart);
|
||||||
#if VERBOSE_DEBUG
|
#if VERBOSE_DEBUG
|
||||||
std::string hyphenatedString;
|
std::string hyphenatedString;
|
||||||
|
|||||||
Reference in New Issue
Block a user