From b2099c9dcedc713cc7ff3f9be253b7b218f7fb72 Mon Sep 17 00:00:00 2001 From: Bobby Date: Sun, 25 Jun 2023 16:06:41 -0400 Subject: Font Rendering for Japanese and Code Blocks --- static/css/fonts.css | 28 +++++++++++++++++++++++++--- static/css/styles.css | 4 ++-- static/fonts/COCOLGR.otf | Bin 0 -> 95668 bytes static/fonts/pdos.ttf | Bin 81192 -> 0 bytes static/js/tl.js | 13 ++++++++++--- templates/blog/partials/sidebar.html | 4 ++-- templates/blog_admin/edit_post.html | 1 - 7 files changed, 39 insertions(+), 11 deletions(-) create mode 100644 static/fonts/COCOLGR.otf delete mode 100644 static/fonts/pdos.ttf diff --git a/static/css/fonts.css b/static/css/fonts.css index c035afaf..e25f479a 100644 --- a/static/css/fonts.css +++ b/static/css/fonts.css @@ -1,6 +1,28 @@ +@import url('https://fonts.googleapis.com/css2?family=Mali:ital,wght@0,400;0,700;1,400;1,700&display=swap'); +@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@400;700&display=swap'); + @font-face { - font-family: 'TopNavbar'; - src: url('../fonts/pdos.ttf') format('truetype'); + font-family: 'Comic Code Regular'; + src: url('../fonts/COCOLGR.otf') format('opentype'); font-weight: normal; font-style: normal; -} \ No newline at end of file +} + +@font-face { + font-family: 'Hatsukoi Friends Mini'; + src: url('../fonts/HAKOIMI.otf') format('opentype'); + font-weight: normal; + font-style: normal; +} + +code { + font-family: 'Comic Code Regular', sans-serif; +} + +.en { + font-family: 'Mali', sans-serif; +} + +body.ja, .ja { + font-family: 'Noto Sans JP', sans-serif; +} diff --git a/static/css/styles.css b/static/css/styles.css index 8639081b..6ae81a7e 100644 --- a/static/css/styles.css +++ b/static/css/styles.css @@ -1,6 +1,6 @@ @import url(search.css); @import url(sidebar.css); -@import url('https://fonts.googleapis.com/css2?family=Mali:ital,wght@0,400;0,700;1,400;1,700&display=swap'); +@import url('fonts.css'); body { position: unset !important; @@ -516,4 +516,4 @@ blockquote { max-height: 300px; max-width: 300px; } -} \ No newline at end of file +} diff --git a/static/fonts/COCOLGR.otf b/static/fonts/COCOLGR.otf new file mode 100644 index 00000000..350e70ec Binary files /dev/null and b/static/fonts/COCOLGR.otf differ diff --git a/static/fonts/pdos.ttf b/static/fonts/pdos.ttf deleted file mode 100644 index f5cbfc06..00000000 Binary files a/static/fonts/pdos.ttf and /dev/null differ diff --git a/static/js/tl.js b/static/js/tl.js index 599f64bd..44c8b044 100644 --- a/static/js/tl.js +++ b/static/js/tl.js @@ -13,13 +13,15 @@ function restoreLang() { localStorage.setItem("lang", "en"); $('#tl_ja').hide(); $('#tl_en').show(); + $('body').addClass('en'); + $('body').removeClass('ja'); var translateContainers = $('iframe'); if (translateContainers.length === 0) { // nothing } else { translateContainers.each(function (index, element) { - if (element.contentWindow.document.getElementById(":1.restore")) { - element.contentWindow.document.getElementById(":1.restore").click(); + if (element.contentWindow.document.getElementById(":1.close")) { + element.contentWindow.document.getElementById(":1.close").click(); } }); } @@ -29,8 +31,9 @@ function translateJapanese() { localStorage.setItem("lang", "ja"); $('#tl_en').hide(); $('#tl_ja').show(); + $('body').addClass('ja'); + $('body').removeClass('en'); var selectEl = document.querySelector("select.goog-te-combo"); - console.log(selectEl); if (!selectEl) { setTimeout(function () { translateJapanese(); @@ -54,8 +57,12 @@ if (!currentLang) { if (currentLang === "ja") { $('#tl_en').hide(); $('#tl_ja').show(); + $('body').addClass('ja'); + $('body').removeClass('en'); } else { $('#tl_ja').hide(); $('#tl_en').show(); + $('body').addClass('en'); + $('body').removeClass('ja'); restoreLang(); } diff --git a/templates/blog/partials/sidebar.html b/templates/blog/partials/sidebar.html index 9fc75206..57f0e5ca 100644 --- a/templates/blog/partials/sidebar.html +++ b/templates/blog/partials/sidebar.html @@ -133,8 +133,8 @@ Translate - - + + {% comment %}
  • diff --git a/templates/blog_admin/edit_post.html b/templates/blog_admin/edit_post.html index 164bd1a1..ae17ff9d 100644 --- a/templates/blog_admin/edit_post.html +++ b/templates/blog_admin/edit_post.html @@ -187,7 +187,6 @@ var content = $("#body").val(); content = content.replace(/


    <\/p>/g, ""); - console.log(content); //quill.setContents(quill.clipboard.convert(content), "silent"); quill.clipboard.dangerouslyPasteHTML(0, content); quill.on("text-change", function (delta, oldDelta, source) { -- cgit v1.2.3