Skip to content

Commit

Permalink
add inter as default font, lexend as third highly readable option
Browse files Browse the repository at this point in the history
  • Loading branch information
NyaomiDEV committed Aug 3, 2024
1 parent 4437bf0 commit 83e33c7
Show file tree
Hide file tree
Showing 27 changed files with 99 additions and 76 deletions.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added src/assets/fonts/inter/Inter-Italic.ttf
Binary file not shown.
Binary file added src/assets/fonts/inter/Inter.ttf
Binary file not shown.
Binary file added src/assets/fonts/lexend/Lexend.ttf
Binary file not shown.
2 changes: 1 addition & 1 deletion src/lib/config/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ type ViewName = "members" | "journal" | "dashboard" | "chat";

export type AccessibilityConfig = {
highLegibility: boolean,
highLegibilityType: "atkinson" | "opendyslexic",
highLegibilityType: "atkinson" | "opendyslexic" | "lexend",
theme: "auto" | "dark" | "light",
useAccentColor: boolean,
accentColor?: string,
Expand Down
15 changes: 3 additions & 12 deletions src/lib/mode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,19 +38,10 @@ export function updateAccessibility() {

const highLegibilityType = (getConfigEntry("accessibility") as AccessibilityConfig).highLegibilityType;

switch(highLegibilityType){
default:
case "atkinson":
document.documentElement.classList.remove("opendyslexic");
document.documentElement.classList.add("atkinson");
break;
case "opendyslexic":
document.documentElement.classList.remove("atkinson");
document.documentElement.classList.add("opendyslexic");
break;
}
document.documentElement.classList.remove(...[...document.documentElement.classList.values()].filter(x => x.startsWith("hl-")));
document.documentElement.classList.add("hl-" + highLegibilityType);
} else
document.documentElement.classList.remove("high-legibility", "atkinson", "opendyslexic");
document.documentElement.classList.remove("high-legibility", ...[...document.documentElement.classList.values()].filter(x => x.startsWith("hl-")));

const fontScale = (getConfigEntry("accessibility") as AccessibilityConfig).fontScale;
if (fontScale !== 1)
Expand Down
2 changes: 1 addition & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import '@ionic/vue/css/display.css';
import '@ionic/vue/css/palettes/dark.class.css';

// Import fonts
import "./styles/fonts.css";
import "./styles/fonts/fonts.css";

// Our CSS overrides
import "./styles/override.css";
Expand Down
55 changes: 0 additions & 55 deletions src/styles/fonts.css

This file was deleted.

27 changes: 27 additions & 0 deletions src/styles/fonts/atkinson-hyperlegible.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
@font-face {
font-family: "Atkinson Hyperlegible";
font-weight: normal;
font-style: normal;
src: url(../../assets/fonts/aktinson-hyperlegible/AtkinsonHyperlegible-Regular.ttf);
}

@font-face {
font-family: "Atkinson Hyperlegible";
font-weight: bold;
font-style: normal;
src: url(../../assets/fonts/aktinson-hyperlegible/AtkinsonHyperlegible-Bold.ttf);
}

@font-face {
font-family: "Atkinson Hyperlegible";
font-weight: normal;
font-style: italic;
src: url(../../assets/fonts/aktinson-hyperlegible/AtkinsonHyperlegible-Italic.ttf);
}

@font-face {
font-family: "Atkinson Hyperlegible";
font-weight: bold;
font-style: italic;
src: url(../../assets/fonts/aktinson-hyperlegible/AtkinsonHyperlegible-BoldItalic.ttf);
}
3 changes: 3 additions & 0 deletions src/styles/fonts/fonts.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@import url(inter.css);
@import url(atkinson-hyperlegible.css);
@import url(opendyslexic.css);
13 changes: 13 additions & 0 deletions src/styles/fonts/inter.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
@font-face {
font-family: 'Inter';
font-style: italic;
font-weight: 100 900;
src: url(../../assets/fonts/inter/Inter-Italic.ttf);
}

@font-face {
font-family: 'Inter';
font-style: normal;
font-weight: 100 900;
src: url(../../assets/fonts/inter/Inter.ttf);
}
6 changes: 6 additions & 0 deletions src/styles/fonts/lexend.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
@font-face {
font-family: 'Lexend';
font-style: normal;
font-weight: 100 900;
src: url(../../assets/fonts/lexend/Lexend.ttf);
}
27 changes: 27 additions & 0 deletions src/styles/fonts/opendyslexic.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
@font-face {
font-family: "OpenDyslexic";
font-weight: normal;
font-style: normal;
src: url(../../assets/fonts/open-dyslexic/OpenDyslexic-Regular.otf);
}

@font-face {
font-family: "OpenDyslexic";
font-weight: bold;
font-style: normal;
src: url(../../assets/fonts/open-dyslexic/OpenDyslexic-Bold.otf);
}

@font-face {
font-family: "OpenDyslexic";
font-weight: normal;
font-style: italic;
src: url(../../assets/fonts/open-dyslexic/OpenDyslexic-Italic.otf);
}

@font-face {
font-family: "OpenDyslexic";
font-weight: bold;
font-style: italic;
src: url(../../assets/fonts/open-dyslexic/OpenDyslexic-BoldItalic.otf);
}
18 changes: 12 additions & 6 deletions src/styles/override.css
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
html.high-legibility.atkinson {
font-family: 'Atkinson Hyperlegible', sans-serif;
--ion-font-family: 'Atkinson Hyperlegible', sans-serif;
html {
--ion-font-family: 'Inter', var(--ion-default-font);
}

html.high-legibility.opendyslexic {
font-family: 'OpenDyslexic', sans-serif;
--ion-font-family: 'OpenDyslexic', sans-serif;
html.high-legibility.hl-atkinson {
--ion-font-family: 'Atkinson Hyperlegible', var(--ion-default-font);
}

html.high-legibility.hl-opendyslexic {
--ion-font-family: 'OpenDyslexic', var(--ion-default-font);
}

html.high-legibility.hl-lexend {
--ion-font-family: 'Lexend', var(--ion-default-font);
}

ion-list-header + ion-list.md {
Expand Down
4 changes: 4 additions & 0 deletions src/views/options/Accessibility.vue
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@
<MD3SegmentButton value="opendyslexic">
<IonLabel>{{ $t("options:accessibility.highLegibilityFontType.opendyslexic") }}</IonLabel>
</MD3SegmentButton>

<MD3SegmentButton value="lexend">
<IonLabel>{{ $t("options:accessibility.highLegibilityFontType.lexend") }}</IonLabel>
</MD3SegmentButton>
</IonSegment>
</IonLabel>
</IonItem>
Expand Down
3 changes: 2 additions & 1 deletion translations/en/options.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@
"highLegibilityFontType": {
"title": "High legibility font family",
"atkinson": "Atkinson Hyperlegible",
"opendyslexic": "OpenDyslexic"
"opendyslexic": "OpenDyslexic",
"lexend": "Lexend"
},
"uiVariant": {
"title": "UI variant",
Expand Down

0 comments on commit 83e33c7

Please sign in to comment.