From 018222a1f4588f26b316e0ee9c10d026393a1634 Mon Sep 17 00:00:00 2001 From: "Helmut K. C. Tessarek" Date: Tue, 11 Feb 2020 17:53:12 -0500 Subject: [PATCH] Desktop, Mobile: Fixes #2477: Add new Katex fonts to improve rendering (#2478) * add katex font KaTeX_Size4-Regular.woff2 fixes #2477 * deleted: ElectronClient/app/gui/note-viewer/pluginAssets/katex/fonts/KaTeX_Size4-Regular.woff2 * add font to buildAssets.js * register font in katex.js * prepare files in case we need other fonts in the future * use all fonts --- .../lib/joplin-renderer/MdToHtml/rules/katex.js | 15 +++++++++++++++ .../lib/joplin-renderer/Tools/buildAssets.js | 15 +++++++++++++++ .../assets/katex/fonts/KaTeX_Size4-Regular.woff2 | Bin 0 -> 4740 bytes 3 files changed, 30 insertions(+) create mode 100644 ReactNativeClient/lib/joplin-renderer/assets/katex/fonts/KaTeX_Size4-Regular.woff2 diff --git a/ReactNativeClient/lib/joplin-renderer/MdToHtml/rules/katex.js b/ReactNativeClient/lib/joplin-renderer/MdToHtml/rules/katex.js index e6d662116e3..00438090c91 100644 --- a/ReactNativeClient/lib/joplin-renderer/MdToHtml/rules/katex.js +++ b/ReactNativeClient/lib/joplin-renderer/MdToHtml/rules/katex.js @@ -192,10 +192,25 @@ module.exports = function(context) { context.pluginAssets['katex'] = [ { name: 'katex.css' }, { name: 'fonts/KaTeX_Main-Regular.woff2' }, + { name: 'fonts/KaTeX_Main-Bold.woff2' }, + { name: 'fonts/KaTeX_Main-BoldItalic.woff2' }, + { name: 'fonts/KaTeX_Main-Italic.woff2' }, { name: 'fonts/KaTeX_Math-Italic.woff2' }, + { name: 'fonts/KaTeX_Math-BoldItalic.woff2' }, { name: 'fonts/KaTeX_Size1-Regular.woff2' }, { name: 'fonts/KaTeX_Size2-Regular.woff2' }, + { name: 'fonts/KaTeX_Size3-Regular.woff2' }, + { name: 'fonts/KaTeX_Size4-Regular.woff2' }, { name: 'fonts/KaTeX_AMS-Regular.woff2' }, + { name: 'fonts/KaTeX_Caligraphic-Bold.woff2' }, + { name: 'fonts/KaTeX_Caligraphic-Regular.woff2' }, + { name: 'fonts/KaTeX_Fraktur-Bold.woff2' }, + { name: 'fonts/KaTeX_Fraktur-Regular.woff2' }, + { name: 'fonts/KaTeX_SansSerif-Bold.woff2' }, + { name: 'fonts/KaTeX_SansSerif-Italic.woff2' }, + { name: 'fonts/KaTeX_SansSerif-Regular.woff2' }, + { name: 'fonts/KaTeX_Script-Regular.woff2' }, + { name: 'fonts/KaTeX_Typewriter-Regular.woff2' }, ]; }; diff --git a/ReactNativeClient/lib/joplin-renderer/Tools/buildAssets.js b/ReactNativeClient/lib/joplin-renderer/Tools/buildAssets.js index 79c1268d9f4..e46e2f139d6 100644 --- a/ReactNativeClient/lib/joplin-renderer/Tools/buildAssets.js +++ b/ReactNativeClient/lib/joplin-renderer/Tools/buildAssets.js @@ -16,10 +16,25 @@ async function main() { await copyFile(`${rootDir}/node_modules/katex/dist/katex.min.css`, 'katex/katex.css'); await copyFile(`${rootDir}/node_modules/katex/dist/fonts/KaTeX_Main-Regular.woff2`, 'katex/fonts/KaTeX_Main-Regular.woff2'); + await copyFile(`${rootDir}/node_modules/katex/dist/fonts/KaTeX_Main-Bold.woff2`, 'katex/fonts/KaTeX_Main-Bold.woff2'); + await copyFile(`${rootDir}/node_modules/katex/dist/fonts/KaTeX_Main-BoldItalic.woff2`, 'katex/fonts/KaTeX_Main-BoldItalic.woff2'); + await copyFile(`${rootDir}/node_modules/katex/dist/fonts/KaTeX_Main-Italic.woff2`, 'katex/fonts/KaTeX_Main-Italic.woff2'); await copyFile(`${rootDir}/node_modules/katex/dist/fonts/KaTeX_Math-Italic.woff2`, 'katex/fonts/KaTeX_Math-Italic.woff2'); + await copyFile(`${rootDir}/node_modules/katex/dist/fonts/KaTeX_Math-BoldItalic.woff2`, 'katex/fonts/KaTeX_Math-BoldItalic.woff2'); await copyFile(`${rootDir}/node_modules/katex/dist/fonts/KaTeX_Size1-Regular.woff2`, 'katex/fonts/KaTeX_Size1-Regular.woff2'); await copyFile(`${rootDir}/node_modules/katex/dist/fonts/KaTeX_Size2-Regular.woff2`, 'katex/fonts/KaTeX_Size2-Regular.woff2'); + await copyFile(`${rootDir}/node_modules/katex/dist/fonts/KaTeX_Size3-Regular.woff2`, 'katex/fonts/KaTeX_Size3-Regular.woff2'); + await copyFile(`${rootDir}/node_modules/katex/dist/fonts/KaTeX_Size4-Regular.woff2`, 'katex/fonts/KaTeX_Size4-Regular.woff2'); await copyFile(`${rootDir}/node_modules/katex/dist/fonts/KaTeX_AMS-Regular.woff2`, 'katex/fonts/KaTeX_AMS-Regular.woff2'); + await copyFile(`${rootDir}/node_modules/katex/dist/fonts/KaTeX_Caligraphic-Bold.woff2`, 'katex/fonts/KaTeX_Caligraphic-Bold.woff2'); + await copyFile(`${rootDir}/node_modules/katex/dist/fonts/KaTeX_Caligraphic-Regular.woff2`, 'katex/fonts/KaTeX_Caligraphic-Regular.woff2'); + await copyFile(`${rootDir}/node_modules/katex/dist/fonts/KaTeX_Fraktur-Bold.woff2`, 'katex/fonts/KaTeX_Fraktur-Bold.woff2'); + await copyFile(`${rootDir}/node_modules/katex/dist/fonts/KaTeX_Fraktur-Regular.woff2`, 'katex/fonts/KaTeX_Fraktur-Regular.woff2'); + await copyFile(`${rootDir}/node_modules/katex/dist/fonts/KaTeX_SansSerif-Bold.woff2`, 'katex/fonts/KaTeX_SansSerif-Bold.woff2'); + await copyFile(`${rootDir}/node_modules/katex/dist/fonts/KaTeX_SansSerif-Italic.woff2`, 'katex/fonts/KaTeX_SansSerif-Italic.woff2'); + await copyFile(`${rootDir}/node_modules/katex/dist/fonts/KaTeX_SansSerif-Regular.woff2`, 'katex/fonts/KaTeX_SansSerif-Regular.woff2'); + await copyFile(`${rootDir}/node_modules/katex/dist/fonts/KaTeX_Script-Regular.woff2`, 'katex/fonts/KaTeX_Script-Regular.woff2'); + await copyFile(`${rootDir}/node_modules/katex/dist/fonts/KaTeX_Typewriter-Regular.woff2`, 'katex/fonts/KaTeX_Typewriter-Regular.woff2'); await copyFile(`${rootDir}/node_modules/highlight.js/styles/atom-one-light.css`, 'highlight.js/atom-one-light.css'); await copyFile(`${rootDir}/node_modules/highlight.js/styles/atom-one-dark-reasonable.css`, 'highlight.js/atom-one-dark-reasonable.css'); diff --git a/ReactNativeClient/lib/joplin-renderer/assets/katex/fonts/KaTeX_Size4-Regular.woff2 b/ReactNativeClient/lib/joplin-renderer/assets/katex/fonts/KaTeX_Size4-Regular.woff2 new file mode 100644 index 0000000000000000000000000000000000000000..317c2fa2e758e57b39d757ded158a8f2fcb51095 GIT binary patch literal 4740 zcmV-~5_|1;Pew8T0RR9101|`%4gdfE04GEM01_?$0RR9100000000000000000000 z00006U;u$M2n-3A7ZC^wqGXyh0X7081A$BnXaEEt1&CM&gDMPv8@VB)qE?eu2*h6& zn1|-YJwOYc`X*4p@MbILNEDRSbtyKy#tT&I&P2E4#K9BG~1()`X5lFa@* zZL9bG%={^00I@K}Dx~Z{F;>86tlp^hBHhd0xUAZ|YYC7wy$4n;3&X0yux{fwha@*) zQF$OIe?QuNz3e*K-zBpGs#E2UGwa1PnLFpV$;<)nTv3AsPn`k(|LOjRNhvnS87^W8 zVqb#IGw|=spvkkMrl_ZADQec*3EnkWwQN04h+%5>!?w_*uJgpO_n|y*B+j7_4yB>G z`{VyFouBR7C+)!=>MqzZ_c(pZ^l6%>)z=@bR*oe5U@Zr1ACYwkvL|EzFqRC}0Z{FC8hU0xCAvxbqDKKFO2&EM0C^%01HggN_r@CR z0fBnsEdakM@bfS5WtvZ`hM<)C?_<=(1?WuQWxrGb4)-!pC#g0qa<&Qr8cz=E>S{c7 zDpvo>DKhm~Z=q<)C-^@S&+S9kss0AL}0v-@j0=pZO0_f1>~e+{HnXUjBvotC!H5_Yv0)$xroM z+5ZTM=AVE`^d>fT-UCm7tlxn_btpihmU#i8rsDCHqilNLCEK(Hlfl}D=*_#_en|6W z^prk1k-M9l`;^quHJT~OtUrTN&=%T=;qeyDmG?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