Skip to content

Commit

Permalink
Use optimized font from fontsource (#2775)
Browse files Browse the repository at this point in the history
  • Loading branch information
sandhose authored Nov 14, 2024
1 parent 2297675 commit 3b3f776
Show file tree
Hide file tree
Showing 19 changed files with 19 additions and 98 deletions.
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
"@babel/preset-react": "^7.22.15",
"@babel/preset-typescript": "^7.23.0",
"@codecov/vite-plugin": "^1.3.0",
"@fontsource/inconsolata": "^5.1.0",
"@fontsource/inter": "^5.1.0",
"@formatjs/intl-durationformat": "^0.6.1",
"@formatjs/intl-segmenter": "^11.7.3",
"@livekit/components-core": "^0.11.0",
Expand Down
Binary file removed public/fonts/Inter/Inter-Bold.woff
Binary file not shown.
Binary file removed public/fonts/Inter/Inter-Bold.woff2
Binary file not shown.
Binary file removed public/fonts/Inter/Inter-BoldItalic.woff
Binary file not shown.
Binary file removed public/fonts/Inter/Inter-BoldItalic.woff2
Binary file not shown.
Binary file removed public/fonts/Inter/Inter-Italic.woff
Binary file not shown.
Binary file removed public/fonts/Inter/Inter-Italic.woff2
Binary file not shown.
Binary file removed public/fonts/Inter/Inter-Medium.woff
Binary file not shown.
Binary file removed public/fonts/Inter/Inter-Medium.woff2
Binary file not shown.
Binary file removed public/fonts/Inter/Inter-MediumItalic.woff
Binary file not shown.
Binary file removed public/fonts/Inter/Inter-MediumItalic.woff2
Binary file not shown.
Binary file removed public/fonts/Inter/Inter-Regular.woff
Binary file not shown.
Binary file removed public/fonts/Inter/Inter-Regular.woff2
Binary file not shown.
Binary file removed public/fonts/Inter/Inter-SemiBold.woff
Binary file not shown.
Binary file removed public/fonts/Inter/Inter-SemiBold.woff2
Binary file not shown.
Binary file removed public/fonts/Inter/Inter-SemiBoldItalic.woff
Binary file not shown.
Binary file removed public/fonts/Inter/Inter-SemiBoldItalic.woff2
Binary file not shown.
105 changes: 7 additions & 98 deletions src/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@ SPDX-License-Identifier: AGPL-3.0-only
Please see LICENSE in the repository root for full details.
*/

/* Inter unexpectedly contains various codepoints which collide with emoji, even
when variation-16 is applied to request the emoji variant. From eyeballing
the emoji picker, these are: 20e3, 23cf, 24c2, 25a0-25c1, 2665, 2764, 2b06, 2b1c.
Therefore we define a unicode-range to load which excludes the glyphs
(to avoid having to maintain a fork of Inter). */

@layer normalize, compound-legacy, compound;

@import url("@fontsource/inter/400.css");
@import url("@fontsource/inter/500.css");
@import url("@fontsource/inter/600.css");
@import url("@fontsource/inter/700.css");
@import url("@fontsource/inconsolata/400.css");
@import url("@fontsource/inconsolata/700.css");

@import url("normalize.css/normalize.css") layer(normalize);
@import url("@vector-im/compound-design-tokens/assets/web/css/compound-design-tokens.css")
layer(compound);
Expand Down Expand Up @@ -52,94 +53,6 @@ layer(compound);
--stopgap-background-85: rgba(16, 19, 23, 0.85);
}

@font-face {
font-family: "Inter";
font-style: normal;
font-weight: 400;
font-display: swap;
unicode-range: var(--inter-unicode-range);
src:
url("/fonts/Inter/Inter-Regular.woff2") format("woff2"),
url("/fonts/Inter/Inter-Regular.woff") format("woff");
}

@font-face {
font-family: "Inter";
font-style: italic;
font-weight: 400;
font-display: swap;
unicode-range: var(--inter-unicode-range);
src:
url("/fonts/Inter/Inter-Italic.woff2") format("woff2"),
url("/fonts/Inter/Inter-Italic.woff") format("woff");
}

@font-face {
font-family: "Inter";
font-style: normal;
font-weight: 500;
font-display: swap;
unicode-range: var(--inter-unicode-range);
src:
url("/fonts/Inter/Inter-Medium.woff2") format("woff2"),
url("/fonts/Inter/Inter-Medium.woff") format("woff");
}

@font-face {
font-family: "Inter";
font-style: italic;
font-weight: 500;
font-display: swap;
unicode-range: var(--inter-unicode-range);
src:
url("/fonts/Inter/Inter-MediumItalic.woff2") format("woff2"),
url("/fonts/Inter/Inter-MediumItalic.woff") format("woff");
}

@font-face {
font-family: "Inter";
font-style: normal;
font-weight: 600;
font-display: swap;
unicode-range: var(--inter-unicode-range);
src:
url("/fonts/Inter/Inter-SemiBold.woff2") format("woff2"),
url("/fonts/Inter/Inter-SemiBold.woff") format("woff");
}

@font-face {
font-family: "Inter";
font-style: italic;
font-weight: 600;
font-display: swap;
unicode-range: var(--inter-unicode-range);
src:
url("/fonts/Inter/Inter-SemiBoldItalic.woff2") format("woff2"),
url("/fonts/Inter/Inter-SemiBoldItalic.woff") format("woff");
}

@font-face {
font-family: "Inter";
font-style: normal;
font-weight: 700;
font-display: swap;
unicode-range: var(--inter-unicode-range);
src:
url("/fonts/Inter/Inter-Bold.woff2") format("woff2"),
url("/fonts/Inter/Inter-Bold.woff") format("woff");
}

@font-face {
font-family: "Inter";
font-style: italic;
font-weight: 700;
font-display: swap;
unicode-range: var(--inter-unicode-range);
src:
url("/fonts/Inter/Inter-BoldItalic.woff2") format("woff2"),
url("/fonts/Inter/Inter-BoldItalic.woff") format("woff");
}

body {
background-color: var(--cpd-color-bg-canvas-default);
background-size: calc(max(1440px, 100vw)) calc(max(800px, 100vh));
Expand Down Expand Up @@ -185,10 +98,6 @@ body[data-platform="ios"] {
--cpd-font-family-sans: -apple-system, BlinkMacSystemFont, "Inter", sans-serif;
}

body[data-platform="desktop"] {
--cpd-font-family-sans: "Inter", sans-serif;
}

@layer compound-legacy {
h1,
h2,
Expand Down
10 changes: 10 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1657,6 +1657,16 @@
resolved "https://registry.yarnpkg.com/@floating-ui/utils/-/utils-0.2.8.tgz#21a907684723bbbaa5f0974cf7730bd797eb8e62"
integrity sha512-kym7SodPp8/wloecOpcmSnWJsK7M0E5Wg8UcFA+uO4B9s5d0ywXOEro/8HM9x0rW+TljRzul/14UYz3TleT3ig==

"@fontsource/inconsolata@^5.1.0":
version "5.1.0"
resolved "https://registry.yarnpkg.com/@fontsource/inconsolata/-/inconsolata-5.1.0.tgz#f6a76680173336d02d2ce4009699821a6be239ce"
integrity sha512-vYPdG3R46MhK+99De8e8MMyNad5BAb1oTnHMpojlctZyWJIcin8bKHFPUpQSNRhZ4HQL/+DCW+RTiG2RbnweTw==

"@fontsource/inter@^5.1.0":
version "5.1.0"
resolved "https://registry.yarnpkg.com/@fontsource/inter/-/inter-5.1.0.tgz#ab629b2c662457022d2d6a29854b8dc8ba538c47"
integrity sha512-zKZR3kf1G0noIes1frLfOHP5EXVVm0M7sV/l9f/AaYf+M/DId35FO4LkigWjqWYjTJZGgplhdv4cB+ssvCqr5A==

"@formatjs/[email protected]":
version "2.2.3"
resolved "https://registry.yarnpkg.com/@formatjs/ecma402-abstract/-/ecma402-abstract-2.2.3.tgz#dc5a032e1971c709b32b9ab511fa35504a7d3bc9"
Expand Down

0 comments on commit 3b3f776

Please sign in to comment.