Improve invisible character drawing on a non-opaque view

This commit is contained in:
1024jp 2017-03-12 00:43:40 +09:00
parent 34f115fffe
commit b76543f665
2 changed files with 10 additions and 0 deletions

View File

@ -19,6 +19,7 @@ develop
- Improve performance of closing large size document.
- Add “.swift” extension to file types treaded as CotEditor script.
- Improve invisible character drawing on a non-opaque view.
- Change syntax style detection behavior to set “None” style if no appropriate style can be found on file opening.
- [non-AppStore ver.] Update Sparkle framework to version 1.17.0.
- And some minor improvements and fixes.

View File

@ -211,6 +211,11 @@ final class LayoutManager: NSLayoutManager {
let string = self.textStorage?.string
{
let isVertical = (self.firstTextView?.layoutOrientation == .vertical)
let isOpaque = self.firstTextView?.isOpaque ?? true
if !isOpaque {
context.setShouldSmoothFonts(false)
}
// flip coordinate if needed
if NSGraphicsContext.current()?.isFlipped ?? false {
@ -268,6 +273,10 @@ final class LayoutManager: NSLayoutManager {
context.textPosition = point
CTLineDraw(line, context)
}
if !isOpaque {
context.setShouldSmoothFonts(true)
}
}
super.drawGlyphs(forGlyphRange: glyphsToShow, at: origin)