From 60e896aa9eded2d7027a16fc03d8de253f33b879 Mon Sep 17 00:00:00 2001 From: Thomas Farstrike Date: Fri, 21 Nov 2025 18:46:16 +0100 Subject: [PATCH] Showfonts: add more modes --- .../META-INF/MANIFEST.JSON | 6 +- .../assets/showfonts.py | 60 +++++++++++++++---- 2 files changed, 51 insertions(+), 15 deletions(-) diff --git a/internal_filesystem/apps/com.micropythonos.showfonts/META-INF/MANIFEST.JSON b/internal_filesystem/apps/com.micropythonos.showfonts/META-INF/MANIFEST.JSON index cb484776..85d27da8 100644 --- a/internal_filesystem/apps/com.micropythonos.showfonts/META-INF/MANIFEST.JSON +++ b/internal_filesystem/apps/com.micropythonos.showfonts/META-INF/MANIFEST.JSON @@ -3,10 +3,10 @@ "publisher": "MicroPythonOS", "short_description": "Show installed fonts", "long_description": "Visualize the installed fonts so the user can check them out.", -"icon_url": "https://apps.micropythonos.com/apps/com.micropythonos.showfonts/icons/com.micropythonos.showfonts_0.0.1_64x64.png", -"download_url": "https://apps.micropythonos.com/apps/com.micropythonos.showfonts/mpks/com.micropythonos.showfonts_0.0.1.mpk", +"icon_url": "https://apps.micropythonos.com/apps/com.micropythonos.showfonts/icons/com.micropythonos.showfonts_0.0.2_64x64.png", +"download_url": "https://apps.micropythonos.com/apps/com.micropythonos.showfonts/mpks/com.micropythonos.showfonts_0.0.2.mpk", "fullname": "com.micropythonos.showfonts", -"version": "0.0.1", +"version": "0.0.2", "category": "development", "activities": [ { diff --git a/internal_filesystem/apps/com.micropythonos.showfonts/assets/showfonts.py b/internal_filesystem/apps/com.micropythonos.showfonts/assets/showfonts.py index 008feae7..d03e8119 100644 --- a/internal_filesystem/apps/com.micropythonos.showfonts/assets/showfonts.py +++ b/internal_filesystem/apps/com.micropythonos.showfonts/assets/showfonts.py @@ -10,21 +10,53 @@ class ShowFonts(Activity): if focusgroup: focusgroup.add_obj(screen) - self.addAllFonts(screen) - #self.addAllGlyphs(screen) + y=0 + y = self.addAllFontsTitles(screen) + #self.addAllFonts(screen) + self.addAllGlyphs(screen, y) self.setContentView(screen) + + def addAllFontsTitles(self, screen): + fonts = [ + (lv.font_montserrat_8, "Montserrat 8"), # almost too small to read + (lv.font_montserrat_10, "Montserrat 10"), # +2 + (lv.font_montserrat_12, "Montserrat 12"), # +2 (default font, great for launcher and small labels) + (lv.font_unscii_8, "Unscii 8"), + (lv.font_montserrat_14, "Montserrat 14"), # +2 + (lv.font_montserrat_16, "Montserrat 16"), # +2 + #(lv.font_Noto_Sans_sat_emojis_compressed, + # "Noto Sans 16SF"), # 丰 and 😀 + (lv.font_montserrat_18, "Montserrat 18"), # +2 + (lv.font_montserrat_20, "Montserrat 20"), # +2 + (lv.font_montserrat_24, "Montserrat 24"), # +4 + (lv.font_unscii_16, "Unscii 16"), + (lv.font_montserrat_28_compressed, "Montserrat 28"), # +4 + (lv.font_montserrat_34, "Montserrat 34"), # +6 + (lv.font_montserrat_40, "Montserrat 40"), # +6 + (lv.font_montserrat_48, "Montserrat 48"), # +8 + ] + + y = 0 + for font, name in fonts: + title = lv.label(screen) + title.set_style_text_font(font, 0) + title.set_text(f"{name}: 2357 !@#$%^&*( {lv.SYMBOL.OK} {lv.SYMBOL.BACKSPACE} 丰 😀") + title.set_pos(0, y) + y += font.get_line_height() + 4 + + return y + def addAllFonts(self, screen): fonts = [ (lv.font_montserrat_10, "Montserrat 10"), (lv.font_unscii_8, "Unscii 8"), - (lv.font_montserrat_16, "Montserrat 16"), # +6 + (lv.font_montserrat_16, "Montserrat 16"), # +4 (lv.font_montserrat_22, "Montserrat 22"), # +6 (lv.font_unscii_16, "Unscii 16"), (lv.font_montserrat_30, "Montserrat 30"), # +8 (lv.font_montserrat_38, "Montserrat 38"), # +8 (lv.font_montserrat_48, "Montserrat 48"), # +10 - (lv.font_dejavu_16_persian_hebrew, "DejaVu 16 Persian/Hebrew"), ] dsc = lv.font_glyph_dsc_t() @@ -33,7 +65,7 @@ class ShowFonts(Activity): for font, name in fonts: x = 0 title = lv.label(screen) - title.set_text(name + ":") + title.set_text(name + ": 2357 !@#$%^&*(") title.set_style_text_font(lv.font_montserrat_16, 0) title.set_pos(x, y) y += title.get_height() + 20 @@ -59,16 +91,17 @@ class ShowFonts(Activity): - def addAllGlyphs(self, screen): + def addAllGlyphs(self, screen, start_y): fonts = [ + #(lv.font_Noto_Sans_sat_emojis_compressed, + # "Noto Sans 16SF"), # 丰 and 😀 (lv.font_montserrat_16, "Montserrat 16"), - (lv.font_unscii_16, "Unscii 16"), - (lv.font_unscii_8, "Unscii 8"), - (lv.font_dejavu_16_persian_hebrew, "DejaVu 16 Persian/Hebrew"), + #(lv.font_unscii_16, "Unscii 16"), + #(lv.font_unscii_8, "Unscii 8"), ] dsc = lv.font_glyph_dsc_t() - y = 40 + y = start_y for font, name in fonts: title = lv.label(screen) @@ -79,9 +112,12 @@ class ShowFonts(Activity): line_height = font.get_line_height() + 4 x = 4 - - for cp in range(0x20, 0xFFFF + 1): + for cp in range(0x20, 0x1F9FF): + #for cp in range(0x20, 35920 + 1): + #for cp in range(0x20, 0xFFFF + 1): if font.get_glyph_dsc(font, dsc, cp, cp): + #print(f"{cp} : {chr(cp)}", end="") + #print(f"{chr(cp)},", end="") lbl = lv.label(screen) lbl.set_style_text_font(font, 0) lbl.set_text(chr(cp))