Fix PWA manifest error in dev, handle invalid font data
Remove hardcoded manifest link from index.html (VitePWA injects it in production builds). Catch FontFace.load() rejections from invalid font data with a warning.
This commit is contained in:
parent
07e9182b4c
commit
c33e4152df
|
|
@ -8,7 +8,6 @@
|
|||
<link rel="apple-touch-icon" href="/apple-touch-icon.png" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, viewport-fit=cover" />
|
||||
<meta name="theme-color" content="#1e1e1e" />
|
||||
<link rel="manifest" href="/manifest.webmanifest" />
|
||||
<title>OpenPencil</title>
|
||||
<style>
|
||||
body { margin: 0; background: #1e1e1e; }
|
||||
|
|
|
|||
|
|
@ -191,7 +191,9 @@ function registerFontInBrowser(family: string, style: string, data: ArrayBuffer)
|
|||
weight: String(weight),
|
||||
style: italic
|
||||
})
|
||||
face.load().then(() => document.fonts.add(face))
|
||||
face.load().then(() => document.fonts.add(face)).catch(() => {
|
||||
console.warn(`Failed to load font "${family}" (${style})`)
|
||||
})
|
||||
}
|
||||
|
||||
export function styleToWeight(style: string): number {
|
||||
|
|
|
|||
Loading…
Reference in a new issue