Skip to content

Commit

Permalink
Font loading improvements (#6993)
Browse files Browse the repository at this point in the history
* Font loading improvements

* Reconvert with missing files

* Update bskyweb/templates/base.html

Co-authored-by: Rick Viscomi <[email protected]>

* Update bskyweb/templates/base.html

Co-authored-by: Rick Viscomi <[email protected]>

* Run web-build to update hashes

* Revert Android to otf

* Use Inter woff2 files

---------

Co-authored-by: Rick Viscomi <[email protected]>
  • Loading branch information
tunetheweb and rviscomi authored Dec 10, 2024
1 parent 6308e91 commit bee50c3
Show file tree
Hide file tree
Showing 26 changed files with 10 additions and 12 deletions.
4 changes: 2 additions & 2 deletions app.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -234,8 +234,8 @@ module.exports = function (config) {
'expo-font',
{
fonts: [
'./assets/fonts/inter/InterVariable.ttf',
'./assets/fonts/inter/InterVariable-Italic.ttf',
'./assets/fonts/inter/InterVariable.woff2',
'./assets/fonts/inter/InterVariable-Italic.woff2',
// Android only
'./assets/fonts/inter/Inter-Regular.otf',
'./assets/fonts/inter/Inter-Italic.otf',
Expand Down
Binary file added assets/fonts/inter/Inter-Black.woff2
Binary file not shown.
Binary file added assets/fonts/inter/Inter-BlackItalic.woff2
Binary file not shown.
Binary file added assets/fonts/inter/Inter-Bold.woff2
Binary file not shown.
Binary file added assets/fonts/inter/Inter-BoldItalic.woff2
Binary file not shown.
Binary file added assets/fonts/inter/Inter-ExtraBold.woff2
Binary file not shown.
Binary file added assets/fonts/inter/Inter-ExtraBoldItalic.woff2
Binary file not shown.
Binary file added assets/fonts/inter/Inter-ExtraLight.woff2
Binary file not shown.
Binary file added assets/fonts/inter/Inter-ExtraLightItalic.woff2
Binary file not shown.
Binary file added assets/fonts/inter/Inter-Italic.woff2
Binary file not shown.
Binary file added assets/fonts/inter/Inter-Light.woff2
Binary file not shown.
Binary file added assets/fonts/inter/Inter-LightItalic.woff2
Binary file not shown.
Binary file added assets/fonts/inter/Inter-Medium.woff2
Binary file not shown.
Binary file added assets/fonts/inter/Inter-MediumItalic.woff2
Binary file not shown.
Binary file added assets/fonts/inter/Inter-Regular.woff2
Binary file not shown.
Binary file added assets/fonts/inter/Inter-SemiBold.woff2
Binary file not shown.
Binary file added assets/fonts/inter/Inter-SemiBoldItalic.woff2
Binary file not shown.
Binary file added assets/fonts/inter/Inter-Thin.woff2
Binary file not shown.
Binary file added assets/fonts/inter/Inter-ThinItalic.woff2
Binary file not shown.
Binary file added assets/fonts/inter/InterVariable-Italic.woff2
Binary file not shown.
Binary file added assets/fonts/inter/InterVariable.woff2
Binary file not shown.
Binary file not shown.
Binary file not shown.
7 changes: 3 additions & 4 deletions bskyweb/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@

<!-- Hello Humans! API docs at https://atproto.com -->

<link rel="preload" as="font" type="font/ttf" href="{{ staticCDNHost }}/static/media/InterVariable.c9f788f6e7ebaec75d7c.ttf">
<link rel="preload" as="font" type="font/ttf" href="{{ staticCDNHost }}/static/media/InterVariable-Italic.55d6a3f35e9b605ba6f4.ttf">
<link rel="preload" as="font" type="font/ttf" href="{{ staticCDNHost }}/static/media/InterVariable.c504db5c06caaf7cdfba.woff2">

<style>
/**
Expand All @@ -26,14 +25,14 @@
*/
@font-face {
font-family: 'InterVariable';
src: url("{{ staticCDNHost }}/static/media/InterVariable.c9f788f6e7ebaec75d7c.ttf") format('truetype');
src: url("{{ staticCDNHost }}/static/media/InterVariable.c504db5c06caaf7cdfba.woff2") format('woff2');
font-weight: 300 1000;
font-style: normal;
font-display: swap;
}
@font-face {
font-family: 'InterVariableItalic';
src: url("{{ staticCDNHost }}/static/media/InterVariable-Italic.55d6a3f35e9b605ba6f4.ttf") format('truetype');
src: url("{{ staticCDNHost }}/static/media/InterVariable-Italic.01dcbad1bac635f9c9cd.woff2") format('woff2');
font-weight: 300 1000;
font-style: italic;
font-display: swap;
Expand Down
4 changes: 2 additions & 2 deletions src/alf/util/unusedUseFonts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {useFonts} from 'expo-font'
*/
export function DO_NOT_USE() {
return useFonts({
InterVariable: require('../../../assets/fonts/inter/InterVariable.ttf'),
'InterVariable-Italic': require('../../../assets/fonts/inter/InterVariable-Italic.ttf'),
InterVariable: require('../../../assets/fonts/inter/InterVariable.woff2'),
'InterVariable-Italic': require('../../../assets/fonts/inter/InterVariable-Italic.woff2'),
})
}
7 changes: 3 additions & 4 deletions web/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@
<link rel="preconnect" href="https://bsky.network">
<title>%WEB_TITLE%</title>

<link rel="preload" as="font" type="font/ttf" href="/static/media/InterVariable.c9f788f6e7ebaec75d7c.ttf">
<link rel="preload" as="font" type="font/ttf" href="/static/media/InterVariable-Italic.55d6a3f35e9b605ba6f4.ttf">
<link rel="preload" as="font" type="font/woff2" href="/static/media/InterVariable.c504db5c06caaf7cdfba.woff2" crossorigin>

<style>
/**
Expand All @@ -31,14 +30,14 @@
*/
@font-face {
font-family: 'InterVariable';
src: url(/static/media/InterVariable.c9f788f6e7ebaec75d7c.ttf) format('truetype');
src: url(/static/media/InterVariable.c504db5c06caaf7cdfba.woff2) format('woff2');
font-weight: 300 1000;
font-style: normal;
font-display: swap;
}
@font-face {
font-family: 'InterVariableItalic';
src: url(/static/media/InterVariable-Italic.55d6a3f35e9b605ba6f4.ttf) format('truetype');
src: url(/static/media/InterVariable-Italic.01dcbad1bac635f9c9cd.woff2) format('woff2');
font-weight: 300 1000;
font-style: italic;
font-display: swap;
Expand Down

0 comments on commit bee50c3

Please sign in to comment.