diff --git a/__init__.py b/__init__.py index 112e507..2eddda1 100644 --- a/__init__.py +++ b/__init__.py @@ -1418,6 +1418,18 @@ def detect_text(): a = test_availability(o["font_name"], o["face_name"], o["text"]) butils.transfer_blender_object_to_text_properties(o, t) +def load_used_glyphs(): + print("LOAD USED GLYPHS") + scene = bpy.context.scene + abc3d_data = scene.abc3d_data + for t in abc3d_data.available_texts: + a = Font.test_availability(t.font_name, + t.face_name, + t.text) + if len(a["maybe"]) > 0: + for fp in a["filepaths"]: + butils.load_font_from_filepath(fp, a["maybe"]) + @persistent def load_handler(self, dummy): @@ -1425,6 +1437,7 @@ def load_handler(self, dummy): bpy.app.timers.register(butils.execute_queued_functions) butils.run_in_main_thread(butils.update_available_fonts) butils.run_in_main_thread(bpy.ops.abc3d.load_installed_fonts) + butils.run_in_main_thread(load_used_glyphs) def load_handler_unload(): if bpy.app.timers.is_registered(butils.execute_queued_functions): diff --git a/common/Font.py b/common/Font.py index 312d5c6..ef34499 100644 --- a/common/Font.py +++ b/common/Font.py @@ -234,13 +234,14 @@ def test_availability(font_name, face_name, text): return MISSING_FONT if fonts[font_name].faces.get(face_name) == None: return MISSING_FACE - loaded, missing, maybe = test_glyphs_availability(font_name, + loaded, missing, maybe, filepaths = test_glyphs_availability(font_name, face_name, text) return { "loaded": loaded, "missing": missing, "maybe": maybe, + "filepaths": filepaths, }