Skip to content

Commit

Permalink
Add a fixed font for farsi (#1168)
Browse files Browse the repository at this point in the history
Adds vazirmatn as a fixed font for farsi as suggested in issue:
#1141
  • Loading branch information
LukasKalbertodt committed May 29, 2024
2 parents 1dc90c0 + 39df31f commit 0fc35f0
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 50 deletions.
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

0 comments on commit 0fc35f0

Please sign in to comment.