Closed Bug 226981 Opened 23 years ago Closed 19 years ago

font-weight in the span tag or css not treated properly by mozilla on OS/2

Categories

(Core Graveyard :: GFX: OS/2, defect)

All
OS/2
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: grajaman, Assigned: grajaman)

References

()

Details

Attachments

(3 files, 2 obsolete files)

User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.6b) Gecko/20031114 Firebird/0.7+ Build Identifier: Mozilla/5.0 (OS/2; U; Warp 4.5; en-US; rv:1.6a) Gecko/20031111 The font-weight attribute specified in the span tag or the css is not treated well in mozilla on OS/2. Reproducible: Always Steps to Reproduce: 1. Load fonttest.html 2. 3. Actual Results: Observe the font-weights (700,900) look same. Expected Results: 900 should have been bolder than 700.
Attached file Testcase —
OS: other → OS/2
Attached patch Patch (obsolete) — — Splinter Review
In the nsFontmetricsOS2::loadfonts(..) method I look for the font with the specific weight. If it is there I select that, else I select Normal(400 || 500) or bold (700)fonts depending on the font-weight . I am still working on getting the closest match rather than selecting the default(normal and bold) if the font with specified font-weight is unavailable. For example, if 900 is not available we should select 800 instead of 700?. Javier: With this current change I see fonts are dispalyed better. For some reason bitmap bold fonts (under <b> tag) doesn't appear as bold. Whereas this works fine without the recent fix to the font (mLoadedfonts impl. #226340). I have not yet figured out what actually is causing the problem.
I am sorry the bug is in the area of code where I handle the case, the specified font-weight not available.
Attached patch patch (obsolete) — — Splinter Review
Attachment #136445 - Attachment is obsolete: true
The patch (attachment #136578 [details] [diff] [review]) should work for bitmap fonts also.
+ if(( !!(fm->fsSelection & FM_SEL_ITALIC) == bItalic )&& + ( (!bBold &&((mFont.weight/100== 4 && fm->usWeightClass==5)|| mFont.weight/100==fm->usWeightClass)) || + ((bBold && fm->usWeightClass >=6) && ((mFont.weight/100== 4 && fm->usWeightClass==7) ||( mFont.weight/100==fm->usWeightClass))) + )) What are you trying to do here? This is very confusing. Can you explain? And clean it up? + if (plainIndex == -1 && !(fm->fsSelection & (FM_SEL_ITALIC)) && + (fm->usWeightClass <= 5)) { This won't work. Some fonts will have both a 'normal' font and a 'light' font. In order to select properly, you'll have to find the one that is closest to 'normal' (4 or 5). + //The specified font-weight is not available so select the one which is closest available + if(!fh) + { + for( int j = i%count; j < font->nextFamily; j++ ) + { + ... You shouldn't need to add a new loop in order to do this. You should just change the first loop. Take a look at http://lxr.mozilla.org/mozilla/source/gfx/src/os2/nsFontMetricsOS2.cpp#405. This loop tries to find the closest available bitmap font size, but it will find the exact match if one exists. + if (stricmp(pFontMetrics[i].szFacename, "Gill Sans Ultra Bold")==0) { + pFontMetrics[i].usWeightClass = 9; + } Add a comment for why you need to do this.
Assignee: mkaply → grajaman
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Do you have a new patch for this? I'd like to get it fixed.
I need to work on making my patch look closer to windows. Will do that soon.
*** Bug 226980 has been marked as a duplicate of this bug. ***
Attached patch new patch — — Splinter Review
Javier: This new patch contains the changes to select the fonts based on font-weight. Two new functions GetBolderorLighterWeight(..) and GetClosestWeight(..) selects the appropriate font. I believe now we can go and work on the cross platform bugs we discussed earlier so that we get appropriate values (01,99) in mFont.weight.
Attachment #136578 - Attachment is obsolete: true
http://www.mozilla.org/start/1.4 Still doesn't display right. It uses condensed....
I saved that page and added font-weight as 900 in defaultstyle.css BODY { PADDING-RIGHT: 0px; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; COLOR: black; PADDING-TOP: 0px; FONT-FAMILY: "Trebuchet MS", "Gill Sans", Verdana, sans-serif; FONT-WEIGHT: 900;BACKGROUND-COLOR: #cc6600 } It displays ultra bold.
The page specifies Gill Sans as the font - it should be using Gill Sans - not Gill Sans Ultra bold or Gill Sans condensed.
Attached image screenshot —
Kaply, I wrote a simple testcase and see that fonts(Gill Sans/Gill Sans Condensed) are displayed as we mention in the html page. I have attached the screenshot mozilla start page which uses Gill Sans. Please point out if something is wrong so that I can look at that.
I understand very little about font stuff, so like Ganesh in his last comment I don't understand what the (remaining) problem is. In the patch I don't understand why there is a special case for "Gill Sans Ultra Bold" without any comments. Do we still need to follow up on this or do the start pages for Firefox, SeaMonkey etc. display as they should?
Again taking the liberty of marking this one WONTFIX. This is only relevant for branch where I find it unlikely to get fixed. The current start pages don't use Gill Sans any more AFAICT. And trunk has moved on to Thebes...
Status: ASSIGNED → RESOLVED
Closed: 19 years ago
Resolution: --- → WONTFIX
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: