1
1
mirror of https://github.com/qvacua/vimr.git synced 2024-11-27 14:14:19 +03:00

Merge pull request #725 from tkonolige/develop

Don't round character spacing
This commit is contained in:
Tae Won Ha 2019-05-01 09:52:59 +02:00 committed by GitHub
commit a051e5393a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -26,12 +26,11 @@ final class FontUtils {
static func cellSize(of font: NSFont, linespacing: CGFloat, characterspacing: CGFloat) -> CGSize {
if let cached = cellSizeWithDefaultLinespacingCache.object(forKey: font) {
return CGSize(
width: ceil(characterspacing * cached.width),
width: characterspacing * cached.width,
height: ceil(linespacing * cached.height)
)
}
// adapted from here: https://github.com/gnachman/iTerm2/blob/master/sources/FontSizeEstimator.m#L66
let capitalM = [UniChar(0x004D)]
var glyph = [CGGlyph(0)]
var advancement = CGSize.zero
@ -51,7 +50,7 @@ final class FontUtils {
)
let cellSize = CGSize(
width: ceil(characterspacing * advancement.width),
width: characterspacing * advancement.width,
height: ceil(linespacing * cellSizeToCache.height)
)