Fix page guide locattion on El Capitan

This commit is contained in:
1024jp 2015-09-19 02:30:24 +09:00
parent 199c3bb8e7
commit 1d8b279830
2 changed files with 3 additions and 2 deletions

View File

@ -8,6 +8,7 @@ develop
### Fixes
- Fix an issue where calculation of hanging indent width was sometime incorrect.
- Fix an issue on El Capitan where page guide was drawn at the wrong column.

View File

@ -632,11 +632,11 @@ static NSPoint kTextContainerOrigin;
NSFont *font = [(CELayoutManager *)[self layoutManager] textFont];
font = [font screenFont] ? : font;
column *= [@"M" sizeWithAttributes:@{NSFontAttributeName: font}].width;
CGFloat charWidth = [font advancementForGlyph:(NSGlyph)' '].width;
CGFloat inset = [self textContainerOrigin].x;
CGFloat linePadding = [[self textContainer] lineFragmentPadding];
CGFloat x = floor(column + inset + linePadding) + 2.5; // +2px for adjustment
CGFloat x = floor(charWidth * column + inset + linePadding) + 2.5; // +2px for adjustment
[[[self textColor] colorWithAlphaComponent:0.2] set];
[NSBezierPath strokeLineFromPoint:NSMakePoint(x, NSMinY(dirtyRect))