aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorNeil Hodgson <nyamatongwe@gmail.com>2014-06-07 09:22:37 +1000
committerNeil Hodgson <nyamatongwe@gmail.com>2014-06-07 09:22:37 +1000
commit13bb5b9bb66b54cde9e35b79bd0b9b35bdc82c47 (patch)
tree4c2d4c9e73ddb4a78c43142d98c47044ba75d7da
parente8b11287542a0252519536782e7a0635d2882580 (diff)
downloadscintilla-mirror-13bb5b9bb66b54cde9e35b79bd0b9b35bdc82c47.tar.gz
Fix laying out of emoji. Emoji are not in the BMP, taking 2 UTF-16 code units. Previously the
position used was that reported after the first code unit (0) instead of that after both code units. This led to the character after the emoji sharing space with it.
-rw-r--r--cocoa/PlatCocoa.mm2
1 files changed, 1 insertions, 1 deletions
diff --git a/cocoa/PlatCocoa.mm b/cocoa/PlatCocoa.mm
index 2225631a6..28fe4dd8b 100644
--- a/cocoa/PlatCocoa.mm
+++ b/cocoa/PlatCocoa.mm
@@ -957,7 +957,7 @@ void SurfaceImpl::MeasureWidths(Font &font_, const char *s, int len, XYPOSITION
while (ui<fit) {
size_t lenChar = utf8LengthFromLead(us[i]);
size_t codeUnits = (lenChar < 4) ? 1 : 2;
- CGFloat xPosition = CTLineGetOffsetForStringIndex(mLine, ui+1, NULL);
+ CGFloat xPosition = CTLineGetOffsetForStringIndex(mLine, ui+codeUnits, NULL);
for (unsigned int bytePos=0; (bytePos<lenChar) && (i<len); bytePos++) {
positions[i++] = xPosition;
}