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.
This commit is contained in:
AlexKucera committed 2025-09-03 23:05:51 +02:00
1 parent ddac8bd045
commit 742b9a14c8
1 file changed
+9
+9
View File
@@ -141,6 +141,15 @@ export class obsidianTypstPDFExport extends Plugin {
console.log('Cached', fonts.length, 'fonts from typst'); console.log('Cached', fonts.length, 'fonts from typst');
} catch (error) { } catch (error) {
console.error('Failed to cache fonts from typst:', 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 // Create fallback cache file
const fallbackFonts = FALLBACK_FONTS; const fallbackFonts = FALLBACK_FONTS;