Configure font management in JASSUB
mainJASSUB provides three ways to manage fonts to balance memory, bandwidth, and user experience (avoiding FOUT):
fonts: An array of URLs orUint8Arraydata. Use this to pre-load specific fonts immediately upon initialization. This is non-blocking.availableFonts: A map of font names to sources (URLs orUint8Array). JASSUB loads these only when needed. Note that loading these asynchronously can cause a Flash of Unstyled Text (FOUT).queryFonts: Set to'localandremote'to enable searching for fonts via the Google Fonts API if they aren't found infontsoravailableFonts.
// Recommended configuration for best UX
const instance = new JASSUB({
fonts: fileAttachments, // e.g., extracted from MKV
availableFonts: {
'My Fallback Font Family Name': './fonts/MyFallbackFont.woff2'
},
defaultFont: 'My Fallback Font Family Name',
queryFonts: 'localandremote'
})