Bug 538730: fix Windows synthetic bolding regression from bug 493280. r=jdaggett

This commit is contained in:
Jonathan Kew 2010-01-13 10:42:25 +00:00
parent 06740d3796
commit 54e01fdc15
6 changed files with 61 additions and 10 deletions

View File

@ -346,6 +346,14 @@ gfxWindowsFont::FillLogFont(gfxFloat aSize)
isItalic = (GetStyle()->style & (FONT_STYLE_ITALIC | FONT_STYLE_OBLIQUE));
PRUint16 weight = fe->Weight();
// determine whether synthetic bolding is needed
PRInt8 baseWeight, weightDistance;
GetStyle()->ComputeWeightAndOffset(&baseWeight, &weightDistance);
if ((weightDistance == 0 && baseWeight >= 6)
|| (weightDistance > 0)) {
weight = PR_MAX(weight, 700); // synthetic bold this face unless already bold
}
// if user font, disable italics/bold if defined to be italics/bold face
// this avoids unwanted synthetic italics/bold
if (fe->mIsUserFont) {
@ -353,14 +361,6 @@ gfxWindowsFont::FillLogFont(gfxFloat aSize)
isItalic = PR_FALSE; // avoid synthetic italic
if (fe->IsBold()) {
weight = 400; // avoid synthetic bold
} else {
// determine whether synthetic bolding is needed
PRInt8 baseWeight, weightDistance;
GetStyle()->ComputeWeightAndOffset(&baseWeight, &weightDistance);
if ((weightDistance == 0 && baseWeight >= 6)
|| (weightDistance > 0)) {
weight = 700; // set to get GDI to synthetic bold this face
}
}
}
@ -472,13 +472,13 @@ gfxWindowsFont::GetOrMakeFont(gfxFontEntry *aFontEntry, const gfxFontStyle *aSty
// things in the cache so we don't end up with things like 402 in there.
gfxFontStyle style(*aStyle);
if (aFontEntry->mIsUserFont && !aFontEntry->IsBold()) {
if (!aFontEntry->IsBold()) {
// determine whether synthetic bolding is needed
PRInt8 baseWeight, weightDistance;
aStyle->ComputeWeightAndOffset(&baseWeight, &weightDistance);
if ((weightDistance == 0 && baseWeight >= 6) || (weightDistance > 0 && aNeedsBold)) {
style.weight = 700; // set to get GDI to synthetic bold this face
style.weight = 700; // set to get GDI to synthetic bold this face
} else {
style.weight = aFontEntry->mWeight;
}

View File

@ -1 +1,6 @@
== CSS21-t1502-no-inherited-font-family.xhtml CSS21-t1502-no-inherited-font-family-ref.xhtml
# basic tests for bug 538730
!= synthetic-bold-1.html synthetic-bold-1-ref.html
!= synthetic-bold-2.html synthetic-bold-2-ref.html

View File

@ -0,0 +1,11 @@
<html>
<head>
<style type="text/css">
body { font-family: Symbol, OpenSymbol, "Standard Symbols L"; font-size: 2em; }
</style>
</head>
<body>
<p>&#xf061;&#xf062;&#xf063; abc</p>
<p>&#xf061;&#xf062;&#xf063; abc</p>
</body>
</html>

View File

@ -0,0 +1,12 @@
<html>
<head>
<style type="text/css">
body { font-family: Symbol, OpenSymbol, "Standard Symbols L"; font-size: 2em; }
</style>
</head>
<!-- if synthetic bolding is working, this should NOT match the reference -->
<body>
<p>&#xf061;&#xf062;&#xf063; abc</p>
<p><b>&#xf061;&#xf062;&#xf063; abc</b></p>
</body>
</html>

View File

@ -0,0 +1,11 @@
<html>
<head>
<style type="text/css">
body { font-family: "Apple Chancery", Impact, "Microsoft Sans Serif", "URW Chancery L"; font-size: 2em; }
</style>
</head>
<body>
<p>Hello World</p>
<p>Hello World</p>
</body>
</html>

View File

@ -0,0 +1,12 @@
<html>
<head>
<style type="text/css">
body { font-family: "Apple Chancery", Impact, "Microsoft Sans Serif", "URW Chancery L"; font-size: 2em; }
</style>
</head>
<!-- if synthetic bolding is working, this should NOT match the reference -->
<body>
<p>Hello World</p>
<p><b>Hello World</b></p>
</body>
</html>