mirror of
https://github.com/kovidgoyal/kitty.git
synced 2026-06-24 18:07:01 +00:00
Fix #2313
This commit is contained in:
parent
eaec854bfb
commit
109a856b91
1 changed files with 5 additions and 4 deletions
|
|
@ -457,11 +457,12 @@ render_simple_text_impl(PyObject *s, const char *text, unsigned int baseline) {
|
|||
CTFontGetGlyphsForCharacters(font, chars, glyphs, num_chars);
|
||||
CTFontGetAdvancesForGlyphs(font, kCTFontOrientationDefault, glyphs, advances, num_chars);
|
||||
CGRect bounding_box = CTFontGetBoundingRectsForGlyphs(font, kCTFontOrientationDefault, glyphs, boxes, num_chars);
|
||||
StringCanvas ans = { .width = 0, .height = (size_t)(2 * bounding_box.size.height) };
|
||||
for (size_t i = 0, y = 0; i < num_chars; i++) {
|
||||
positions[i] = CGPointMake(ans.width, y);
|
||||
ans.width += advances[i].width; y += advances[i].height;
|
||||
CGFloat x = 0, y = 0;
|
||||
for (size_t i = 0; i < num_chars; i++) {
|
||||
positions[i] = CGPointMake(x, y);
|
||||
x += advances[i].width; y += advances[i].height;
|
||||
}
|
||||
StringCanvas ans = { .width = (size_t)ceil(x), .height = (size_t)(2 * bounding_box.size.height) };
|
||||
ensure_render_space(ans.width, ans.height);
|
||||
render_glyphs(font, ans.width, ans.height, baseline, num_chars);
|
||||
ans.canvas = malloc(ans.width * ans.height);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue