From 407155e6c448ede383da9f074006615f85cdd078 Mon Sep 17 00:00:00 2001 From: trisua Date: Sat, 30 Aug 2025 21:35:07 -0400 Subject: [PATCH] add: option to use inter font instead --- README.md | 4 ---- crates/app/src/public/css/root.css | 18 +++++++++++++++++- .../app/src/public/html/profile/settings.lisp | 5 +++++ crates/app/src/public/html/root.lisp | 1 + crates/core/src/model/auth.rs | 3 +++ 5 files changed, 26 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 71fcd3d..38eaa9e 100644 --- a/README.md +++ b/README.md @@ -25,10 +25,6 @@ cd ../tetratto Your first start of Tetratto might be a little slow as it's going to download all icon SVGs required for the HTML templates to render properly. These icons will be stored on disk, so there's no need to worry about this time _every_ restart. -Tetratto attempts to load `/public/fonts/lexend_variable.woff2` by defualt. This font is not included in the source by default, so you must download it yourself. Download Lexend (available from Google Fonts) as a variable font, and then create a `fonts` directory in the created `public` directory (relative to your configuration file). Place the font file (named "lexend_variable.woff2") in this fonts directory. - -Please note that Google Fonts only distributes Lexend Variable as a TTF file. You can use [`woff2_convert`](https://github.com/google/woff2) to convert the TTF into a woff2 file (`woff2_convert lexend_variable.ttf`). - ## Configuration In the directory you're running Tetratto from, you should create a `tetratto.toml` file. This file follows the configuration schema defined [here](https://trisuaso.github.io/tetratto/tetratto/config/struct.Config.html)! diff --git a/crates/app/src/public/css/root.css b/crates/app/src/public/css/root.css index 6d29ae1..d6e7a8c 100644 --- a/crates/app/src/public/css/root.css +++ b/crates/app/src/public/css/root.css @@ -87,7 +87,8 @@ @font-face { font-family: "Lexend"; - src: url("/public/fonts/lexend_variable.woff2") format("woff2"); + src: url("https://repodelivery.tetratto.com/fonts/lexend_variable.woff2") + format("woff2"); } html, @@ -106,6 +107,14 @@ body { overflow-x: hidden; } +body.use_system_font, +html:has(body.use_system_font) { + font-family: + "Inter", "Poppins", "Roboto", ui-sans-serif, system-ui, sans-serif, + "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", + "Noto Color Emoji"; +} + main { width: 80ch; margin: 0 auto; @@ -184,6 +193,13 @@ p { margin-bottom: var(--pad-4); } +p, +span:not(nav *):not(.dropdown *):not(a *):not(button *), +input, +textarea { + font-weight: 300; +} + .no_p_margin p:last-child { margin-bottom: 0; } diff --git a/crates/app/src/public/html/profile/settings.lisp b/crates/app/src/public/html/profile/settings.lisp index b04c64e..b916678 100644 --- a/crates/app/src/public/html/profile/settings.lisp +++ b/crates/app/src/public/html/profile/settings.lisp @@ -1809,6 +1809,11 @@ \"{{ profile.settings.large_text }}\", \"checkbox\", ], + [ + [\"use_system_font\", \"Always use system font instead\"], + \"{{ profile.settings.use_system_font }}\", + \"checkbox\", + ], [ [\"paged_timelines\", \"Make timelines paged instead of infinitely scrolled\"], \"{{ profile.settings.paged_timelines }}\", diff --git a/crates/app/src/public/html/root.lisp b/crates/app/src/public/html/root.lisp index 9d67642..5073670 100644 --- a/crates/app/src/public/html/root.lisp +++ b/crates/app/src/public/html/root.lisp @@ -59,6 +59,7 @@ (text "{% block head %}{% endblock %}")) (body + ("class" "{% if user and user.settings.use_system_font -%} use_system_font {%- endif %}") (div ("id" "page") (text "{% if user and user.id == 0 -%}") diff --git a/crates/core/src/model/auth.rs b/crates/core/src/model/auth.rs index 00bcfeb..ef6a6e4 100644 --- a/crates/core/src/model/auth.rs +++ b/crates/core/src/model/auth.rs @@ -372,6 +372,9 @@ pub struct UserSettings { /// Hide all badges from your username (everywhere but on profile). #[serde(default)] pub hide_username_badges: bool, + /// If the user's system font is always used over Lexend. + #[serde(default)] + pub use_system_font: bool, } fn mime_avif() -> String {