mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-17 14:04:52 +02:00
Forgot to initialize canvas when rendering sample text onto it
This commit is contained in:
@@ -757,6 +757,7 @@ render_sample_text(CTFace *self, PyObject *args) {
|
|||||||
CTFontGetAdvancesForGlyphs(font, kCTFontOrientationDefault, buffers.glyphs, local_advances, num_chars);
|
CTFontGetAdvancesForGlyphs(font, kCTFontOrientationDefault, buffers.glyphs, local_advances, num_chars);
|
||||||
CTFontGetBoundingRectsForGlyphs(font, kCTFontOrientationDefault, buffers.glyphs, buffers.boxes, num_chars);
|
CTFontGetBoundingRectsForGlyphs(font, kCTFontOrientationDefault, buffers.glyphs, buffers.boxes, num_chars);
|
||||||
CGFloat x = 0, y = 0;
|
CGFloat x = 0, y = 0;
|
||||||
|
memset(PyByteArray_AS_STRING(pbuf), 0, PyBytes_GET_SIZE(pbuf));
|
||||||
if (cell_width > canvas_width) goto end;
|
if (cell_width > canvas_width) goto end;
|
||||||
for (size_t i = 0; i < num_chars; i++) {
|
for (size_t i = 0; i < num_chars; i++) {
|
||||||
if (local_advances[i].width + x > canvas_width) {
|
if (local_advances[i].width + x > canvas_width) {
|
||||||
|
|||||||
@@ -933,6 +933,7 @@ render_sample_text(Face *self, PyObject *args) {
|
|||||||
unsigned int cell_width, cell_height, baseline, underline_position, underline_thickness, strikethrough_position, strikethrough_thickness;
|
unsigned int cell_width, cell_height, baseline, underline_position, underline_thickness, strikethrough_position, strikethrough_thickness;
|
||||||
cell_metrics((PyObject*)self, &cell_width, &cell_height, &baseline, &underline_position, &underline_thickness, &strikethrough_position, &strikethrough_thickness);
|
cell_metrics((PyObject*)self, &cell_width, &cell_height, &baseline, &underline_position, &underline_thickness, &strikethrough_position, &strikethrough_thickness);
|
||||||
pixel *canvas = (pixel*)PyBytes_AS_STRING(pbuf);
|
pixel *canvas = (pixel*)PyBytes_AS_STRING(pbuf);
|
||||||
|
memset(canvas, 0, PyBytes_GET_SIZE(pbuf));
|
||||||
if (cell_width > canvas_width) goto end;
|
if (cell_width > canvas_width) goto end;
|
||||||
|
|
||||||
for (ssize_t n = 0; n < PyUnicode_GET_LENGTH(ptext); n++) {
|
for (ssize_t n = 0; n < PyUnicode_GET_LENGTH(ptext); n++) {
|
||||||
|
|||||||
Reference in New Issue
Block a user