Skip to content

Commit 3214b9e

Browse files
authored
Merge pull request #681 from ichizok/fix/coretext-renderer
Fix Core Text renderer
2 parents 7569a35 + d068670 commit 3214b9e

2 files changed

Lines changed: 14 additions & 11 deletions

File tree

src/MacVim/MMCoreTextView.m

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1431,7 +1431,7 @@ - (void)drawString:(const UniChar *)chars length:(UniCharCount)length
14311431
}
14321432

14331433
CGContextSetRGBStrokeColor(context, RED(sp), GREEN(sp), BLUE(sp),
1434-
ALPHA(sp));
1434+
ALPHA(sp));
14351435
CGContextStrokePath(context);
14361436
}
14371437

@@ -1449,13 +1449,10 @@ - (void)drawString:(const UniChar *)chars length:(UniCharCount)length
14491449
CGContextSetFontSize(context, [font pointSize]);
14501450

14511451
// Calculate position of each glyph relative to (x,y).
1452-
if (!composing) {
1453-
float xrel = 0;
1454-
for (unsigned i = 0; i < length; ++i) {
1455-
positions[i].x = xrel;
1456-
positions[i].y = .0;
1457-
xrel += w;
1458-
}
1452+
float xrel = composing ? .0 : w;
1453+
for (unsigned i = 0; i < length; ++i) {
1454+
positions[i].x = i * xrel;
1455+
positions[i].y = .0;
14591456
}
14601457

14611458
CTFontRef fontRef = (CTFontRef)(wide ? [fontWide retain]

src/screen.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8388,7 +8388,13 @@ screen_char(unsigned off, int row, int col)
83888388
{
83898389
char_u buf[MB_MAXBYTES + 1];
83908390

8391-
if (utf_ambiguous_width(ScreenLinesUC[off]))
8391+
if (utf_ambiguous_width(ScreenLinesUC[off])
8392+
# ifdef FEAT_GUI_MACVIM
8393+
/* In the GUI, check if the cell width is actually 1 in order
8394+
* to display 2-cells emoji correctly. */
8395+
&& (!gui.in_use || utf_char2cells(ScreenLinesUC[off]) == 1)
8396+
# endif
8397+
)
83928398
{
83938399
if (*p_ambw == 'd'
83948400
# ifdef FEAT_GUI
@@ -8404,9 +8410,9 @@ screen_char(unsigned off, int row, int col)
84048410
/* not sure where the cursor is after drawing the ambiguous width
84058411
* character */
84068412
# ifdef FEAT_GUI_MACVIM
8407-
if (*p_ambw == 'd' || !gui.in_use)
8413+
if (*p_ambw == 'd' || !gui.in_use)
84088414
# endif
8409-
screen_cur_col = 9999;
8415+
screen_cur_col = 9999;
84108416
}
84118417
else if (utf_char2cells(ScreenLinesUC[off]) > 1)
84128418
++screen_cur_col;

0 commit comments

Comments
 (0)