mirror of
https://github.com/textmate/textmate.git
synced 2026-01-21 04:38:13 -05:00
Add x- and cap height to metrics_t
This is to allow potential background bezels, images, and similar to be aligned with the text.
This commit is contained in:
@@ -33,6 +33,8 @@ namespace ct
|
||||
_ascent = CTFontGetAscent(font);
|
||||
_descent = CTFontGetDescent(font);
|
||||
_leading = CTFontGetLeading(font);
|
||||
_x_height = CTFontGetXHeight(font);
|
||||
_cap_height = CTFontGetCapHeight(font);
|
||||
_column_width = CTLineGetTypographicBounds(line, NULL, NULL, NULL);
|
||||
|
||||
_ascent_delta = read_double_from_defaults(CFSTR("fontAscentDelta"), 1);
|
||||
|
||||
@@ -25,6 +25,8 @@ namespace ct
|
||||
CGFloat ascent () const { return _ascent; }
|
||||
CGFloat descent () const { return _descent; }
|
||||
CGFloat leading () const { return _leading; }
|
||||
CGFloat x_height () const { return _x_height; }
|
||||
CGFloat cap_height () const { return _cap_height; }
|
||||
CGFloat column_width () const { return _column_width; }
|
||||
|
||||
CGFloat baseline (CGFloat minAscent = 0) const { return round(std::max(minAscent, _ascent) + _ascent_delta); }
|
||||
@@ -35,6 +37,8 @@ namespace ct
|
||||
CGFloat _ascent;
|
||||
CGFloat _descent;
|
||||
CGFloat _leading;
|
||||
CGFloat _x_height;
|
||||
CGFloat _cap_height;
|
||||
CGFloat _column_width;
|
||||
|
||||
CGFloat _ascent_delta = 1;
|
||||
|
||||
Reference in New Issue
Block a user