Can I use a font for English text, and another font for Arabic/Persian text?

1.4k Views Asked by At

Since there's no free font which supports both scripts, I need to use different fonts for different scripts. Is there any setting to differentiate English and non-English texts?

3

There are 3 best solutions below

0
alijsh On BEST ANSWER

There's actually a "free" monospaced font that includes both Persian/Arabic and Latin scripts. Meet Vazir Code

2
RoelN On

If this is for a web project, you can just put both fonts in your font stack:

font-family: EnglishFont, ArabicPersianFont, sans-serif;

When an Arabic character is not present in the English font, your browser will move on to the next font, in this case your Arabic/Persian font.

If your English font does contain (some) Arabic characters, the browser will use those. If this is undesired, you can either subset the font to contain only Latin characters, or you can use a Unicode range in your @font-face declaration to tell it to only use it for Latin characters. It will then move on to the next font for Arabic characters, even if they're in your English font:

@font-face {
  font-family: EnglishFont;
  src: url('...');
  unicode-range: U+0020-024F; /* Only Latin */
}
1
Saeed RayatMoghadam On

in Setting.json , in "Editor.fontFamily" just add fonts that you want

for example if you want a font for English and another one for persian you go like this :

"Editor.fontFamily" : "EnglishFont, PersianFont"