keeleysam / tenfourfox

Automatically exported from code.google.com/p/tenfourfox
0 stars 0 forks source link

Font blacklist #171

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
One of the long running issues on Tenderapp is this protracted thread on font 
woes:

http://tenfourfox.tenderapp.com/discussions/problems/2-italic-display

We are now fairly certain that this is due to iffy fonts that CoreText might be 
able to handle, but Harfbuzz definitely can't, and we can't use CoreText for 
text runs in 10.4 (the secret CoreText does not allow sufficiently granular 
glyph positioning).

We can blacklist some fonts to force them to appear in the system fallback, 
which will restore text even if the font is wrong. This is better than "boxing 
out" but the bar for this needs to be quite high as it will essentially prevent 
this font from appearing on _any_ system, even the ones with a non-corrupt 
version.

Original issue reported on code.google.com by classi...@floodgap.com on 18 Jul 2012 at 5:20

GoogleCodeExporter commented 9 years ago
Alternatively, a more optimal solution is to force system fallback when boxes 
appear, but we don't know what this would do if the font were merely 
incomplete. So the blacklist seems "safer."

Original comment by classi...@floodgap.com on 18 Jul 2012 at 5:21

GoogleCodeExporter commented 9 years ago
Arial and Helvetica are reported frequently. In gfxMacPlatformFontList.mm we 
could add to InitFontList():

    while ((availableFamily = [families nextObject])) {

        // make a nsString
        GetStringForNSString(availableFamily, availableFamilyName);

//XXX something like this:
if ((availableFamilyName.Equals("Arial") && PREF_NO_ARIAL) ||
    (availableFamilyName.Equals("Helvetica") && PREF_NO_HELVETICA)) { ; } else {

        // create a family entry
        gfxFontFamily *familyEntry = new gfxMacFontFamily(availableFamilyName);
        if (!familyEntry) break;

        // add the family entry to the hash table
        ToLowerCase(availableFamilyName);
        mFontFamilies.Put(availableFamilyName, familyEntry);

        // check the bad underline blacklist
        if (mBadUnderlineFamilyNames.Contains(availableFamilyName))
            familyEntry->SetBadUnderlineFamily();

} // end

    }

Original comment by classi...@floodgap.com on 19 Sep 2012 at 4:57

GoogleCodeExporter commented 9 years ago
Added this code, along with another blockset for Times, which was also 
reported. Scheduled for 17.

Original comment by classi...@floodgap.com on 24 Sep 2012 at 4:58

GoogleCodeExporter commented 9 years ago
Prefs:

tenfourfox.gfx.badfont.{arial,helvetica,times}

Original comment by classi...@floodgap.com on 27 Sep 2012 at 2:10

GoogleCodeExporter commented 9 years ago
New theory proposed on the ticket is that these are PostScript Type 1 fonts. 
chtrusch demonstrates a good test case.

Since we need ATSUI or CoreText for those, and can use neither, we should just 
remove them from the platform list. The easiest way appears to be to use 
mRequiresAAT, and while enumerating fonts, warn and discard any where 
static_cast<MacOSFontEntry*>(GetFontEntry())->RequiresAATLayout() returns true. 
However, we need to change MacOSFontEntry::ReadCMAP() to not set mRequiresAAT 
for the M614903 situation because we should make every effort to render *any* 
OpenType table if it exists.

Original comment by classi...@floodgap.com on 29 Sep 2012 at 1:16

GoogleCodeExporter commented 9 years ago
That did not work at all. mRequiresAAT is actually set for more fonts than we 
realize, and simply returning a nullptr caused the browser to crash.

The actual issue is if the font is Type 1 PS bitmaps only (i.e., no 'glyf' or 
'CFF ' tables). In ReadCMAP(), we check the font to see if it has either table. 
If it has neither table, it loads a null character map and marks the font as 
having no characters at all. When the browser tries to use this bogus font, no 
characters are available, causing it then to fall back on another font. This 
correctly rejects the bitmap fonts I have on my system.

Original comment by classi...@floodgap.com on 12 Oct 2012 at 5:16

GoogleCodeExporter commented 9 years ago
Shipp'd

Original comment by classi...@floodgap.com on 20 Nov 2012 at 6:11

GoogleCodeExporter commented 9 years ago
Planning a performance improvement on this for 17.0.2 and 19.

Original comment by classi...@floodgap.com on 17 Dec 2012 at 4:50