diff --git a/plugins/text-freetype2/text-freetype2.c b/plugins/text-freetype2/text-freetype2.c index 45748e8d3..b23b07215 100644 --- a/plugins/text-freetype2/text-freetype2.c +++ b/plugins/text-freetype2/text-freetype2.c @@ -356,7 +356,8 @@ static void ft2_source_update(void *data, obs_data_t settings) } srcdata->texbuf = bzalloc(texbuf_w * texbuf_h * 4); - cache_standard_glyphs(srcdata); + if (srcdata->font_face) + cache_standard_glyphs(srcdata); skip_font_load:; if (from_file) { const char *tmp = obs_data_get_string(settings, "text_file"); @@ -392,9 +393,10 @@ skip_font_load:; os_utf8_to_wcs_ptr(tmp, strlen(tmp), &srcdata->text); } - cache_glyphs(srcdata, srcdata->text); - - set_up_vertex_buffer(srcdata); + if (srcdata->font_face) { + cache_glyphs(srcdata, srcdata->text); + set_up_vertex_buffer(srcdata); + } error: obs_data_release(font_obj); diff --git a/plugins/text-freetype2/text-functionality.c b/plugins/text-freetype2/text-functionality.c index 7963aee9b..4b885f0bd 100644 --- a/plugins/text-freetype2/text-functionality.c +++ b/plugins/text-freetype2/text-functionality.c @@ -216,9 +216,14 @@ void cache_standard_glyphs(struct ft2_source *srcdata) void cache_glyphs(struct ft2_source *srcdata, wchar_t *cache_glyphs) { - FT_GlyphSlot slot = srcdata->font_face->glyph; + FT_GlyphSlot slot; FT_UInt glyph_index = 0; + if (!srcdata->font_face) + return; + + slot = srcdata->font_face->glyph; + uint32_t dx = srcdata->texbuf_x, dy = srcdata->texbuf_y; uint8_t alpha;