Allow MSDF rendering for system fonts, fix crash on loading damaged / unsupported font files.

This commit is contained in:
bruvzg
2022-08-09 14:19:03 +03:00
parent c2eaaef149
commit bf1cc6326a
5 changed files with 37 additions and 6 deletions

View File

@ -1313,12 +1313,14 @@ _FORCE_INLINE_ bool TextServerAdvanced::_ensure_cache_for_size(FontAdvanced *p_f
fargs.stream = &fd->stream;
int max_index = 0;
FT_Face tmp_face;
FT_Face tmp_face = nullptr;
error = FT_Open_Face(ft_library, &fargs, -1, &tmp_face);
if (error == 0) {
if (tmp_face && error == 0) {
max_index = tmp_face->num_faces - 1;
}
FT_Done_Face(tmp_face);
if (tmp_face) {
FT_Done_Face(tmp_face);
}
error = FT_Open_Face(ft_library, &fargs, CLAMP(p_font_data->face_index, 0, max_index), &fd->face);
if (error) {