mirror of
https://github.com/kovidgoyal/kitty
synced 2026-06-09 07:07:19 +02:00
get_glyph_width for core text?!
This commit is contained in:
@@ -221,6 +221,15 @@ is_glyph_empty(PyObject *s, glyph_index g) {
|
||||
return bounds.size.width <= 0;
|
||||
}
|
||||
|
||||
int
|
||||
get_glyph_width(PyObject *s, glyph_index g) {
|
||||
CTFace *self = (CTFace*)s;
|
||||
CGGlyph gg = g;
|
||||
CGRect bounds;
|
||||
CTFontGetBoundingRectsForGlyphs(self->ct_font, kCTFontOrientationHorizontal, &gg, &bounds, 1);
|
||||
return bounds.size.width;
|
||||
}
|
||||
|
||||
static inline float
|
||||
scaled_point_sz(FONTS_DATA_HANDLE fg) {
|
||||
return ((fg->logical_dpi_x + fg->logical_dpi_y) / 144.0) * fg->font_sz_in_pts;
|
||||
|
||||
Reference in New Issue
Block a user