diff --git a/sbapp/main.py b/sbapp/main.py index fd5e893..2481014 100644 --- a/sbapp/main.py +++ b/sbapp/main.py @@ -566,6 +566,15 @@ class SidebandApp(MDApp): fn_italic=fb_path+"NotoSans-Italic.ttf", fn_bolditalic=fb_path+"NotoSans-BoldItalic.ttf") + LabelBase.register(name="mono", + fn_regular=fb_path+"RobotoMonoNerdFont-Regular.ttf") + + LabelBase.register(name="term", + fn_regular=fb_path+"BigBlueTerm437NerdFont-Regular.ttf") + + LabelBase.register(name="nf", + fn_regular=fb_path+"RobotoMonoNerdFont-Regular.ttf") + def update_input_language(self): language = self.sideband.config["input_language"] if language == None: diff --git a/sbapp/ui/helpers.py b/sbapp/ui/helpers.py index b1bda89..7c436a9 100644 --- a/sbapp/ui/helpers.py +++ b/sbapp/ui/helpers.py @@ -86,14 +86,8 @@ def multilingual_markup(data): if rfont != "default": do += "[/font]" - # TODO: Remove - # print(do+"\n\n"+str(time.time()-ts)) - return do.encode("utf-8") -font_map = { - "mono": "RobotoMono-Regular" -} codepoint_map = { 0x0590: [0x05ff, "hebrew"], diff --git a/sbapp/ui/messages.py b/sbapp/ui/messages.py index b77da50..1b77f82 100644 --- a/sbapp/ui/messages.py +++ b/sbapp/ui/messages.py @@ -656,7 +656,12 @@ class Messages(): def cbf(w): def x(dt): if w.texture_size[0] == 0 and w.texture_size[1] == 0: - w.text = "[i]This message could not be rendered, likely due to an error in its markup. Falling back to plain-text rendering.[/i]\n\n"+escape_markup(w.text) + w.markup = False + escaped_content = escape_markup(w.text) + def deferred(dt): + w.text = "[i]This message could not be rendered correctly, likely due to an error in its markup. Falling back to plain-text rendering.[/i]\n\n"+escaped_content + w.markup = True + Clock.schedule_once(deferred, 0.1) return x Clock.schedule_once(cbf(item.ids.content_text), 0.25)