WebKit uses several hacks to work around problems with NSFixedPitchFontMask, as reported by AppKit (see <rdar://problem/3999467>, <rdar://problem/4032938>). Some of them are no longer needed, but some other fonts are still mishandled (see below).
Created attachment 5662 [details] test app listing what AppKit thinks about fixed-pitch fonts Results on my machine (running 10.4.3): isFixedPitch: Monaco (Monaco) isFixedPitch: MS-Gothic (MS Gothic) isFixedPitch: SimSun (SimSun) Traits: CourierNewPS-ItalicMT (Courier New) isFixedPitch: CourierNewPS-ItalicMT (Courier New) isFixedPitch: Webdings (Webdings) isFixedPitch: Courier (Courier) Traits: Osaka-Mono (Osaka) isFixedPitch: Osaka-Mono (Osaka) Traits: LucidaSans-TypewriterOblique (Lucida Sans Typewriter) isFixedPitch: LucidaSans-TypewriterOblique (Lucida Sans Typewriter) isFixedPitch: MS-PGothic (MS PGothic) Traits: LucidaSans-TypewriterBold (Lucida Sans Typewriter) isFixedPitch: LucidaSans-TypewriterBold (Lucida Sans Typewriter) Traits: CourierNewPS-BoldMT (Courier New) isFixedPitch: CourierNewPS-BoldMT (Courier New) isFixedPitch: MS-PMincho (MS PMincho) isFixedPitch: Courier-Bold (Courier) isFixedPitch: JCsmPC (#PCMyungjo) isFixedPitch: MS-Mincho (MS Mincho) Traits: GB18030Bitmap (GB18030 Bitmap) Traits: CourierNewPS-BoldItalicMT (Courier New) isFixedPitch: CourierNewPS-BoldItalicMT (Courier New) Traits: AndaleMono (Andale Mono) isFixedPitch: AndaleMono (Andale Mono) Traits: CourierNewPSMT (Courier New) isFixedPitch: CourierNewPSMT (Courier New) Traits: LucidaSans-TypewriterBoldOblique (Lucida Sans Typewriter) isFixedPitch: LucidaSans-TypewriterBoldOblique (Lucida Sans Typewriter) Traits: LucidaSans-Typewriter (Lucida Sans Typewriter) isFixedPitch: LucidaSans-Typewriter (Lucida Sans Typewriter) isFixedPitch: PMingLiU (PMingLiU) Traits: Ahem (Ahem) isFixedPitch: Ahem (Ahem) It can be seen that workarounds for Osaka-Mono are no longer needed, as -[NSFont isFixedPitch] and -[NSFontManager traitsOfFont:] are now in accordance. Monaco and Courier are problematic because -[NSFontManager traitsOfFont:] doesn't report them as fixed pitch. OTOH, MS-PGothic is one of several Asian font that are reported as fixed-pitch, while they shouldn't be (MS-Gothic, MS-Mincho, MS-PMincho, #PCMyungjo, PMingLiU, SimSun aren't handled in WebKit).
Created attachment 5663 [details] test case
Created attachment 5664 [details] proposed patch
The patch itself doesn't depend on bug 6529, but the test case does.
Comment on attachment 5664 [details] proposed patch Adding more special cases for fonts that are incorrectly reported as fixed pitch is fine. But I do want each of the fonts that behave wrong in this respect reported to the AppKit team in a bugreport.apple.com bug report (not necessarily a separate one for each font family). I don't think it's good to remove the list of bug numbers and fonts that were mentioned in those bugs from the code. We could convert it to a more-terse format, but I want to keep a connecton between special case family names and the bug reports mentioning the need for them. I'm not sure that the NSFixedPitchFontMask in the traits should be identical to the results of isFontFixedPitch: -- since the former is used for selecting fonts, and the latter is used to ensure that glyph widths all match it's not clear to me that they need to be in sync. But perhaps there's concrete reason why it's important to have both contain the exception list. Can you explain why?
Created attachment 466228 [details] STP169 differs from Other browsers I tried the attached testcase on STP169 and got this result across multiple browsers. If I am reproducing this wrong or this is something Safari is doing correctly and others wrong, please highlight. (Good for my learning as well).
Test Case requires 'Ahem' font and using test case in Minibrowser, it matches with other browsers.