Skip to content

Commit 7f48486

Browse files
committed
webui: Bugfix (font embedding)
1 parent 1fca8ef commit 7f48486

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

tools/server/webui/vite.config.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ const GUIDE_FOR_FRONTEND = `
1818

1919
const MAX_BUNDLE_SIZE = 2 * 1024 * 1024;
2020

21-
const DO_EMBED_FONTS = false; // The embedded mode is not yet ready :-(.
21+
// true: embed KaTeX-fonts into index.html, false: don't embed fonts.
22+
const DO_EMBED_FONTS = true;
2223

2324
function llamaCppBuildPlugin() {
2425
return {
@@ -70,7 +71,7 @@ function llamaCppBuildPlugin() {
7071
// Replace both the original and hashed references
7172
// e.g. url(./KaTeX_Math-Italic.flOr_0UB.ttf) has to be replaces by a base64 data url.
7273
const bufData = Buffer.from(fontContent).toString('base64');
73-
srcUrl = `src:url('data:application/font-woff2;base64,${bufData}') format("woff2")`;
74+
srcUrl = `src:url(data:application/font-woff2;base64,${bufData}) format("woff2")`;
7475
}
7576
} else {
7677
console.log('Missing font file', fontPath);

0 commit comments

Comments
 (0)