我希望能在运行时下载字体并在整个应用程序中应用。有一种方法是将ttf文件放置在字体文件夹中,但这会增加包的大小。
我希望能在运行时下载字体并在整个应用程序中应用。有一种方法是将ttf文件放置在字体文件夹中,但这会增加包的大小。
const fontAsBase64 = fs.readFileSync('/path/to/font.ttf', {encoding: 'base64'});
loadFont('nameOfTheFont', fontAsBase64, 'ttf').then((name: string) => {
console.log('Loaded font successfully. Font name is: ', name);
});