搜尋 Mozilla 技術支援網站

防止技術支援詐騙。我們絕對不會要求您撥打電話或發送簡訊,或是提供個人資訊。請用「回報濫用」功能回報可疑的行為。

了解更多

Firefox using two fonts for Arabic text

  • 2 回覆
  • 0 有這個問題
  • 42 次檢視
  • 最近回覆由 Irfan Latif

more options

In a simple HTML file containing an Arabic / Urdu / Persian phrase: "با نشئہ درویشی در ساز و دمادم زن", Firefox in Linux (Ubuntu, to be more precise) uses the default font (DejaVu Sans) for the whole phrase except for one character (UNICODE: 6C1). Font used for this character is Noto Sans Arabic UI. So the text looks broken due to different fonts.

Please have a look at the attached screenshots for better understanding.

I've tried to search but could not find how exactly Firefox resolves preferences in Font Settings and CSS "font-family" preference to local fonts in Linux. Does this have to do something with "fontconfig"?

How can I make Firefox use only the default font for the whole phrase?

In a simple HTML file containing an Arabic / Urdu / Persian phrase: "با نشئہ درویشی در ساز و دمادم زن", Firefox in Linux (Ubuntu, to be more precise) uses the default font (DejaVu Sans) for the whole phrase except for one character (UNICODE: 6C1). Font used for this character is Noto Sans Arabic UI. So the text looks broken due to different fonts. Please have a look at the attached screenshots for better understanding. I've tried to search but could not find how exactly Firefox resolves preferences in Font Settings and CSS "font-family" preference to local fonts in Linux. Does this have to do something with "fontconfig"? How can I make Firefox use only the default font for the whole phrase?
附加的畫面擷圖

所有回覆 (2)

more options

For reference, the documentation on Fonts used states:

Fonts will be included in this section for one of the following reasons:
  • They are listed in the element’s font-family CSS declaration value.
  • They are applied to the element as part of the browser’s default styling (Times New Roman for most browsers), and no author-defined font has been supplied.
  • They are used by a descendant of the inspected element, for example, when it is a container for other elements which have text content with fonts applied.
  • They are system fallback fonts used when nothing from the font-family CSS declaration has been applied.

So I think it's the "system fallback" behavior we need to customize since there is no "font-family" set.

more options

Ok. So fc-list :charset=6C1 shows that none of the fonts installed on my Ubuntu installation supports the character U+06C1, not even TimesNewRoman and Arial fonts installed with mscorefonts. But those from a Windows installation do support the said code point (and many others).

Interestingly, when the same text is displayed in a text editor or Chrome browser using the "DejaVu Sans" font, the 6C1 letter is still rendered using "Noto Sans Arabic UI" font. But in that case the text is rendered correctly i.e. characters do not break from each other. This is a strange behavior with Firefox only.