NEW 6530
Fixed-pitch font detection doesn't work for many fonts
https://bugs.webkit.org/show_bug.cgi?id=6530
Summary Fixed-pitch font detection doesn't work for many fonts
Alexey Proskuryakov
Reported 2006-01-14 04:37:30 PST
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).
Attachments
test app listing what AppKit thinks about fixed-pitch fonts (5.94 KB, application/zip)
2006-01-14 04:47 PST, Alexey Proskuryakov
no flags
test case (504 bytes, text/html)
2006-01-14 04:50 PST, Alexey Proskuryakov
no flags
proposed patch (3.18 KB, patch)
2006-01-14 04:52 PST, Alexey Proskuryakov
darin: review-
STP169 differs from Other browsers (215.60 KB, image/png)
2023-05-05 13:01 PDT, Ahmad Saleem
no flags
Alexey Proskuryakov
Comment 1 2006-01-14 04:47:41 PST
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).
Alexey Proskuryakov
Comment 2 2006-01-14 04:50:00 PST
Created attachment 5663 [details] test case
Alexey Proskuryakov
Comment 3 2006-01-14 04:52:15 PST
Created attachment 5664 [details] proposed patch
Alexey Proskuryakov
Comment 4 2006-01-14 04:55:15 PST
The patch itself doesn't depend on bug 6529, but the test case does.
Darin Adler
Comment 5 2006-01-21 10:57:06 PST
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?
Ahmad Saleem
Comment 6 2023-05-05 13:01:29 PDT
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).
Ahmad Saleem
Comment 7 2023-12-22 17:30:39 PST
Test Case requires 'Ahem' font and using test case in Minibrowser, it matches with other browsers.
Note You need to log in before you can comment on or make changes to this bug.