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
commit546b89b1c20dc25d8013f92c7a2053e940483fec (patch)
tree75d5feac6423f812f93ffbc5883bc990aed82d1a
parent982541f99d2e9e143c0da043266efb9ae5f9640b (diff)
downloadscintilla-mirror-546b89b1c20dc25d8013f92c7a2053e940483fec.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;
}