add: option to use inter font instead

This commit is contained in:
trisua 2025-08-30 21:35:07 -04:00
parent da58323ed8
commit 407155e6c4
5 changed files with 26 additions and 5 deletions

View file

@ -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)!

View file

@ -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;
}

View file

@ -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 }}\",

View file

@ -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 -%}")

View file

@ -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 {