-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
apac, seekBusiness: Use
strong
weight instead of medium
for Thai …
…characters (#1331)
- Loading branch information
1 parent
7d06741
commit 12d8d72
Showing
7 changed files
with
50 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
--- | ||
'braid-design-system': patch | ||
--- | ||
**apac, seekBusiness:** Use `strong` weight instead of `medium` for Thai characters | ||
|
||
The unicode range of Thai characters is not satisfied by the preferred fonts specified for the `apac` theme, resulting in these characters falling through and being rendered by `sans-serif` — which applies a platform-specific font. | ||
On Mac this is `Thonburi`, on Windows it is `Tahoma`, neither of which have support for the semi-bold weight chosen for `medium`. | ||
The result is the visual weight of `medium` text being rounded down to `regular`, and hence having no differentiation against standard text in the UI. | ||
|
||
To work around this, we are creating a font alias that coerces the semi-bold weight to the bold weight of the previously mentioned platform-specific Thai fonts. | ||
|
||
This is only applied for themes that inherit the `apac` typography definition (currently `apac` and `seekBusiness`), and will only affect characters that fall through, i.e., characters that are unsatisfied by the preferred fonts in the specified `font-family`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
packages/braid-design-system/src/lib/themes/baseTokens/mediumWeightPatch.css.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { globalFontFace } from '@vanilla-extract/css'; | ||
import { semiBoldWeight, thaiPatchFamilyName } from './mediumWeightPatch'; | ||
|
||
/* | ||
This patch is designed to coerce the semi-bold font weight | ||
to bold for fonts that do not handle weights between regular | ||
and bold. | ||
This is relevant for Thai character ranges, which are not | ||
available in the `apac` font stack, so we map the semi-bold | ||
weight to the bold sans-serif system font — Thonburi on Mac, | ||
Tahoma on Windows. | ||
*/ | ||
|
||
globalFontFace(thaiPatchFamilyName, { | ||
fontWeight: semiBoldWeight, | ||
src: "local('Thonburi Bold'), local('Tahoma Bold')", | ||
unicodeRange: 'U+0E01-0E5B, U+200C-200D, U+25CC', | ||
}); | ||
|
||
globalFontFace(thaiPatchFamilyName, { | ||
src: "local('Thonburi'), local('Tahoma')", | ||
unicodeRange: 'U+0E01-0E5B, U+200C-200D, U+25CC', | ||
}); |
2 changes: 2 additions & 0 deletions
2
packages/braid-design-system/src/lib/themes/baseTokens/mediumWeightPatch.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export const thaiPatchFamilyName = 'ThaiSemiBoldPatch'; | ||
export const semiBoldWeight = 500; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.