Bug 35273 - fast/forms/text-control-intrinsic-widths.html fails on Mac if Word/Office fonts are installed
Summary: fast/forms/text-control-intrinsic-widths.html fails on Mac if Word/Office fon...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Tools / Tests (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC OS X 10.5
: P2 Normal
Assignee: Simon Fraser (smfr)
URL:
Keywords:
: 68919 (view as bug list)
Depends on:
Blocks:
 
Reported: 2010-02-22 16:45 PST by Eric Seidel (no email)
Modified: 2015-03-18 23:09 PDT (History)
3 users (show)

See Also:


Attachments
Non-working patch (5.26 KB, patch)
2011-09-27 18:52 PDT, Simon Fraser (smfr)
no flags Details | Formatted Diff | Diff
Patch (16.07 KB, patch)
2011-09-30 12:06 PDT, Simon Fraser (smfr)
mitz: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Eric Seidel (no email) 2010-02-22 16:45:38 PST
fast/forms/text-control-intrinsic-widths.html fails on Mac if Word/Office fonts are installed

Several metrics will be off, including Arial.

The fix is to remove /Library/Fonts/Microsoft/

I think you have to restart the ATSServer to get any application to notice.  (I used sudo killall ATSServer)
Comment 1 Simon Fraser (smfr) 2011-09-27 17:36:06 PDT
*** Bug 68919 has been marked as a duplicate of this bug. ***
Comment 2 Simon Fraser (smfr) 2011-09-27 18:52:55 PDT
Created attachment 108948 [details]
Non-working patch

Attaching some hacking here, but this doesn't work. Apparently there is no way to disable fonts for just one process on Mac.
Comment 3 Simon Fraser (smfr) 2011-09-27 18:53:18 PDT
Maybe the scripts should just tell users to disable the fonts themselves?
Comment 4 mitz 2011-09-27 19:01:37 PDT
WebKit learns of available fonts only through NSFontManager and through AppKit’s and Core Text’s default fallback lists. I think that the latter would never include user-installed fonts, so for the purposes of this bug, I believe that DumpRenderTree can swizzle a handful of NSFontManager methods to filter out undesirable families and fonts.
Comment 5 Simon Fraser (smfr) 2011-09-30 12:06:09 PDT
Created attachment 109321 [details]
Patch
Comment 6 mitz 2011-09-30 12:21:23 PDT
Comment on attachment 109321 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=109321&action=review

> Tools/DumpRenderTree/mac/DumpRenderTree.mm:224
> +static NSSet* allowedFontFamilySet()

The space should go before the star.

> Tools/DumpRenderTree/mac/DumpRenderTree.mm:226
> +    static NSSet* fontFamiliySet = [[NSSet setWithObjects:

Ditto.

> Tools/DumpRenderTree/mac/DumpRenderTree.mm:347
> +

One blank line is enough.

> Tools/DumpRenderTree/mac/DumpRenderTree.mm:372
> +        NSArray* fontsForFamily = [[NSFontManager sharedFontManager] availableMembersOfFontFamily:fontFamily];

The space should go before  the start.

> Tools/DumpRenderTree/mac/DumpRenderTree.mm:373
> +        for (NSArray* fontInfo in fontsForFamily) {

The space should go before the star.

> Tools/WebKitTestRunner/InjectedBundle/mac/InjectedBundleMac.mm:34
> +static NSSet* allowedFontFamilySet()

The space should go before the star.

> Tools/WebKitTestRunner/InjectedBundle/mac/InjectedBundleMac.mm:36
> +    static NSSet* fontFamiliySet = [[NSSet setWithObjects:

Ditto.

> Tools/WebKitTestRunner/InjectedBundle/mac/InjectedBundleMac.mm:157
> +

One blank line is enough.

> Tools/WebKitTestRunner/InjectedBundle/mac/InjectedBundleMac.mm:182
> +        NSArray* fontsForFamily = [[NSFontManager sharedFontManager] availableMembersOfFontFamily:fontFamily];

The space should go before the star.

> Tools/WebKitTestRunner/InjectedBundle/mac/InjectedBundleMac.mm:183
> +        for (NSArray* fontInfo in fontsForFamily) {

Ditto.
Comment 7 Simon Fraser (smfr) 2011-09-30 15:56:43 PDT
http://trac.webkit.org/changeset/96434
Comment 8 Alexey Proskuryakov 2015-03-18 23:09:55 PDT
This wasn't effective at fixing fast/forms/text-control-intrinsic-widths.html as of OS X Yosemite - fonts in /Library/Fonts/Microsoft took precedence over ones in /Library/Fonts.

Additionally, fallback did include /Library/Fonts/Microsoft fonts.

I re-fixed the first issue in bug 142720.