Fix #122808: Use Default Font when Vfont Missing
For text objects, current code will use another font if you ask for a character that is not found in the selected font. But what if the selected font is invalid? This can happen with a saved Blend that uses a non-packed font that is since deleted. Current behavior will show nothing. This PR restores earlier behavior where we use the built-in font in this case. This does not make any changes to error reporting. Pull Request: https://projects.blender.org/blender/blender/pulls/124184
This commit is contained in:
parent
2149a0b2cc
commit
26ea1f42c3
@ -93,7 +93,10 @@ VChar *BKE_vfontdata_char_from_freetypefont(VFont *vfont, ulong character)
|
||||
}
|
||||
|
||||
if (font_id == -1) {
|
||||
return nullptr;
|
||||
/* This could happen for a saved file with an unpacked local font that was
|
||||
* later removed. Load the default UI font so we can still show _something_. */
|
||||
font_id = BLF_load_mem(
|
||||
vfont->data->name, static_cast<const uchar *>(builtin_font_data), builtin_font_size);
|
||||
}
|
||||
|
||||
VChar *che = (VChar *)MEM_callocN(sizeof(VChar), "objfnt_char");
|
||||
|
Loading…
Reference in New Issue
Block a user