Skip to content

Commit

Permalink
fix(website): prevent font substitution with tofu symbol (#911)
Browse files Browse the repository at this point in the history
* fix(website): prevent font substitution with tofu symbol

* fix: material icons don't support spaces which triggers tofu

* fix: make all symbols spaceless for consistency
  • Loading branch information
ayuhito committed Dec 10, 2023
1 parent fb960b4 commit 4a8fcfc
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 4 deletions.
7 changes: 7 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion website/app/components/preview/TextArea.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ const TextBox = ({ family, weight, loaded }: TextBoxProps) => {
variant="unstyled"
styles={{
input: {
fontFamily: `"${family}"`,
fontFamily: `"${family}", "Fallback Outline"`,
fontWeight: weight,
fontSize: state.size,
color: state.color,
Expand Down
5 changes: 4 additions & 1 deletion website/app/components/search/Hits.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,10 @@ const HitComponent = ({ hit, fontSize }: HitComponentProps) => {
href={`https://cdn.jsdelivr.net/fontsource/css/${hit.objectID}@latest/index.css`}
/>
<Skeleton visible={!isFontLoaded}>
<Text fz={fontSize} style={{ fontFamily: `"${hit.family}"` }}>
<Text
fz={fontSize}
style={{ fontFamily: `"${hit.family}", "Fallback Outline"` }}
>
{currentPreview}
</Text>
</Skeleton>
Expand Down
1 change: 1 addition & 0 deletions website/app/root.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import '@fontsource-variable/inter/wght.css';
import '@fontsource-variable/source-code-pro/wght.css';
import 'fallback-font/fallback-outline.css';
import '@mantine/core/styles.css';
import './styles/global.css';

Expand Down
4 changes: 2 additions & 2 deletions website/app/utils/language/language.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ export const getPreviewText = (subset: string, id?: string) => {
case 'material-icons-round':
case 'material-icons-sharp':
case 'material-icons-two-tone': {
return 'photo_camera thumb_up assignment create_new_folder insert_invitation drafts credit_card timer check_box close';
return 'photo_camerathumb_upassignmentcreate_new_folderinsert_invitationdraftscredit_cardtimercheck_boxclose';
}

case 'material-symbols-outlined':
case 'material-symbols-rounded':
case 'material-symbols-sharp': {
return 'search settings home person add shopping_cart favorite';
return 'searchsettingshomepersonaddshopping_cartcheck_circlefavoritelogouttrophy';
}

case 'yakuhanjp':
Expand Down
1 change: 1 addition & 0 deletions website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"algoliasearch": "^4.20.0",
"clsx": "^2.0.0",
"esbuild": "^0.19.8",
"fallback-font": "^1.0.1",
"instantsearch.js": "^4.62.0",
"isbot": "^3.7.1",
"ky": "^1.1.3",
Expand Down

0 comments on commit 4a8fcfc

Please sign in to comment.