about summary refs log tree commit diff
path: root/src/alf
diff options
context:
space:
mode:
authorEric Bailey <git@esb.lol>2024-10-10 22:18:05 -0500
committerGitHub <noreply@github.com>2024-10-10 22:18:05 -0500
commitf9b01e9eaca9628ec00c812073815318614abc40 (patch)
tree459a2e8cef40214487f0ee7c0e8229c1d561fb30 /src/alf
parent5da0bcaec27e33efd210fc2e21da564ee8d6005b (diff)
downloadvoidsky-f9b01e9eaca9628ec00c812073815318614abc40.tar.zst
Type tweaks (#5696)
* Allow system font option to revert to previous letter spacing

* Use correct types
Diffstat (limited to 'src/alf')
-rw-r--r--src/alf/fonts.ts26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/alf/fonts.ts b/src/alf/fonts.ts
index 1e4e99d3f..273282143 100644
--- a/src/alf/fonts.ts
+++ b/src/alf/fonts.ts
@@ -1,3 +1,4 @@
+import {TextStyle} from 'react-native'
 import {useFonts} from 'expo-font'
 
 import {isWeb} from '#/platform/detection'
@@ -37,10 +38,7 @@ export function setFontFamily(fontFamily: Device['fontFamily']) {
 /*
  * Unused fonts are commented out, but the files are there if we need them.
  */
-export function applyFonts(
-  style: Record<string, any>,
-  fontFamily: 'system' | 'theme',
-) {
+export function applyFonts(style: TextStyle, fontFamily: 'system' | 'theme') {
   if (fontFamily === 'theme') {
     style.fontFamily = 'InterVariable'
 
@@ -52,21 +50,23 @@ export function applyFonts(
     if (isWeb) {
       style.fontFamily += `, ${FAMILIES}`
     }
+
+    /**
+     * Disable contextual alternates in Inter
+     * {@link https://developer.mozilla.org/en-US/docs/Web/CSS/font-variant}
+     */
+    style.fontVariant = (style.fontVariant || []).concat('no-contextual')
   } else {
     // fallback families only supported on web
     if (isWeb) {
       style.fontFamily = style.fontFamily || FAMILIES
     }
-  }
 
-  style.fontVariant = style.fontVariant || []
-
-  /**
-   * Disable contextual alternates in Inter
-   * {@link https://developer.mozilla.org/en-US/docs/Web/CSS/font-variant}
-   */
-  if (fontFamily === 'theme') {
-    style.fontVariant = (style.fontVariant || []).concat('no-contextual')
+    /**
+     * Overridden to previous spacing for the `system` font option.
+     * https://github.com/bluesky-social/social-app/commit/2419096e2409008b7d71fd6b8f8d0dd5b016e267
+     */
+    style.letterSpacing = 0.25
   }
 }