Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/lang/ar-ye.json
Original file line number Diff line number Diff line change
Expand Up @@ -703,5 +703,7 @@
"pin tab": "Pin tab",
"unpin tab": "Unpin tab",
"pinned tab": "Pinned tab",
"unpin tab before closing": "Unpin the tab before closing it."
"unpin tab before closing": "Unpin the tab before closing it.",
"app font": "App font",
"settings-info-app-font-family": "Choose the font used across the app interface."
}
4 changes: 3 additions & 1 deletion src/lang/be-by.json
Original file line number Diff line number Diff line change
Expand Up @@ -705,5 +705,7 @@
"pin tab": "Pin tab",
"unpin tab": "Unpin tab",
"pinned tab": "Pinned tab",
"unpin tab before closing": "Unpin the tab before closing it."
"unpin tab before closing": "Unpin the tab before closing it.",
"app font": "App font",
"settings-info-app-font-family": "Choose the font used across the app interface."
}
4 changes: 3 additions & 1 deletion src/lang/bn-bd.json
Original file line number Diff line number Diff line change
Expand Up @@ -704,5 +704,7 @@
"pin tab": "Pin tab",
"unpin tab": "Unpin tab",
"pinned tab": "Pinned tab",
"unpin tab before closing": "Unpin the tab before closing it."
"unpin tab before closing": "Unpin the tab before closing it.",
"app font": "App font",
"settings-info-app-font-family": "Choose the font used across the app interface."
}
4 changes: 3 additions & 1 deletion src/lang/cs-cz.json
Original file line number Diff line number Diff line change
Expand Up @@ -704,5 +704,7 @@
"pin tab": "Pin tab",
"unpin tab": "Unpin tab",
"pinned tab": "Pinned tab",
"unpin tab before closing": "Unpin the tab before closing it."
"unpin tab before closing": "Unpin the tab before closing it.",
"app font": "App font",
"settings-info-app-font-family": "Choose the font used across the app interface."
}
4 changes: 3 additions & 1 deletion src/lang/de-de.json
Original file line number Diff line number Diff line change
Expand Up @@ -704,5 +704,7 @@
"pin tab": "Pin tab",
"unpin tab": "Unpin tab",
"pinned tab": "Pinned tab",
"unpin tab before closing": "Unpin the tab before closing it."
"unpin tab before closing": "Unpin the tab before closing it.",
"app font": "App font",
"settings-info-app-font-family": "Choose the font used across the app interface."
}
4 changes: 3 additions & 1 deletion src/lang/en-us.json
Original file line number Diff line number Diff line change
Expand Up @@ -704,5 +704,7 @@
"pin tab": "Pin tab",
"unpin tab": "Unpin tab",
"pinned tab": "Pinned tab",
"unpin tab before closing": "Unpin the tab before closing it."
"unpin tab before closing": "Unpin the tab before closing it.",
"app font": "App font",
"settings-info-app-font-family": "Choose the font used across the app interface."
}
4 changes: 3 additions & 1 deletion src/lang/es-sv.json
Original file line number Diff line number Diff line change
Expand Up @@ -704,5 +704,7 @@
"pin tab": "Pin tab",
"unpin tab": "Unpin tab",
"pinned tab": "Pinned tab",
"unpin tab before closing": "Unpin the tab before closing it."
"unpin tab before closing": "Unpin the tab before closing it.",
"app font": "App font",
"settings-info-app-font-family": "Choose the font used across the app interface."
}
4 changes: 3 additions & 1 deletion src/lang/fr-fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -704,5 +704,7 @@
"pin tab": "Pin tab",
"unpin tab": "Unpin tab",
"pinned tab": "Pinned tab",
"unpin tab before closing": "Unpin the tab before closing it."
"unpin tab before closing": "Unpin the tab before closing it.",
"app font": "App font",
"settings-info-app-font-family": "Choose the font used across the app interface."
}
4 changes: 3 additions & 1 deletion src/lang/he-il.json
Original file line number Diff line number Diff line change
Expand Up @@ -705,5 +705,7 @@
"pin tab": "Pin tab",
"unpin tab": "Unpin tab",
"pinned tab": "Pinned tab",
"unpin tab before closing": "Unpin the tab before closing it."
"unpin tab before closing": "Unpin the tab before closing it.",
"app font": "App font",
"settings-info-app-font-family": "Choose the font used across the app interface."
}
4 changes: 3 additions & 1 deletion src/lang/hi-in.json
Original file line number Diff line number Diff line change
Expand Up @@ -705,5 +705,7 @@
"pin tab": "Pin tab",
"unpin tab": "Unpin tab",
"pinned tab": "Pinned tab",
"unpin tab before closing": "Unpin the tab before closing it."
"unpin tab before closing": "Unpin the tab before closing it.",
"app font": "App font",
"settings-info-app-font-family": "Choose the font used across the app interface."
}
4 changes: 3 additions & 1 deletion src/lang/hu-hu.json
Original file line number Diff line number Diff line change
Expand Up @@ -704,5 +704,7 @@
"pin tab": "Lap rögzítése",
"unpin tab": "Lap rögzítésének megszüntetése",
"pinned tab": "Rögzített lap",
"unpin tab before closing": "Lap rögzítésének megszüntetése bezárás előtt."
"unpin tab before closing": "Lap rögzítésének megszüntetése bezárás előtt.",
"app font": "App font",
"settings-info-app-font-family": "Choose the font used across the app interface."
}
4 changes: 3 additions & 1 deletion src/lang/id-id.json
Original file line number Diff line number Diff line change
Expand Up @@ -705,5 +705,7 @@
"pin tab": "Pin tab",
"unpin tab": "Unpin tab",
"pinned tab": "Pinned tab",
"unpin tab before closing": "Unpin the tab before closing it."
"unpin tab before closing": "Unpin the tab before closing it.",
"app font": "App font",
"settings-info-app-font-family": "Choose the font used across the app interface."
}
4 changes: 3 additions & 1 deletion src/lang/ir-fa.json
Original file line number Diff line number Diff line change
Expand Up @@ -705,5 +705,7 @@
"pin tab": "Pin tab",
"unpin tab": "Unpin tab",
"pinned tab": "Pinned tab",
"unpin tab before closing": "Unpin the tab before closing it."
"unpin tab before closing": "Unpin the tab before closing it.",
"app font": "App font",
"settings-info-app-font-family": "Choose the font used across the app interface."
}
4 changes: 3 additions & 1 deletion src/lang/it-it.json
Original file line number Diff line number Diff line change
Expand Up @@ -704,5 +704,7 @@
"pin tab": "Pin tab",
"unpin tab": "Unpin tab",
"pinned tab": "Pinned tab",
"unpin tab before closing": "Unpin the tab before closing it."
"unpin tab before closing": "Unpin the tab before closing it.",
"app font": "App font",
"settings-info-app-font-family": "Choose the font used across the app interface."
}
4 changes: 3 additions & 1 deletion src/lang/ja-jp.json
Original file line number Diff line number Diff line change
Expand Up @@ -704,5 +704,7 @@
"pin tab": "Pin tab",
"unpin tab": "Unpin tab",
"pinned tab": "Pinned tab",
"unpin tab before closing": "Unpin the tab before closing it."
"unpin tab before closing": "Unpin the tab before closing it.",
"app font": "App font",
"settings-info-app-font-family": "Choose the font used across the app interface."
}
4 changes: 3 additions & 1 deletion src/lang/ko-kr.json
Original file line number Diff line number Diff line change
Expand Up @@ -704,5 +704,7 @@
"pin tab": "Pin tab",
"unpin tab": "Unpin tab",
"pinned tab": "Pinned tab",
"unpin tab before closing": "Unpin the tab before closing it."
"unpin tab before closing": "Unpin the tab before closing it.",
"app font": "App font",
"settings-info-app-font-family": "Choose the font used across the app interface."
}
4 changes: 3 additions & 1 deletion src/lang/ml-in.json
Original file line number Diff line number Diff line change
Expand Up @@ -704,5 +704,7 @@
"pin tab": "Pin tab",
"unpin tab": "Unpin tab",
"pinned tab": "Pinned tab",
"unpin tab before closing": "Unpin the tab before closing it."
"unpin tab before closing": "Unpin the tab before closing it.",
"app font": "App font",
"settings-info-app-font-family": "Choose the font used across the app interface."
}
4 changes: 3 additions & 1 deletion src/lang/mm-unicode.json
Original file line number Diff line number Diff line change
Expand Up @@ -704,5 +704,7 @@
"pin tab": "Pin tab",
"unpin tab": "Unpin tab",
"pinned tab": "Pinned tab",
"unpin tab before closing": "Unpin the tab before closing it."
"unpin tab before closing": "Unpin the tab before closing it.",
"app font": "App font",
"settings-info-app-font-family": "Choose the font used across the app interface."
}
4 changes: 3 additions & 1 deletion src/lang/mm-zawgyi.json
Original file line number Diff line number Diff line change
Expand Up @@ -704,5 +704,7 @@
"pin tab": "Pin tab",
"unpin tab": "Unpin tab",
"pinned tab": "Pinned tab",
"unpin tab before closing": "Unpin the tab before closing it."
"unpin tab before closing": "Unpin the tab before closing it.",
"app font": "App font",
"settings-info-app-font-family": "Choose the font used across the app interface."
}
4 changes: 3 additions & 1 deletion src/lang/pl-pl.json
Original file line number Diff line number Diff line change
Expand Up @@ -704,5 +704,7 @@
"pin tab": "Pin tab",
"unpin tab": "Unpin tab",
"pinned tab": "Pinned tab",
"unpin tab before closing": "Unpin the tab before closing it."
"unpin tab before closing": "Unpin the tab before closing it.",
"app font": "App font",
"settings-info-app-font-family": "Choose the font used across the app interface."
}
4 changes: 3 additions & 1 deletion src/lang/pt-br.json
Original file line number Diff line number Diff line change
Expand Up @@ -704,5 +704,7 @@
"pin tab": "Pin tab",
"unpin tab": "Unpin tab",
"pinned tab": "Pinned tab",
"unpin tab before closing": "Unpin the tab before closing it."
"unpin tab before closing": "Unpin the tab before closing it.",
"app font": "App font",
"settings-info-app-font-family": "Choose the font used across the app interface."
}
4 changes: 3 additions & 1 deletion src/lang/pu-in.json
Original file line number Diff line number Diff line change
Expand Up @@ -704,5 +704,7 @@
"pin tab": "Pin tab",
"unpin tab": "Unpin tab",
"pinned tab": "Pinned tab",
"unpin tab before closing": "Unpin the tab before closing it."
"unpin tab before closing": "Unpin the tab before closing it.",
"app font": "App font",
"settings-info-app-font-family": "Choose the font used across the app interface."
}
4 changes: 3 additions & 1 deletion src/lang/ru-ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -704,5 +704,7 @@
"pin tab": "Pin tab",
"unpin tab": "Unpin tab",
"pinned tab": "Pinned tab",
"unpin tab before closing": "Unpin the tab before closing it."
"unpin tab before closing": "Unpin the tab before closing it.",
"app font": "App font",
"settings-info-app-font-family": "Choose the font used across the app interface."
}
4 changes: 3 additions & 1 deletion src/lang/tl-ph.json
Original file line number Diff line number Diff line change
Expand Up @@ -704,5 +704,7 @@
"pin tab": "Pin tab",
"unpin tab": "Unpin tab",
"pinned tab": "Pinned tab",
"unpin tab before closing": "Unpin the tab before closing it."
"unpin tab before closing": "Unpin the tab before closing it.",
"app font": "App font",
"settings-info-app-font-family": "Choose the font used across the app interface."
}
4 changes: 3 additions & 1 deletion src/lang/tr-tr.json
Original file line number Diff line number Diff line change
Expand Up @@ -704,5 +704,7 @@
"pin tab": "Pin tab",
"unpin tab": "Unpin tab",
"pinned tab": "Pinned tab",
"unpin tab before closing": "Unpin the tab before closing it."
"unpin tab before closing": "Unpin the tab before closing it.",
"app font": "App font",
"settings-info-app-font-family": "Choose the font used across the app interface."
}
4 changes: 3 additions & 1 deletion src/lang/uk-ua.json
Original file line number Diff line number Diff line change
Expand Up @@ -704,5 +704,7 @@
"pin tab": "Pin tab",
"unpin tab": "Unpin tab",
"pinned tab": "Pinned tab",
"unpin tab before closing": "Unpin the tab before closing it."
"unpin tab before closing": "Unpin the tab before closing it.",
"app font": "App font",
"settings-info-app-font-family": "Choose the font used across the app interface."
}
4 changes: 3 additions & 1 deletion src/lang/uz-uz.json
Original file line number Diff line number Diff line change
Expand Up @@ -704,5 +704,7 @@
"pin tab": "Pin tab",
"unpin tab": "Unpin tab",
"pinned tab": "Pinned tab",
"unpin tab before closing": "Unpin the tab before closing it."
"unpin tab before closing": "Unpin the tab before closing it.",
"app font": "App font",
"settings-info-app-font-family": "Choose the font used across the app interface."
}
4 changes: 3 additions & 1 deletion src/lang/vi-vn.json
Original file line number Diff line number Diff line change
Expand Up @@ -705,5 +705,7 @@
"pin tab": "Pin tab",
"unpin tab": "Unpin tab",
"pinned tab": "Pinned tab",
"unpin tab before closing": "Unpin the tab before closing it."
"unpin tab before closing": "Unpin the tab before closing it.",
"app font": "App font",
"settings-info-app-font-family": "Choose the font used across the app interface."
}
4 changes: 3 additions & 1 deletion src/lang/zh-cn.json
Original file line number Diff line number Diff line change
Expand Up @@ -704,5 +704,7 @@
"pin tab": "Pin tab",
"unpin tab": "Unpin tab",
"pinned tab": "Pinned tab",
"unpin tab before closing": "Unpin the tab before closing it."
"unpin tab before closing": "Unpin the tab before closing it.",
"app font": "App font",
"settings-info-app-font-family": "Choose the font used across the app interface."
}
4 changes: 3 additions & 1 deletion src/lang/zh-hant.json
Original file line number Diff line number Diff line change
Expand Up @@ -704,5 +704,7 @@
"pin tab": "Pin tab",
"unpin tab": "Unpin tab",
"pinned tab": "Pinned tab",
"unpin tab before closing": "Unpin the tab before closing it."
"unpin tab before closing": "Unpin the tab before closing it.",
"app font": "App font",
"settings-info-app-font-family": "Choose the font used across the app interface."
}
4 changes: 3 additions & 1 deletion src/lang/zh-tw.json
Original file line number Diff line number Diff line change
Expand Up @@ -704,5 +704,7 @@
"pin tab": "Pin tab",
"unpin tab": "Unpin tab",
"pinned tab": "Pinned tab",
"unpin tab before closing": "Unpin the tab before closing it."
"unpin tab before closing": "Unpin the tab before closing it.",
"app font": "App font",
"settings-info-app-font-family": "Choose the font used across the app interface."
}
3 changes: 2 additions & 1 deletion src/lib/applySettings.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ export default {
}

actions("set-height", settings.quickTools);
fonts.setFont(settings.editorFont);
fonts.setAppFont(settings.appFont);
fonts.setEditorFont(settings.editorFont);
if (!themes.applied) {
themes.apply("dark");
}
Expand Down
39 changes: 36 additions & 3 deletions src/lib/fonts.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ const customFontNames = new Set();
const CUSTOM_FONTS_KEY = "custom_fonts";
const FONT_FACE_STYLE_ID = "font-face-style";
const EDITOR_STYLE_ID = "editor-font-style";
const APP_STYLE_ID = "app-font-style";
const DEFAULT_EDITOR_FONT = "Roboto Mono";
const DEFAULT_APP_FONT_STACK = `"Roboto", sans-serif`;

add(
"Fira Code",
Expand Down Expand Up @@ -187,7 +190,11 @@ function has(name) {
return fonts.has(name);
}

async function setFont(name) {
function isCustom(name) {
return customFontNames.has(name);
}

async function setEditorFont(name) {
loader.showTitleLoader();
try {
await loadFont(name);
Expand All @@ -200,12 +207,35 @@ async function setFont(name) {
}`;
} catch (error) {
toast(`${name} font not found`, "error");
setFont("Roboto Mono");
setEditorFont(DEFAULT_EDITOR_FONT);
} finally {
loader.removeTitleLoader();
}
}

async function setAppFont(name) {
const $style = ensureStyleElement(APP_STYLE_ID);

if (!name) {
$style.textContent = `:root {
--app-font-family: ${DEFAULT_APP_FONT_STACK};
}`;
return;
}

try {
await loadFont(name);
$style.textContent = `:root {
--app-font-family: "${name}", ${DEFAULT_APP_FONT_STACK};
}`;
} catch (error) {
toast(`${name} font not found`, "error");
$style.textContent = `:root {
--app-font-family: ${DEFAULT_APP_FONT_STACK};
}`;
}
}

async function downloadFont(name, link) {
const FONT_DIR = Url.join(DATA_STORAGE, "fonts");
const FONT_FILE = Url.join(FONT_DIR, name);
Expand Down Expand Up @@ -268,6 +298,9 @@ export default {
getNames,
remove,
has,
setFont,
isCustom,
setFont: setEditorFont,
setEditorFont,
setAppFont,
loadFont,
};
1 change: 1 addition & 0 deletions src/lib/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ class Settings {
openFileListPos: this.OPEN_FILE_LIST_POS_HEADER,
quickTools: this.#IS_TABLET ? 0 : 1,
quickToolsTriggerMode: this.QUICKTOOLS_TRIGGER_MODE_TOUCH,
appFont: "",
editorFont: "Roboto Mono",
vibrateOnTap: true,
fullscreen: false,
Expand Down
3 changes: 2 additions & 1 deletion src/main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

:root {
--scrollbar-width: 4px;
--app-font-family: "Roboto", sans-serif;
}

* {
Expand All @@ -32,7 +33,7 @@ body {

body {
user-select: none;
font-family: "Roboto", sans-serif;
font-family: var(--app-font-family);
-webkit-tap-highlight-color: transparent;
background-color: #9999ff;
background-color: var(--primary-color);
Expand Down
Loading