Skip to content

Commit 6ff781f

Browse files
authored
Merge pull request #700 from ichizok/fix/fetch-glyphs
Fix fetchGlyphsAndAdvances() in CoreText renderer
2 parents 21f99c1 + eec7910 commit 6ff781f

1 file changed

Lines changed: 17 additions & 15 deletions

File tree

src/MacVim/MMCoreTextView.m

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1203,21 +1203,23 @@ - (void)batchDrawData:(NSData *)data
12031203
CTRunRef run = (CTRunRef)item;
12041204
CFIndex count = CTRunGetGlyphCount(run);
12051205

1206-
if (count > 0 && count - offset > length)
1207-
count = length - offset;
1208-
1209-
CFRange range = CFRangeMake(0, count);
1210-
1211-
if (glyphs != NULL)
1212-
CTRunGetGlyphs(run, range, &glyphs[offset]);
1213-
if (advances != NULL)
1214-
CTRunGetAdvances(run, range, &advances[offset]);
1215-
if (positions != NULL)
1216-
CTRunGetPositions(run, range, &positions[offset]);
1217-
1218-
offset += count;
1219-
if (offset >= length)
1220-
break;
1206+
if (count > 0) {
1207+
if (count > length - offset)
1208+
count = length - offset;
1209+
1210+
CFRange range = CFRangeMake(0, count);
1211+
1212+
if (glyphs != NULL)
1213+
CTRunGetGlyphs(run, range, &glyphs[offset]);
1214+
if (advances != NULL)
1215+
CTRunGetAdvances(run, range, &advances[offset]);
1216+
if (positions != NULL)
1217+
CTRunGetPositions(run, range, &positions[offset]);
1218+
1219+
offset += count;
1220+
if (offset >= length)
1221+
break;
1222+
}
12211223
}
12221224

12231225
return offset;

0 commit comments

Comments
 (0)