summaryrefslogtreecommitdiffstats
path: root/WebCore/platform/graphics/win/UniscribeController.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'WebCore/platform/graphics/win/UniscribeController.cpp')
-rw-r--r--WebCore/platform/graphics/win/UniscribeController.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/WebCore/platform/graphics/win/UniscribeController.cpp b/WebCore/platform/graphics/win/UniscribeController.cpp
index afea10a..bceec2d 100644
--- a/WebCore/platform/graphics/win/UniscribeController.cpp
+++ b/WebCore/platform/graphics/win/UniscribeController.cpp
@@ -287,9 +287,16 @@ bool UniscribeController::shapeAndPlaceItem(const UChar* cp, unsigned i, const S
roundingHackCharacters[clusters[k]] = m_currentCharacter + k + item.iCharPos;
int boundary = k + m_currentCharacter + item.iCharPos;
- if (boundary < m_run.length() &&
- Font::isRoundingHackCharacter(*(str + k + 1)))
- roundingHackWordBoundaries[clusters[k]] = boundary;
+ if (boundary < m_run.length()) {
+ // When at the last character in the str, don't look one past the end for a rounding hack character.
+ // Instead look ahead to the first character of next item, if there is a next one.
+ if (k + 1 == len) {
+ if (i + 2 < m_items.size() // Check for at least 2 items remaining. The last item is a terminating item containing no characters.
+ && Font::isRoundingHackCharacter(*(cp + m_items[i + 1].iCharPos)))
+ roundingHackWordBoundaries[clusters[k]] = boundary;
+ } else if (Font::isRoundingHackCharacter(*(str + k + 1)))
+ roundingHackWordBoundaries[clusters[k]] = boundary;
+ }
}
// Populate our glyph buffer with this information.