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

Add a fixed font for farsi #1168

Merged
merged 3 commits into from
May 29, 2024
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
99 changes: 55 additions & 44 deletions package-lock.json

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

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"@emotion/babel-plugin": "^11.11.0",
"@emotion/react": "^11.11.3",
"@fontsource-variable/roboto-flex": "^5.0.8",
"@fontsource-variable/vazirmatn": "^5.0.20",
"@iarna/toml": "^2.2.5",
"@opencast/appkit": "^0.2.4",
"@svgr/webpack": "^8.1.0",
Expand Down
2 changes: 1 addition & 1 deletion src/ui/global-style.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const GLOBAL_STYLE = css({
// // as well as `<progress>` elements.
// accentColor: COLORS.primary0,

fontFamily: "'Roboto Flex Variable', sans-serif",
fontFamily: "'Roboto Flex Variable', 'Vazirmatn Variable', sans-serif",
fontWeight: 400,

// A reset to a sensible value.
Expand Down
12 changes: 7 additions & 5 deletions webpack.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,9 @@ const config: CallableOption = (_env, argv) => ({

// Copy the font related files to output directory
{
from: path.join(__dirname, "node_modules/@fontsource-variable/roboto-flex/index.css"),
to: path.join(OUT_PATH, "font.css"),
transform: (input: Buffer) => {
return input.toString().replace(/url\(.\/files\//g, "url(./fonts/");
},
from: path.join(__dirname, "node_modules/@fontsource-variable/@(roboto-flex|vazirmatn)/index.css"),
to: "font.css",
transformAll: assets => assets.map(assets => assets.data).join("\n").replace(/url\(.\/files\//g, "url(./fonts/"),
},
...(
[
Expand All @@ -102,6 +100,10 @@ const config: CallableOption = (_env, argv) => ({
to: path.join(OUT_PATH, "fonts", font),
}))
),
{
from: path.join(__dirname, "node_modules/@fontsource-variable/vazirmatn/files/vazirmatn-arabic-wght-normal.woff2"),
to: path.join(OUT_PATH, "fonts", "vazirmatn-arabic-wght-normal.woff2"),
},
],
}),
],
Expand Down
Loading