Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Typography: only use GT Super on supported languages #362

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 7 additions & 0 deletions .changeset/tough-cameras-grab.md
@@ -0,0 +1,7 @@
---
"@cambly/syntax-design-tokens": minor
"@cambly/syntax-core": minor
"@cambly/syntax-floating-components": minor
---

Typography: only use GT Super on supported languages
50 changes: 42 additions & 8 deletions packages/syntax-core/src/Typography/Typography.module.css
Expand Up @@ -8,28 +8,62 @@
font-style: normal;
font-weight: 510;
src: local("GT-Super-Text-Medium"),
url("https://static.cambly.com/fonts/gt-super-medium.woff2");
font-display: optional;
url("https://static.cambly.com/fonts/gt-super-text-medium-converted.woff2");
}

@font-face {
font-family: "GT Super";
font-style: normal;
font-weight: 700;
src: local("GT-Super-Text-Bold"),
url("https://static.cambly.com/fonts/gt-super-bold.woff2");
font-display: optional;
url("https://static.cambly.com/fonts/gt-super-text-bold-converted.woff2");
}

.sansSerif {
font-family: -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", Roboto,
Helvetica, Arial, sans-serif;
font-family: var(--syntax-font-sans-serif);
margin: 0;
}

.serif {
font-family: "GT Super", -apple-system, system-ui, BlinkMacSystemFont,
"Segoe UI", Roboto, Helvetica, Arial, serif;
font-family: var(
--syntax-font-sans-serif
); /* Intentional, the default is still to use sans-serif, we only use serif for certain languages */
}

/* GT Super only supports certain languages: https://www.grillitype.com/typeface/gt-super */

/* List of languages we use on Cambly and their support for GT Super

* English: ✅
* Arabic: ❌
* Azerbaijani: ✅
* German: ✅
* Spanish: ✅
* French: ✅
* Italian: ✅
* Japanese: ❌
* Korean: ❌
* Polish: ✅
* Portuguese: ✅
* Russian: ❌
* Thai: ❌
* Turkish: ✅
* Vietnamese: ❌
* Simplified Chinese: ❌
* Traditional Chinese: ❌
*/

/* stylelint-disable-next-line selector-max-compound-selectors -- only render serif font for certain languages */
:lang(en) .serif,
:lang(az) .serif,
:lang(fr) .serif,
:lang(de) .serif,
:lang(es) .serif,
:lang(it) .serif,
:lang(pl) .serif,
:lang(pt) .serif,
:lang(tr) .serif {
font-family: "GT Super", var(--syntax-font-sans-serif);
-webkit-font-smoothing: antialiased;
}

Expand Down
39 changes: 39 additions & 0 deletions packages/syntax-core/src/Typography/Typography.stories.tsx
@@ -1,5 +1,6 @@
import { type StoryObj, type Meta } from "@storybook/react";
import Typography from "./Typography";
import Box from "../Box/Box";

export default {
title: "Components/Typography",
Expand Down Expand Up @@ -162,6 +163,44 @@ export const colors: StoryObj<typeof Typography> = {
),
};

function SerifCharacterSupportExample() {
return (
<Box display="flex" gap={3} direction="column">
<Typography size={200} fontStyle="serif">
English: à, é, ñ
</Typography>
<Typography size={200} fontStyle="serif">
Azerbaijani: ə, ı, ş, ü
</Typography>
<Typography size={200} fontStyle="serif">
French: à, â, é, è, ê, ë, î, ï, ô, ö, ù, û, ü, ÿ, ç
</Typography>
<Typography size={200} fontStyle="serif">
German: ä, ö, ü, ß
</Typography>
<Typography size={200} fontStyle="serif">
Spanish: á, é, í, ó, ú, ü, ñ
</Typography>
<Typography size={200} fontStyle="serif">
Italian: à, è, é, ì, ò, ó, ù
</Typography>
<Typography size={200} fontStyle="serif">
Polish: ą, ć, ę, ł, ń, ó, ś, ź, ż
</Typography>
<Typography size={200} fontStyle="serif">
Portuguese: á, â, ã, à, é, ê, í, ó, ô, õ, ú
</Typography>
<Typography size={200} fontStyle="serif">
Turkish: ç, ğ, ı, ö, ş, ü
</Typography>
</Box>
);
}

export const SerifCharacterSupport: StoryObj<typeof Typography> = {
render: () => <SerifCharacterSupportExample />,
};

export const Inline: StoryObj<typeof Typography> = {
render: (args) => (
<>
Expand Down
9 changes: 9 additions & 0 deletions packages/syntax-design-tokens/tokens/font/base.json
@@ -0,0 +1,9 @@
{
"syntax": {
"font": {
"sans-serif": {
"value": "-apple-system, system-ui, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif"
}
}
}
}