mirror of
https://github.com/qvacua/vimr.git
synced 2024-11-24 03:25:03 +03:00
vertically center-align text in linespacing, fixes #415
This commit is contained in:
parent
edb666e72d
commit
b3877b0e92
@ -24,6 +24,7 @@ final class AttributesRunDrawer {
|
||||
|
||||
private(set) var cellSize: CGSize = .zero
|
||||
private(set) var baselineOffset: CGFloat = 0
|
||||
private(set) var ascent: CGFloat = 0
|
||||
private(set) var descent: CGFloat = 0
|
||||
private(set) var underlinePosition: CGFloat = 0
|
||||
private(set) var underlineThickness: CGFloat = 0
|
||||
@ -181,8 +182,10 @@ final class AttributesRunDrawer {
|
||||
self.cellSize = FontUtils.cellSize(
|
||||
of: self.font, linespacing: self.linespacing, characterspacing: self.characterspacing
|
||||
)
|
||||
self.baselineOffset = self.cellSize.height - CTFontGetAscent(self.font)
|
||||
|
||||
self.ascent = CTFontGetAscent(font)
|
||||
self.descent = CTFontGetDescent(font)
|
||||
self.baselineOffset = (self.cellSize.height - ascent + descent) / 2
|
||||
self.underlinePosition = CTFontGetUnderlinePosition(font)
|
||||
self.underlineThickness = CTFontGetUnderlineThickness(font)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user