‽ (interrobang) and other chars are incorrectly rendered as italic by font fallback

RESOLVED FIXED

Status

()

Core
Layout: Text
RESOLVED FIXED
7 years ago
2 years ago

People

(Reporter: Zéfling, Assigned: jfkthame)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: [mozfr-community], URL)

Attachments

(6 attachments)

(Reporter)

Description

7 years ago
User-Agent:       Mozilla/5.0 (Windows NT 5.2; WOW64; rv:2.0b6pre) Gecko/20100907 Firefox/4.0b6pre
Build Identifier: Mozilla/5.0 (Windows NT 5.2; WOW64; rv:2.0b6pre) Gecko/20100907 Firefox/4.0b6pre


Left : Fx 4  / Right : Fx 3.6
http://ikilote.net/Galeries/Autres/Divers/Firefox_!Qo.png

Reproducible: Always

Comment 1

7 years ago
The interrobang must have been gotten from a different font (the browser does that when it can't find it in the current font). Firefox 4.0 contains a new font-shaping library (Harfbuzz), something is slightly different from version 3.6.
(Assignee)

Comment 2

7 years ago
The use of harfbuzz shouldn't affect which font is chosen, but you can check this by going to about:config and setting the preference gfx.font_rendering.harfbuzz.level to 0; this will cause the old platform-specific text shaping approach to be used.

I think it's more likely that the difference is due to the move from GDI to DirectWrite font handling on Windows. Try unchecking the "Use hardware acceleration when available" setting (in Options/Advanced), and restart the browser; that could help narrow down the issue.
(Reporter)

Comment 3

7 years ago
Created attachment 481176 [details]
Wikipédia : Unicode/U2000 in Firefox 4.0b7pre

That does not seem to work, I always have the same returning.

I have only problem with only this : ‽ ⁇ ⁈ ⁉ ⁋ 
( http://fr.wikipedia.org/wiki/Table_des_caract%C3%A8res_Unicode/U2000 )
(Assignee)

Comment 4

7 years ago
Very few of the standard Windows fonts support these characters (they're mainly found in some of the large East Asian fonts). As the default font being used for the Wikipedia page doesn't support them, the browser will search for an alternative font - apparently you have a cursive/script-style font that includes them, and that's the first one it is finding.

Comment 5

7 years ago
That's what I said in comment 1. Is Harfbuzz or the hardware acceleration  interfering with this font-selection ?
(Reporter)

Comment 6

7 years ago
Created attachment 481180 [details]
Wikipédia : Unicode/U2000 in Firefox 3.6
(Assignee)

Comment 7

7 years ago
(In reply to comment #5)
> That's what I said in comment 1. Is Harfbuzz or the hardware acceleration 
> interfering with this font-selection ?

I don't know, yet. HarfBuzz shouldn't affect font selection; D2D/DWrite might. That's why I suggested in comment 2 to try disabling these features and see if it affected the result; apparently not.

Célian, can you identify the font that's being used on your system (e.g. by copying the ‽ ⁇ ⁈ ⁉ ⁋ characters into WordPad or another program, and then trying different fonts until you recognize the glyphs)?
(Reporter)

Comment 8

7 years ago
Created attachment 481183 [details]
Test font in OOo Writer

Mmmm, I see.
Firefox 3.6 use « DejaVu » et Firefox 4.0 use « Psycho ».

Is it possible to change the order of use ?
(Assignee)

Comment 9

7 years ago
Hmmm. Notice that it's not just using Psycho, it's using it in italic.

I installed the Psycho fonts here, and I can trigger its use as the fallback font for for interrobang, etc, under certain conditions: (1) HW acceleration is *off*, and (2) the style calls for italic. But it's not happening as universally as you're seeing.

Ah, just noticed that you're on W2003... I think that means HW accel isn't supported for you. To double-check, please go to about:support, scroll down to the Graphics section, and report what it shows for "Direct2D Enabled" and "DirectWrite Enabled".

Still, I don't know why it's picking the italic face of Psycho in situations such as the Wikipedia character table. That looks like it's probably a bug affecting the GDI font backend, but it doesn't happen here on my Win7 system - I have to explicitly use italic-styled text in order to hit the Psycho Italic font.

I'll try WinXP and see what happens there.
(Reporter)

Comment 10

7 years ago
It's WinXP64 (Windows NT 5.2), not Win2003 (Windows NT 5.2).

Direct2D Enabled : false
DirectWrite Enabled : true
GPU Accelerated Windows : 0/1
OS: Windows Server 2003 → Windows XP
(Assignee)

Comment 11

7 years ago
Aha, on XP I see the same problem as you - when font fallback occurs for the interrobang (and related chars), the browser decides to make it italic. And then it finds Psycho Italic, which may well be the *only* italic face installed that actually supports them.

So the real bug here is the inappropriate italicization of the fallbacks; that in turn is causing the unexpected choice of fallback font.
(Assignee)

Updated

7 years ago
Status: UNCONFIRMED → NEW
Component: General → Layout: Text
Ever confirmed: true
Product: Firefox → Core
QA Contact: general → layout.fonts-and-text
Summary: ‽ has a strange rendering in Firefox 4 → ‽ (interrobang) and other chars are incorrectly rendered as italic by font fallback
(Reporter)

Comment 12

7 years ago
Okay, the problem is the reason of another bug.

The fallback font is little strange in Firefox (even with Firefox 3.6). The Asiatic ideographs change sometimes all alone if I add a new font.
(Reporter)

Comment 13

7 years ago
Created attachment 481237 [details]
Wikipédia : Unicode/U2000 in Firefox 3.6 (+ FreeFont)

I added FreeFont and I see a little change in Firefox 3.6, not in Firefox 4.
(Assignee)

Comment 14

7 years ago
Created attachment 481453 [details] [diff] [review]
patch, fix handling of italic style in gfxFontFamily::FindFontForChar

There was code in FindFontForChar to prefer italic faces if the current style is italic, but it didn't take care to do the opposite: prefer non-italic faces if the style is non-italic. So when fallback hit a family where all faces exist and support the char in question, regular and italic faces would be ranked equally, and we'd tend to end up choosing the italic one.

This patch improves the style-matching here, so that the examples no longer pick italic faces. It will not solve the issue that a "weird" family such as Psycho may be found before a "normal" one such as DejaVu, depending what fonts the user has installed and what order they get enumerated.
Assignee: nobody → jfkthame
Attachment #481453 - Flags: review?(jdaggett)

Updated

7 years ago
Attachment #481453 - Flags: review?(jdaggett) → review+
(Assignee)

Comment 15

7 years ago
Comment on attachment 481453 [details] [diff] [review]
patch, fix handling of italic style in gfxFontFamily::FindFontForChar

We should take this before release because it fixes an issue where we incorrectly choose italic fonts (for non-italic elements) during font fallback. This particularly impacts multilingual pages where there may be fragments of text (such as language names in "native" scripts) that are not covered by the fonts in the stylesheet, and so we do a fallback search.

It should be very safe, as it doesn't alter behavior in any way except for deciding which face of a given font family is preferred.
Attachment #481453 - Flags: approval2.0?

Comment 16

7 years ago
I'm guessing we can't really reftest it because it involves font installations which are not present on normal machines?
Attachment #481453 - Flags: approval2.0? → approval2.0+
(Assignee)

Comment 17

7 years ago
Pushed the patch to trunk:
http://hg.mozilla.org/mozilla-central/rev/8545045acca2

(In reply to comment #16)
> I'm guessing we can't really reftest it because it involves font installations
> which are not present on normal machines?

Hmm... we may be able to come up with a test that works using normal font configurations and illustrates the problem, at least on some systems; I'll take a look.
Status: NEW → RESOLVED
Last Resolved: 7 years ago
Resolution: --- → FIXED
(Reporter)

Comment 18

7 years ago
Mmmm, I have no change on my Minefied... Psycho is always used.
(Assignee)

Comment 19

7 years ago
(In reply to comment #18)
> Mmmm, I have no change on my Minefied... Psycho is always used.

Yes, that's expected, I'm afraid; see comment #14. This patch corrected the error where we picked italic faces during fallback font selection, even when the style did not call for italic. It does not help with your problem, which is that font fallback happens to be choosing a font you don't want. The browser first tries to use the fonts specified in the page/css styles; if they don't include the characters needed, it tries to find something else on your system, but if you have a "weird" font installed that happens to support that character, that may be the one it picks.
(Reporter)

Comment 20

7 years ago
Created attachment 493697 [details]
Example render : Wikipedia ⁉ (Fx3.6 & Minefield)

Why Fx 3.6 uses FreeFont and Fx4.0 uses Psycho for “monospace” ?
(Reporter)

Updated

2 years ago
Whiteboard: [mozfr-community]
You need to log in before you can comment on or make changes to this bug.