Skip to content

Commit

Permalink
Replaced font for Vietnamese (#442)
Browse files Browse the repository at this point in the history
* Update style.css

Vietnam pro font

* Update languages.js

ads vi font

* Rename languages.js to scripts/languages.js

fix conflicts
  • Loading branch information
prem-k-r authored Jan 7, 2025
1 parent cff7890 commit 1783600
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
9 changes: 9 additions & 0 deletions scripts/languages.js
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,15 @@ function applyLanguage(lang) {
menuCont.style.width = menuWidths[lang] || menuWidths['en'];
}

// Dynamically update the font family based on the language
const root = document.documentElement;
const commonFontStack = "'poppins', 'Poppins', sans-serif";
if (lang === 'vi') {
root.style.setProperty('--main-font-family', `'Be Vietnam Pro', ${commonFontStack}`);
} else {
root.style.setProperty('--main-font-family', commonFontStack);
}

// Save the selected language in localStorage
saveLanguageStatus('selectedLanguage', lang);
}
Expand Down
9 changes: 6 additions & 3 deletions style.css
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/

@import url("https://fonts.googleapis.com/css2?family=Poppins&display=swap");
/* @import url('https://fonts.googleapis.com/css2?family=Borel&family=Poppins&display=swap'); */
@import url("https://fonts.googleapis.com/css2?family=Be+Vietnam+Pro&display=swap");

@font-face {
font-family: "poppins";
Expand All @@ -18,11 +18,14 @@
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: "poppins", "Poppins", sans-serif;
font-family: var(--main-font-family);
user-select: none;
}

:root {
/* Default font */
--main-font-family: "poppins", "Poppins", sans-serif;

/* 🔵🔵🔵 */
/* ⚠️ Please don't change the color value or names for Blue (if ? modifying code would be difficult */
--bg-color-blue: #bbd6fd;
Expand Down Expand Up @@ -1179,7 +1182,7 @@ body #bookmarkButton.bookmark-button.rotate {
}

#userText {
font-family: "poppins", "Poppins", serif;
font-family: var(--main-font-family);
font-size: 1.4rem;
margin-bottom: 10px;
}
Expand Down

0 comments on commit 1783600

Please sign in to comment.