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

Don't underline null characters. Also, draw underlines before hacking up the...

Don't underline null characters. Also, draw underlines before hacking up the character run, which caused the wrong range to get underlined
parent 7f02146d
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -6339,11 +6339,6 @@ static double EuclideanDistance(NSPoint p1, NSPoint p2) {
// Chatacter hidden because of blinking.
drawable = NO;
}
if (theLine[i].underline) {
// This is not as fast as possible, but is nice and simple. Always draw underlined text
// even if it's just a blank.
drawable = YES;
}
// Set all other common attributes.
if (doubleWidth) {
thisCharAdvance = charWidth * 2;
Loading
Loading
@@ -6558,6 +6553,22 @@ static double EuclideanDistance(NSPoint p1, NSPoint p2) {
storage:(CRunStorage *)storage {
NSPoint startPoint = NSMakePoint(initialPoint.x + currentRun->x, initialPoint.y);
CGContextSetShouldAntialias(ctx, currentRun->attrs.antiAlias);
// Draw underline
if (currentRun->attrs.underline) {
[currentRun->attrs.color set];
CGFloat runWidth = 0;
int length = currentRun->string ? 1 : currentRun->length;
NSSize *advances = CRunGetAdvances(currentRun);
for (int i = 0; i < length; i++) {
runWidth += advances[i].width;
}
NSRectFill(NSMakeRect(startPoint.x,
startPoint.y + lineHeight - 2,
runWidth,
1));
}
if (!currentRun->string) {
// Non-complex, except for glyphs we can't find.
while (currentRun->length) {
Loading
Loading
@@ -6587,21 +6598,6 @@ static double EuclideanDistance(NSPoint p1, NSPoint p2) {
fakeBold:currentRun->attrs.fakeBold
antiAlias:currentRun->attrs.antiAlias];
}
// Draw underline
if (currentRun->attrs.underline) {
[currentRun->attrs.color set];
CGFloat runWidth = 0;
int length = currentRun->string ? 1 : currentRun->length;
NSSize *advances = CRunGetAdvances(currentRun);
for (int i = 0; i < length; i++) {
runWidth += advances[i].width;
}
NSRectFill(NSMakeRect(startPoint.x,
startPoint.y + lineHeight - 2,
runWidth,
1));
}
}
 
- (void)_drawRunsAt:(NSPoint)initialPoint
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