From 742b9a14c801375ba5f904edefd62f66aff7ce74 Mon Sep 17 00:00:00 2001 From: Alexander Kucera Date: Wed, 3 Sep 2025 23:05:51 +0200 Subject: [PATCH] Adds user notification on font caching failure Notifies the user when font caching fails, providing different levels of detail depending on whether debug mode is enabled. This helps the user to be aware of potential font rendering issues and provides guidance on how to troubleshoot them. --- main.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/main.ts b/main.ts index cb7ce1a..1873c1c 100644 --- a/main.ts +++ b/main.ts @@ -141,6 +141,15 @@ export class obsidianTypstPDFExport extends Plugin { console.log('Cached', fonts.length, 'fonts from typst'); } catch (error) { console.error('Failed to cache fonts from typst:', error); + + // Notify user of font caching failure (only if debug mode is enabled or if it's a critical error) + if (this.settings.behavior.debugMode) { + new Notice(`Font caching failed: ${error.message}. Using fallback fonts.`, 5000); + } else { + // For non-debug mode, show a more gentle notice + new Notice('Font list may be incomplete. Check debug mode for details.', 3000); + } + // Create fallback cache file const fallbackFonts = FALLBACK_FONTS;