Skip to content

feat: add Vazirmatn fallback font for Arabic/Persian#2841

Open
ammahmoudi wants to merge 1 commit intocinnyapp:devfrom
ammahmoudi:add/vazirmatn-font-fallback
Open

feat: add Vazirmatn fallback font for Arabic/Persian#2841
ammahmoudi wants to merge 1 commit intocinnyapp:devfrom
ammahmoudi:add/vazirmatn-font-fallback

Conversation

@ammahmoudi
Copy link
Copy Markdown

Bundles Vazirmatn (WOFF2) in public/font/vazirmatn/ to avoid runtime external font requests.
Adds @font-face with Arabic unicode ranges and includes OFL.txt.
Updates the global font stack to use Vazirmatn as a fallback after Inter, so Arabic/Persian text renders more cleanly without changing the UI font for everyone.

@@ -0,0 +1,93 @@
Copyright 2015 The Vazirmatn Project Authors (https://github.com/rastikerdar/vazirmatn)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, what is the issue you are having?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi! The current default font doesn't render Persian and Arabic characters optimally, which affects legibility. Adding Vazirmatn as a fallback significantly improves readability and typographic balance for native readers, providing a much better user experience for these languages. Vazirmatn is common in apps with nice support for rtl users.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Collaborator

@kfiven kfiven Apr 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thoughts on https://fonts.google.com/noto ?

I myself is multilingual and looking at noto, they support wide variety of languages, which would be better approach rather than adding font for each language.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thoughts on https://fonts.google.com/noto ?

I myself is multilingual and looking at noto, they support wide variety of languages, which would be better approach rather than adding font for each language.

While it is true that noto fonts provide broad multilingual coverage, Vazirmatn is specifically optimized for Persian and other RTL languages. It is widely used in RTL contexts and is currently the default Persian font in X, reflecting its strong adoption.

@dembim
Copy link
Copy Markdown

dembim commented Mar 27, 2026

In general, I don't think adding a new fallback font for every script that renders incorrectly (which is most of them at the moment, as far as I can tell) is a scalable solution. A more broadly suitable approach is to allow in-client configuration of fonts, including system-provided fonts, so that rendering concerns for non-latin scripts can be handled on an individual basis. See the above-linked issue on adding such support.

@ammahmoudi ammahmoudi force-pushed the add/vazirmatn-font-fallback branch from 3bf8fa2 to 0fa0593 Compare March 28, 2026 15:08
@ammahmoudi
Copy link
Copy Markdown
Author

In general, I don't think adding a new fallback font for every script that renders incorrectly (which is most of them at the moment, as far as I can tell) is a scalable solution. A more broadly suitable approach is to allow in-client configuration of fonts, including system-provided fonts, so that rendering concerns for non-latin scripts can be handled on an individual basis. See the above-linked issue on adding such support.

I agree that user-configurable fonts (#2619) is valuable, but it doesn’t fully solve this problem in practice for Arabic/Persian:

  • Many users (especially on mobile) can’t realistically install additional system fonts, so “pick a system font” often won’t include something like Vazirmatn.
  • A lot of real usage is mixed English + Persian/Arabic. A good fallback stack is the common approach in chat apps (Telegram-style), because it preserves the Latin UI typography while improving Arabic-script readability.
  • This PR is intentionally narrow: it adds a single Arabic-script fallback via unicode-range, so it doesn’t change Latin UI rendering and doesn’t attempt to add “a font per script”.

If maintainers still prefer “config-only”, I understand. But I think a targeted Arabic-script fallback is a practical baseline improvement for a large user group, while font configuration can remain an additional power-user feature.

Copy link
Copy Markdown

@Behzad9 Behzad9 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this feature would significantly improve readability and typographic balance for RTL users.

Copy link
Copy Markdown

@Alen21137 Alen21137 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have also requested this feature in several other places, and it could be very beneficial for all Persian/Arabic users.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants