From aeb45fe26b09cd6720e6ca350740a818fb6da284 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Sun, 9 Mar 2008 12:50:16 -0400 Subject: [PATCH] We now draw the line number in the the middle of the the line's height, which means that if the line number is a smaller size than the line text it will be centered instead of drawn at the top * Source/BSLineNumberView.m: ([BSLineNumberView drawRect:]) --- Source/BSLineNumberView.m | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/BSLineNumberView.m b/Source/BSLineNumberView.m index b458917..34952c2 100644 --- a/Source/BSLineNumberView.m +++ b/Source/BSLineNumberView.m @@ -57,7 +57,7 @@ [NSBezierPath strokeLineFromPoint:NSMakePoint(rect.origin.x, rect.size.height) toPoint:NSMakePoint(rect.origin.x + rect.size.width, rect.size.height)]; // font attributes for the line number - NSDictionary *attrs = [NSDictionary dictionaryWithObjectsAndKeys:[NSFont fontWithName:@"Monaco" size:10.0], NSFontAttributeName, [NSColor grayColor], NSForegroundColorAttributeName, nil]; + NSDictionary *attrs = [NSDictionary dictionaryWithObjectsAndKeys:[NSFont fontWithName:@"Monaco" size:9.0], NSFontAttributeName, [NSColor grayColor], NSForegroundColorAttributeName, nil]; unsigned i = 0, line = 1; while (i < [[[sourceView textView] layoutManager] numberOfGlyphs]) @@ -74,7 +74,7 @@ { NSString *num = [NSString stringWithFormat:@"%u", line]; NSSize strSize = [num sizeWithAttributes:attrs]; - [num drawAtPoint:NSMakePoint([self frame].size.width - strSize.width - 3, fragRect.origin.y) withAttributes:attrs]; + [num drawAtPoint:NSMakePoint([self frame].size.width - strSize.width - 3, fragRect.origin.y + ((fragRect.size.height - strSize.height) / 2)) withAttributes:attrs]; } i += fragRange.length; -- 2.43.5