Skip to content
Snippets Groups Projects
Commit bce03ad0 authored by George Nachman's avatar George Nachman
Browse files

Don't use large horizontal offsets for glyph drawing.

It upsets High Sierra. :kissing_closed_eyes::dash:

Issue 5811
parent dfc1aaa7
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -1051,7 +1051,7 @@ typedef struct iTermTextColorContext {
// green:arc4random_uniform(255) / 255.0
// blue:arc4random_uniform(255) / 255.0
// alpha:1] set];
// NSFrameRect(NSMakeRect(point.x + positions->elements[0], point.y, width, _cellSize.height));
// NSFrameRect(NSMakeRect(point.x + subpositions[0], point.y, numCellsDrawn * _cellSize.width, _cellSize.height));
 
origin.x += numCellsDrawn;
 
Loading
Loading
@@ -1099,6 +1099,9 @@ typedef struct iTermTextColorContext {
positions:(CGFloat *)positions
inContext:(CGContextRef)ctx
backgroundColor:(NSColor *)backgroundColor {
if (cheapString.length == 0) {
return 0;
}
CGGlyph glyphs[cheapString.length];
NSFont *const font = cheapString.attributes[NSFontAttributeName];
BOOL ok = CTFontGetGlyphsForCharacters((CTFontRef)font,
Loading
Loading
@@ -1143,7 +1146,7 @@ typedef struct iTermTextColorContext {
CGContextSetFillColor(ctx, components);
 
double y = point.y + _cellSize.height + _baselineOffset;
int x = point.x;
int x = point.x + positions[0];
// Flip vertically and translate to (x, y).
CGFloat m21 = 0.0;
if (fakeItalic) {
Loading
Loading
@@ -1154,7 +1157,7 @@ typedef struct iTermTextColorContext {
x, y));
CGPoint points[length];
for (int i = 0; i < length; i++) {
points[i].x = positions[i];
points[i].x = positions[i] - positions[0];
points[i].y = 0;
}
CGContextShowGlyphsAtPositions(ctx, glyphs, points, length);
Loading
Loading
@@ -1169,6 +1172,7 @@ typedef struct iTermTextColorContext {
 
CGContextShowGlyphsAtPositions(ctx, glyphs, points, length);
}
#if 0
// Indicates which regions were drawn with the fastpath
[[NSColor yellowColor] set];
Loading
Loading
@@ -1227,6 +1231,9 @@ typedef struct iTermTextColorContext {
backgroundColor:(NSColor *)backgroundColor
graphicsContext:(NSGraphicsContext *)ctx
smear:(BOOL)smear {
if (attributedString.length == 0) {
return;
}
NSDictionary *attributes = [attributedString attributesAtIndex:0 effectiveRange:nil];
CGColorRef cgColor = (CGColorRef)attributes[(NSString *)kCTForegroundColorAttributeName];
Loading
Loading
@@ -1278,7 +1285,7 @@ typedef struct iTermTextColorContext {
const CGFloat ty = origin.y + _baselineOffset + _cellSize.height;
CGAffineTransform textMatrix = CGAffineTransformMake(1.0, 0.0,
c, -1.0,
origin.x, ty);
origin.x + stringPositions[0], ty);
CGContextSetTextMatrix(cgContext, textMatrix);
 
CGFloat cellOrigin = -1;
Loading
Loading
@@ -1310,9 +1317,10 @@ typedef struct iTermTextColorContext {
CGFloat positionOfFirstGlyphInCluster = positions[0].x;
for (size_t glyphIndex = 0; glyphIndex < length; glyphIndex++) {
CFIndex characterIndex = glyphIndexToCharacterIndex[glyphIndex];
if (characterIndex != previousCharacterIndex && stringPositions[characterIndex] != cellOrigin) {
CGFloat characterPosition = stringPositions[characterIndex] - stringPositions[0];
if (characterIndex != previousCharacterIndex && characterPosition != cellOrigin) {
positionOfFirstGlyphInCluster = positions[glyphIndex].x;
cellOrigin = stringPositions[characterIndex];
cellOrigin = characterPosition;
}
positions[glyphIndex].x += cellOrigin - positionOfFirstGlyphInCluster;
}
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment