Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit f7ee09b

Browse filesBrowse files
committed
Fix memory leak and render tofu
1 parent c687e53 commit f7ee09b
Copy full SHA for f7ee09b

File tree

1 file changed

+11
-2
lines changed
Filter options

1 file changed

+11
-2
lines changed

‎src/ft2font.cpp

Copy file name to clipboardExpand all lines: src/ft2font.cpp
+11-2Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,10 @@ FT2Font::~FT2Font()
377377
if (face) {
378378
FT_Done_Face(face);
379379
}
380+
381+
for (size_t i = 0; i < fallbacks.size(); i++) {
382+
Py_DECREF(fallbacks[i]->get_pyfont());
383+
}
380384
}
381385

382386
void FT2Font::clear()
@@ -508,15 +512,20 @@ void FT2Font::set_text(
508512
FT_BBox glyph_bbox;
509513
FT_Pos last_advance;
510514

511-
FT_UInt final_glyph_index;
515+
FT_UInt final_glyph_index = 0;
512516
FT_Error charcode_error, glyph_error;
513517
FT2Font *ft_object_with_glyph = this;
514518
bool was_found = load_char_with_fallback(ft_object_with_glyph, final_glyph_index, glyphs,
515519
char_to_font, glyph_to_font, codepoints[n], flags,
516520
charcode_error, glyph_error, false);
517521
if (!was_found) {
518522
ft_glyph_warn((FT_ULong)codepoints[n]);
519-
continue;
523+
524+
// render tofu
525+
// ft_object_with_glyph == this
526+
char_to_font[codepoints[n]] = ft_object_with_glyph;
527+
glyph_to_font[final_glyph_index] = ft_object_with_glyph;
528+
ft_object_with_glyph->load_glyph(final_glyph_index, flags, ft_object_with_glyph, false);
520529
}
521530

522531
glyph_index = final_glyph_index;

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.