Closed Bug 420981 Opened 17 years ago Closed 16 years ago

Helvetica Neue with font-weight:100 does use 'UltraLight' face

Categories

(Core :: Graphics, defect)

x86
macOS
defect
Not set
normal

Tracking

()

VERIFIED FIXED

People

(Reporter: phiw2, Assigned: jtd)

References

Details

(Keywords: fixed1.9.1)

Attachments

(6 files)

Attached file testcase
OS X 10.5.2, IntelMac. Bug 411891 improved the handling of various font-weights for fonts that support it. Helvetica Neue ships with a real ultra light face. For font-weight:100, 'light' is used. Problem only seem to happen on 10.5. According to a correspondent, it works correctly on 10.4.11 (ppc).
Attached image screenshot
For reference, on the right is the preview in FontBook.app
Based on data coming back from NSFontManager, both faces are "200" weight fonts. At startup we set up a font list containing the names of all faces within each font family along with the associated weight and traits, using NSFontManager availableMembersOfFontFamily:. It looks like this api is returning the weight of the Ultra Light face incorrectly: psname: HelveticaNeue-Light, face: Light, apple-weight: 3, css-weight: 2, traits: 01000004 psname: HelveticaNeue-UltraLight, face: UltraLight, apple-weight: 3, css-weight: 2, traits: 01000004 (For list of Apple weight with CSS equivalents, see below) http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/Classes/NSFontManager_Class/Reference/Reference.html#//apple_ref/doc/uid/20000383-CJBCEIEB Using the Apple font tools (ftxdumperfuser) I dumped out the OS/2 tables of both fonts: Ultra Light face: <OS_2Table version="1"> <usWeightClass value="Thin" /> <usWidthClass value="Medium" /> <PANOSE> <weight value="2" /> </PANOSE> </OS_2Table> Light face: <OS_2Table version="1"> <usWeightClass value="Light" /> <usWidthClass value="Medium" /> <PANOSE> <weight value="4" /> </PANOSE> </OS_2Table> So the information in the fonts is correct, I'm not sure how exactly the Apple API is coming up with an Apple weight of 3 instead of 2 for the Ultra Light face. I'm stumped as to how they are calculating these weights, maybe they're just "analyzing" the style name instead of pulling in the OS/2 weight or the Panose weight? Bizarre. With two faces that share the same weight, there's no way via CSS attributes to distinguish between the two. One solution would be to read in the OS/2 table ourselves but that's completely beyond the scope of this bug...
Logged as Apple bug 5781372: 05-Mar-2008 12:23 PM John Daggett: The weight NSFontManager reports via availableMembersOfFontFamily is incorrect for Helvetica Neue Ultra Light face. Firefox uses the NSFontManager availableMembersOfFontFamily: method to determine the faces for a given font family along with their weights and traits. http://mxr.mozilla.org/mozilla/source/gfx/thebes/src/gfxQuartzFontCache.mm#746 In 10.5, the Helvetica Neue font family shipped with an extra Ultra Light face. But the weight returned by availableMembersOfFontFamily is the same as the Light face: family: Helvetica Neue, psname: HelveticaNeue-Light, face: Light, apple-weight: 3, css-weight: 2, traits: 01000004 family: Helvetica Neue, psname: HelveticaNeue-UltraLight, face: UltraLight, apple-weight: 3, css-weight: 2, traits: 01000004 The Apple weight of "3" appears to be incorrect, I think this should be a "2" based on the information contained in the font: Ultra Light face: <OS_2Table version="1"> <usWeightClass value="Thin" /> <usWidthClass value="Medium" /> <PANOSE> <weight value="2" /> </PANOSE> </OS_2Table> Light face: <OS_2Table version="1"> <usWeightClass value="Light" /> <usWidthClass value="Medium" /> <PANOSE> <weight value="4" /> </PANOSE> </OS_2Table> (Dumped using ftxdumperfuser).
Sent question to one of the CoreText folks at Apple. His response was: The assignment of weights and traits is done by CoreText now. We will use Apple metadata if available, otherwise it uses both an analysis of font names, OS/2 table, and various other pieces for other traits. In this particular case I believe the value is being extracted from Apple provided metadata.
Mac OS X does indeed appear to be inferring the weight from the style name in 10.4. Under 10.5 it seems to be using some sort of witch's brew of information. I used DejaVuSans-ExtraLight.ttf and replaced *only* the name table to make two "new" font faces: Bongo-UltraLight.ttf Bongo-Thin.ttf According to the NSFontManager docs, UltraLight should map to an Apple weight of 1 and Thin to a weight of 2. 10.4 < (fontinit) family: Bongo, psname: Bongo-UltraLight, face: UltraLight, apple-weight: 1 10.5 > (fontinit) family: Bongo, psname: Bongo-UltraLight, face: UltraLight, apple-weight: 3 10.4 < (fontinit) family: Bongo, psname: Bongo-Thin, face: Thin, apple-weight: 2 10.5 > (fontinit) family: Bongo, psname: Bongo-Thin, face: Thin, apple-weight: 3 Argh!
Other 10.4 to 10.5 weight differences: 10.4 < #HeadLineA, psname: JCHEadA, face: Regular, apple-weight: 5 10.5 > #HeadLineA, psname: JCHEadA, face: Regular, apple-weight: 11 10.4 < Arial Black, psname: Arial-Black, face: Regular, apple-weight: 12 10.5 > Arial Black, psname: Arial-Black, face: Regular, apple-weight: 11 10.4 < Bookman Old Style, psname: BookmanOldStyle, face: Regular, apple-weight: 4 10.5 > Bookman Old Style, psname: BookmanOldStyle, face: Regular, apple-weight: 5 10.4 < Century Schoolbook, psname: CenturySchoolbook, face: Regular, apple-weight: 4 10.5 > Century Schoolbook, psname: CenturySchoolbook, face: Regular, apple-weight: 5 10.4 < Charcoal CY, psname: CharcoalCY, face: Regular, apple-weight: 5 10.5 > Charcoal CY, psname: CharcoalCY, face: Regular, apple-weight: 9 10.4 < Cooper Black, psname: CooperBlackMS, face: Regular, apple-weight: 12 10.5 > Cooper Black, psname: CooperBlackMS, face: Regular, apple-weight: 11 10.4 < Copperplate Gothic Light, psname: CopperplateGothic-Light, face: Regular, apple-weight: 3 10.5 > Copperplate Gothic Light, psname: CopperplateGothic-Light, face: Regular, apple-weight: 5 10.4 < DFPKyoKaSho-W3, psname: DFKyoKaSho-W3-MP-RKSJ-H, face: Regular, apple-weight: 4 10.5 > DFPKyoKaSho-W3, psname: DFKyoKaSho-W3-MP-RKSJ-H, face: Regular, apple-weight: 5 10.4 < DFPSNGyoSho-W5, psname: DFSNGyoSho-W5-MP-RKSJ-H, face: Regular, apple-weight: 6 10.5 > DFPSNGyoSho-W5, psname: DFSNGyoSho-W5-MP-RKSJ-H, face: Regular, apple-weight: 5 10.4 < DFPSoKing-W3, psname: DFSoKing-W3-MP-RKSJ-H, face: Regular, apple-weight: 4 10.5 > DFPSoKing-W3, psname: DFSoKing-W3-MP-RKSJ-H, face: Regular, apple-weight: 5 10.4 < Futura, psname: Futura-CondensedExtraBold, face: Condensed ExtraBold, apple-weight: 10 10.5 > Futura, psname: Futura-CondensedExtraBold, face: Condensed ExtraBold, apple-weight: 11 10.4 < Futura, psname: Futura-CondensedMedium, face: Condensed Medium, apple-weight: 6 10.5 > Futura, psname: Futura-CondensedMedium, face: Condensed Medium, apple-weight: 5 10.4 < Futura, psname: Futura-MediumItalic, face: Medium Italic, apple-weight: 6 10.5 > Futura, psname: Futura-MediumItalic, face: Medium Italic, apple-weight: 5 10.4 < Garth Graphic, psname: GarthGraphic-Black, face: Black, apple-weight: 12 10.5 > Garth Graphic, psname: GarthGraphic-Black, face: Black, apple-weight: 11 10.4 < Gill Sans Ultra Bold, psname: GillSans-UltraBold, face: Regular, apple-weight: 12 10.5 > Gill Sans Ultra Bold, psname: GillSans-UltraBold, face: Regular, apple-weight: 11 10.4 < Helvetica Neue, psname: HelveticaNeue-CondensedBlack, face: Condensed Black, apple-weight: 12 10.5 > Helvetica Neue, psname: HelveticaNeue-CondensedBlack, face: Condensed Black, apple-weight: 11 10.4 < Helvetica Neue, psname: HelveticaNeue-UltraLight, face: UltraLight, apple-weight: 1 10.5 > Helvetica Neue, psname: HelveticaNeue-UltraLight, face: UltraLight, apple-weight: 3 10.4 < Helvetica Neue, psname: HelveticaNeue-UltraLightItalic, face: UltraLight Italic, apple-weight: 1 10.5 > Helvetica Neue, psname: HelveticaNeue-UltraLightItalic, face: UltraLight Italic, apple-weight: 3 10.4 < Hoefler Text, psname: HoeflerText-Black, face: Black, apple-weight: 12 10.5 > Hoefler Text, psname: HoeflerText-Black, face: Black, apple-weight: 9 10.4 < Hoefler Text, psname: HoeflerText-BlackItalic, face: Black Italic, apple-weight: 12 10.5 > Hoefler Text, psname: HoeflerText-BlackItalic, face: Black Italic, apple-weight: 9 10.4 < Hoefler Text, psname: HoeflerText-Ornaments, face: Ornaments, apple-weight: 14 10.5 > Hoefler Text, psname: HoeflerText-Ornaments, face: Ornaments, apple-weight: 5 10.4 < Khmer OS Muol Light, psname: KhmerOSMuolLight, face: Regular, apple-weight: 3 10.5 > Khmer OS Muol Light, psname: KhmerOSMuolLight, face: Regular, apple-weight: 5 10.4 < Kozuka Gothic Pro, psname: KozGoPro-Medium, face: M, apple-weight: 6 10.5 > Kozuka Gothic Pro, psname: KozGoPro-Medium, face: M, apple-weight: 7 10.4 < Krungthep, psname: Krungthep, face: Regular, apple-weight: 5 10.5 > Krungthep, psname: Krungthep, face: Regular, apple-weight: 9 10.4 < KufiStandardGK, psname: KufiStandardGK, face: Regular, apple-weight: 5 10.5 > KufiStandardGK, psname: KufiStandardGK, face: Regular, apple-weight: 9 10.4 < Lucida Blackletter, psname: LucidaBlackletter, face: Regular, apple-weight: 12 10.5 > Lucida Blackletter, psname: LucidaBlackletter, face: Regular, apple-weight: 11 10.4 < Marker Felt, psname: MarkerFelt-Thin, face: Thin, apple-weight: 2 10.5 > Marker Felt, psname: MarkerFelt-Thin, face: Thin, apple-weight: 5 10.4 < Marker Felt, psname: MarkerFelt-Wide, face: Wide, apple-weight: 5 10.5 > Marker Felt, psname: MarkerFelt-Wide, face: Wide, apple-weight: 9 10.4 < Optima, psname: Optima-ExtraBlack, face: ExtraBlack, apple-weight: 14 10.5 > Optima, psname: Optima-ExtraBlack, face: ExtraBlack, apple-weight: 11 10.4 < Perpetua Titling MT, psname: PerpetuaTitlingMT-Bold, face: Bold, apple-weight: 5 10.5 > Perpetua Titling MT, psname: PerpetuaTitlingMT-Light, face: Light, apple-weight: 3 10.4 < Perpetua Titling MT, psname: PerpetuaTitlingMT-Light, face: Light, apple-weight: 5 10.5 > Perpetua Titling MT, psname: PerpetuaTitlingMT-Bold, face: Bold, apple-weight: 9 10.4 < RotisSemiSans, psname: RotisSemiSans-Bold, face: Rotis SemiSans Bold 65, apple-weight: 9 10.5 > RotisSemiSans, psname: RotisSemiSans-Bold, face: Rotis SemiSans Bold 65, apple-weight: 8 10.4 < RotisSemiSerif, psname: RotisSemiSerif-Bold, face: Rotis SemiSerif Bold 65, apple-weight: 9 10.5 > RotisSemiSerif, psname: RotisSemiSerif-Bold, face: Rotis SemiSerif Bold 65, apple-weight: 8 10.4 < STHeiti, psname: STHeiti, face: Regular, apple-weight: 5 10.5 > STHeiti, psname: STHeiti, face: Regular, apple-weight: 7 10.4 < Serpentine, psname: Serpentine-MediumOblique, face: Medium Oblique, apple-weight: 6 10.5 > Serpentine, psname: Serpentine-MediumOblique, face: Medium Oblique, apple-weight: 7 10.4 < Silom, psname: Silom, face: Regular, apple-weight: 5 10.5 > Silom, psname: Silom, face: Regular, apple-weight: 9
Commands for creating "new" faces using Apple font tools: Given a font to copy, in this case DejaVuSans-ExtraLight.ttf. cp DejaVuSans-ExtraLight.ttf Bongo-Thin.ttf # dump out the name table ==> output in DejaVuSans-ExtraLight.name.xml ftxdumperfuser -t name -A d -S Bongo-Thin.ttf mv DejaVu_Sans_ExtraLight.name.xml Bongo-Thin.name.xml # ... edit the name table XML file and change DejaVu Sans ==> Bongo and ExtraLight ==> Thin ... # ... check to make sure the Postscript name has is correct and has no spaces ... # remove the old name table ftxdumperfuser -t name -k Bongo-Thin.ttf # add in the new, edited version ftxdumperfuser -t name -d Bongo-Thin.name.xml Bongo-Thin.ttf # verify the new font's name table ftxdumperfuser -t name Bongo-Thin.ttf
Latest Webkit builds (testing @r31623) now supports multiple weights. Apparently they included a fix/workaround(?) for the font-weight:100 with Helvetica Neue problem, as it displays correctly. Hmm, but they display font-weight:200 using 'UltraLight'; I'd expect 'Light'. http://bugs.webkit.org/show_bug.cgi?id=6484 http://trac.webkit.org/projects/webkit/changeset/31620
I experimented today with Helvetica Neue today. The problem occurs with the lighter faces in this family, Cocoa API's classify these two faces as having the same weight: Helvetica Neue UltraLight OS/2 usWeightClass = 100 Helvetica Neue Light OS/2 usWeightClass = 300 HelveticaNeue-Light, face: Light, apple-weight: 3, css-weight: 2 HelveticaNeue-UltraLight, face: UltraLight, apple-weight: 3, css-weight: 2 I hacked in some code to use CoreText to report the weights of each face, but it reports the same weights for these two faces: HelveticaNeue-Light [2] NSCTFontWeightTrait -0.400000 HelveticaNeue-UltraLight [2] NSCTFontWeightTrait -0.400000 I pulled apart the dfont with fondu and decompiled the fonts with ttx, then started experimenting: 1. Change Helvetica to Helvetican 2. Change Helvetica to Helvetican, change all instances of 'UltraLight' to 'Wistful' (i.e. only name table changes) 3. Change Helvetica to Helvetican, change all instances of 'UltraLight' to 'Wistfultoo' and change the usWeightClass value in the OS/2 table from 100 to 200 CoreText reports: HelveticanNeue-UltraLight [2] NSCTFontWeightTrait -0.400000 HelveticanNeue-Wistful [2] NSCTFontWeightTrait -0.800000 HelveticanNeue-Wistfultoo [2] NSCTFontWeightTrait -0.500000 Cocoa reports HelveticanNeue-UltraLight, face: UltraLight, apple-weight: 3, css-weight: 2 HelveticanNeue-Wistful, face: Wistful, apple-weight: 2, css-weight: 1 HelveticanNeue-Wistfultoo, face: Wistfultoo, apple-weight: 3, css-weight: 2 So it appears Apple is evaluating the style name to establish the weight: if (stylename is known) use weight from lookup table else use OS/2 table weight I think with a little experimentation, I should be able to come up with a workaround that unmaps problematic weight mappings without adding to startup time. Normally I wouldn't bother but Helvetica Neue is one of the few fonts with a full set of faces so folks tend to want to use it for stylistic purposes.
Assignee: nobody → jdaggett
Would it make sense to simply use the OS/2 table weight directly, and bypass the Apple layer here, or is that known to be frequently unreliable? (I'm interested in unifying the font family/style handling across platforms anyway, as we're weak on this on the non-Mac ones. It'd be nice to have the same behavior on all platforms for a given font family.)
I think that would be a simple solution to this problem. For most font families this would be overkill and reading in font tables would affect startup time. Instead I think it would make sense to only do this for families containing light and/or heavy faces, these seem to be the only families affected by this. There are only a handful of these, so the impact of doing this would be minimal.
Summary: Helvetica Neue with font-weith:100 does use 'UltraLight' face → Helvetica Neue with font-width:100 does use 'UltraLight' face
It looks like using OS/2 table weights isn't going to work. Since it's technically not "required" under Mac OS X, font vendors seem to not always put the correct weight in the OS/2 table. Attached is a list of differences between the Apple-determined weight value and the usWeightClass value in the OS/2 table. Quite a few fonts seem to have values that aren't correct (i.e. bold fonts with OS/2 weights of 400). So I think the simplest thing would be to force weights for "UltraLight" faces to be one notch lower on 10.5. Not pretty but that will make things work until Apple decides to fix this.
Uses existing NSFontManager API, NSFontManager weightOfFont API, CoreText trait values, and the usWeightClass value in the OS/2 table.
Simple workaround, explicitly set "ultra light" faces to weight = 100 on 10.5. If Apple fixes the bug, the code will automatically fall through, using the AppKit-specified weight. With default fonts, this only affects the Helvetica Neue family, UltraLight faces are fairly rare to begin with.
Attachment #362535 - Flags: review?(vladimir)
Comment on attachment 362535 [details] [diff] [review] patch, v.0.1, adjust ultra light faces on 10.5 Yep, that looks good
Attachment #362535 - Flags: review?(vladimir) → review+
Status: NEW → RESOLVED
Closed: 16 years ago
Resolution: --- → FIXED
Thank you. Helvetica Neue now works correctly, including the italics issues from bug 478179. Verified with Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.2a1pre) Gecko/20090223 Minefield/3.2a1pre Can this go in 1.9.1 ?
Status: RESOLVED → VERIFIED
Comment on attachment 362535 [details] [diff] [review] patch, v.0.1, adjust ultra light faces on 10.5 Low impact fix, additional testcases included
Attachment #362535 - Flags: approval1.9.1?
Comment on attachment 362535 [details] [diff] [review] patch, v.0.1, adjust ultra light faces on 10.5 a191=beltzner
Attachment #362535 - Flags: approval1.9.1? → approval1.9.1+
Summary: Helvetica Neue with font-width:100 does use 'UltraLight' face → Helvetica Neue with font-weight:100 does use 'UltraLight' face
This work in Windows?
(In reply to Hugo Sena Ribeiro from comment #22) > This work in Windows? This is a Mac fix, not Windows. Windows GDI limits the size of font families, DirectWrite allows larger families so with Windows 7 this is possible but not with Windows XP.
Thanks In this case, you recommend-me open another bug? "Font weight of Univers 45 appears to be too heavy" is the only bug that I found for Windows. https://bugzilla.mozilla.org/show_bug.cgi?id=698369
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: