Bug 377717 Remove 'decorations' and 'variant' from gfxFontStyle, r=pavlov
git-svn-id: svn://10.0.0.236/trunk@226695 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -52,16 +52,13 @@ nsSystemFontsBeOS::nsSystemFontsBeOS()
|
||||
: mDefaultFontName(NS_LITERAL_STRING("sans-serif"))
|
||||
, mMenuFontName(NS_LITERAL_STRING("sans-serif"))
|
||||
, mCaptionFontName(NS_LITERAL_STRING("sans-serif"))
|
||||
, mDefaultFontStyle(FONT_STYLE_NORMAL, FONT_VARIANT_NORMAL,
|
||||
FONT_WEIGHT_NORMAL, FONT_DECORATION_NONE,
|
||||
, mDefaultFontStyle(FONT_STYLE_NORMAL, FONT_WEIGHT_NORMAL,
|
||||
DEFAULT_PIXEL_FONT_SIZE, NS_LITERAL_CSTRING(""),
|
||||
0.0f, PR_TRUE, PR_FALSE)
|
||||
, mMenuFontStyle(FONT_STYLE_NORMAL, FONT_VARIANT_NORMAL,
|
||||
FONT_WEIGHT_NORMAL, FONT_DECORATION_NONE,
|
||||
, mMenuFontStyle(FONT_STYLE_NORMAL, FONT_WEIGHT_NORMAL,
|
||||
DEFAULT_PIXEL_FONT_SIZE, NS_LITERAL_CSTRING(""),
|
||||
0.0f, PR_TRUE, PR_FALSE)
|
||||
, mCaptionFontStyle(FONT_STYLE_NORMAL, FONT_VARIANT_NORMAL,
|
||||
FONT_WEIGHT_NORMAL, FONT_DECORATION_NONE,
|
||||
, mCaptionFontStyle(FONT_STYLE_NORMAL, FONT_WEIGHT_NORMAL,
|
||||
DEFAULT_PIXEL_FONT_SIZE, NS_LITERAL_CSTRING(""),
|
||||
0.0f, PR_TRUE, PR_FALSE)
|
||||
{
|
||||
|
||||
@@ -121,20 +121,16 @@ nsSystemFontsGTK2::nsSystemFontsGTK2()
|
||||
, mButtonFontName(NS_LITERAL_STRING("sans-serif"))
|
||||
, mFieldFontName(NS_LITERAL_STRING("sans-serif"))
|
||||
, mMenuFontName(NS_LITERAL_STRING("sans-serif"))
|
||||
, mDefaultFontStyle(FONT_STYLE_NORMAL, FONT_VARIANT_NORMAL,
|
||||
FONT_WEIGHT_NORMAL, FONT_DECORATION_NONE,
|
||||
, mDefaultFontStyle(FONT_STYLE_NORMAL, FONT_WEIGHT_NORMAL,
|
||||
DEFAULT_PIXEL_FONT_SIZE, NS_LITERAL_CSTRING(""),
|
||||
0.0f, PR_TRUE, PR_FALSE)
|
||||
, mButtonFontStyle(FONT_STYLE_NORMAL, FONT_VARIANT_NORMAL,
|
||||
FONT_WEIGHT_NORMAL, FONT_DECORATION_NONE,
|
||||
, mButtonFontStyle(FONT_STYLE_NORMAL, FONT_WEIGHT_NORMAL,
|
||||
DEFAULT_PIXEL_FONT_SIZE, NS_LITERAL_CSTRING(""),
|
||||
0.0f, PR_TRUE, PR_FALSE)
|
||||
, mFieldFontStyle(FONT_STYLE_NORMAL, FONT_VARIANT_NORMAL,
|
||||
FONT_WEIGHT_NORMAL, FONT_DECORATION_NONE,
|
||||
, mFieldFontStyle(FONT_STYLE_NORMAL, FONT_WEIGHT_NORMAL,
|
||||
DEFAULT_PIXEL_FONT_SIZE, NS_LITERAL_CSTRING(""),
|
||||
0.0f, PR_TRUE, PR_FALSE)
|
||||
, mMenuFontStyle(FONT_STYLE_NORMAL, FONT_VARIANT_NORMAL,
|
||||
FONT_WEIGHT_NORMAL, FONT_DECORATION_NONE,
|
||||
, mMenuFontStyle(FONT_STYLE_NORMAL, FONT_WEIGHT_NORMAL,
|
||||
DEFAULT_PIXEL_FONT_SIZE, NS_LITERAL_CSTRING(""),
|
||||
0.0f, PR_TRUE, PR_FALSE)
|
||||
{
|
||||
@@ -217,7 +213,6 @@ nsSystemFontsGTK2::GetSystemFontInfo(GtkWidget *aWidget, nsString *aFontName,
|
||||
GtkSettings *settings = gtk_widget_get_settings(aWidget);
|
||||
|
||||
aFontStyle->style = FONT_STYLE_NORMAL;
|
||||
aFontStyle->decorations = FONT_DECORATION_NONE;
|
||||
|
||||
gchar *fontname;
|
||||
g_object_get(settings, "gtk-font-name", &fontname, NULL);
|
||||
|
||||
@@ -116,7 +116,6 @@ nsSystemFontsMac::GetSystemFont(nsSystemFontID aID, nsString *aFontName,
|
||||
{
|
||||
aFontStyle->style = FONT_STYLE_NORMAL;
|
||||
aFontStyle->weight = FONT_WEIGHT_NORMAL;
|
||||
aFontStyle->decorations = FONT_DECORATION_NONE;
|
||||
|
||||
aFontName->AssignLiteral("sans-serif");
|
||||
aFontStyle->size = 14;
|
||||
@@ -183,8 +182,6 @@ nsSystemFontsMac::GetSystemFont(nsSystemFontID aID, nsString *aFontName,
|
||||
aFontStyle->weight = FONT_WEIGHT_BOLD;
|
||||
if (fontStyle & italic)
|
||||
aFontStyle->style = FONT_STYLE_ITALIC;
|
||||
if (fontStyle & underline)
|
||||
aFontStyle->decorations = FONT_DECORATION_UNDERLINE;
|
||||
|
||||
aFontStyle->systemFont = PR_TRUE;
|
||||
|
||||
|
||||
@@ -189,9 +189,7 @@ nsresult nsSystemFontsOS2::GetSystemFontInfo(nsSystemFontID aID, nsString* aFont
|
||||
|
||||
// As in old gfx/src/os2 set the styles to the defaults
|
||||
aFontStyle->style = FONT_STYLE_NORMAL;
|
||||
aFontStyle->variant = FONT_VARIANT_NORMAL;
|
||||
aFontStyle->weight = FONT_WEIGHT_NORMAL;
|
||||
aFontStyle->decorations = FONT_DECORATION_NONE;
|
||||
aFontStyle->size = gfxFloat(pointSize);
|
||||
|
||||
aFontStyle->systemFont = PR_TRUE;
|
||||
|
||||
@@ -66,24 +66,10 @@ nsresult nsSystemFontsWin::CopyLogFontToNSFont(HDC* aHDC, const LOGFONT* ptrLogF
|
||||
}
|
||||
// XXX What about oblique?
|
||||
|
||||
aFontStyle->variant = FONT_VARIANT_NORMAL;
|
||||
|
||||
// Do Weight
|
||||
aFontStyle->weight = (ptrLogFont->lfWeight == FW_BOLD ?
|
||||
FONT_WEIGHT_BOLD : FONT_WEIGHT_NORMAL);
|
||||
|
||||
// Do decorations
|
||||
aFontStyle->decorations = FONT_DECORATION_NONE;
|
||||
if (ptrLogFont->lfUnderline)
|
||||
{
|
||||
aFontStyle->decorations |= FONT_DECORATION_UNDERLINE;
|
||||
}
|
||||
if (ptrLogFont->lfStrikeOut)
|
||||
{
|
||||
aFontStyle->decorations |= FONT_DECORATION_STRIKEOUT;
|
||||
}
|
||||
|
||||
|
||||
// XXX mPixelScale is currently hardcoded to 1 in thebes gfx...
|
||||
float mPixelScale = 1.0f;
|
||||
// Do Point Size
|
||||
|
||||
@@ -399,9 +399,8 @@ nsThebesDeviceContext::GetSystemFont(nsSystemFontID aID, nsFont *aFont) const
|
||||
}
|
||||
|
||||
nsString fontName;
|
||||
gfxFontStyle fontStyle(NS_FONT_STYLE_NORMAL, NS_FONT_VARIANT_NORMAL,
|
||||
FONT_WEIGHT_NORMAL, FONT_DECORATION_NONE,
|
||||
16.0f, NS_LITERAL_CSTRING(""), 0.0f, PR_TRUE,
|
||||
gfxFontStyle fontStyle(NS_FONT_STYLE_NORMAL, FONT_WEIGHT_NORMAL, 16.0f,
|
||||
NS_LITERAL_CSTRING(""), 0.0f, PR_TRUE,
|
||||
PR_FALSE);
|
||||
nsresult rv = gSystemFonts->GetSystemFont(aID, &fontName, &fontStyle);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
@@ -409,10 +408,10 @@ nsThebesDeviceContext::GetSystemFont(nsSystemFontID aID, nsFont *aFont) const
|
||||
aFont->name = fontName;
|
||||
aFont->style = fontStyle.style;
|
||||
aFont->systemFont = fontStyle.systemFont;
|
||||
aFont->variant = fontStyle.variant;
|
||||
aFont->variant = NS_FONT_VARIANT_NORMAL;
|
||||
aFont->familyNameQuirks = fontStyle.familyNameQuirks;
|
||||
aFont->weight = fontStyle.weight;
|
||||
aFont->decorations = fontStyle.decorations;
|
||||
aFont->decorations = NS_FONT_DECORATION_NONE;
|
||||
aFont->size = NSFloatPixelsToAppUnits(fontStyle.size, AppUnitsPerDevPixel());
|
||||
//aFont->langGroup = fontStyle.langGroup;
|
||||
aFont->sizeAdjust = fontStyle.sizeAdjust;
|
||||
|
||||
@@ -84,10 +84,9 @@ nsThebesFontMetrics::Init(const nsFont& aFont, nsIAtom* aLangGroup,
|
||||
langGroup.Assign(lg);
|
||||
}
|
||||
|
||||
mFontStyle = new gfxFontStyle(aFont.style, aFont.variant,
|
||||
aFont.weight, aFont.decorations,
|
||||
size, langGroup, aFont.sizeAdjust,
|
||||
aFont.systemFont, aFont.familyNameQuirks);
|
||||
mFontStyle = new gfxFontStyle(aFont.style, aFont.weight, size, langGroup,
|
||||
aFont.sizeAdjust, aFont.systemFont,
|
||||
aFont.familyNameQuirks);
|
||||
|
||||
mFontGroup =
|
||||
gfxPlatform::GetPlatform()->CreateFontGroup(aFont.name, mFontStyle);
|
||||
|
||||
@@ -61,20 +61,11 @@ typedef struct _cairo cairo_t;
|
||||
#define FONT_STYLE_ITALIC 1
|
||||
#define FONT_STYLE_OBLIQUE 2
|
||||
|
||||
#define FONT_VARIANT_NORMAL 0
|
||||
#define FONT_VARIANT_SMALL_CAPS 1
|
||||
|
||||
#define FONT_DECORATION_NONE 0x0
|
||||
#define FONT_DECORATION_UNDERLINE 0x1
|
||||
#define FONT_DECORATION_OVERLINE 0x2
|
||||
#define FONT_DECORATION_STRIKEOUT 0x4
|
||||
|
||||
#define FONT_WEIGHT_NORMAL 400
|
||||
#define FONT_WEIGHT_BOLD 700
|
||||
|
||||
struct THEBES_API gfxFontStyle {
|
||||
gfxFontStyle(PRUint8 aStyle, PRUint8 aVariant,
|
||||
PRUint16 aWeight, PRUint8 aDecoration, gfxFloat aSize,
|
||||
gfxFontStyle(PRUint8 aStyle, PRUint16 aWeight, gfxFloat aSize,
|
||||
const nsACString& aLangGroup,
|
||||
float aSizeAdjust, PRPackedBool aSystemFont,
|
||||
PRPackedBool aFamilyNameQuirks);
|
||||
@@ -88,9 +79,6 @@ struct THEBES_API gfxFontStyle {
|
||||
// sources.
|
||||
PRPackedBool systemFont : 1;
|
||||
|
||||
// The variant of the font (normal, small-caps)
|
||||
PRUint8 variant : 7;
|
||||
|
||||
// True if the character set quirks (for treatment of "Symbol",
|
||||
// "Wingdings", etc.) should be applied.
|
||||
PRPackedBool familyNameQuirks : 1;
|
||||
@@ -102,10 +90,6 @@ struct THEBES_API gfxFontStyle {
|
||||
// font being used, since it is two weights lighter than 900.
|
||||
PRUint16 weight;
|
||||
|
||||
// The decorations on the font (underline, overline,
|
||||
// line-through). The decorations can be binary or'd together.
|
||||
PRUint8 decorations;
|
||||
|
||||
// The logical size of the font, in pixels
|
||||
gfxFloat size;
|
||||
|
||||
|
||||
@@ -552,14 +552,13 @@ gfxFontGroup::MakeSpaceTextRun(const Parameters *aParams, PRUint32 aFlags)
|
||||
return textRun.forget();
|
||||
}
|
||||
|
||||
gfxFontStyle::gfxFontStyle(PRUint8 aStyle, PRUint8 aVariant,
|
||||
PRUint16 aWeight, PRUint8 aDecoration, gfxFloat aSize,
|
||||
gfxFontStyle::gfxFontStyle(PRUint8 aStyle, PRUint16 aWeight, gfxFloat aSize,
|
||||
const nsACString& aLangGroup,
|
||||
float aSizeAdjust, PRPackedBool aSystemFont,
|
||||
PRPackedBool aFamilyNameQuirks) :
|
||||
style(aStyle), systemFont(aSystemFont), variant(aVariant),
|
||||
style(aStyle), systemFont(aSystemFont),
|
||||
familyNameQuirks(aFamilyNameQuirks), weight(aWeight),
|
||||
decorations(aDecoration), size(PR_MIN(aSize, 5000)), langGroup(aLangGroup), sizeAdjust(aSizeAdjust)
|
||||
size(PR_MIN(aSize, 5000)), langGroup(aLangGroup), sizeAdjust(aSizeAdjust)
|
||||
{
|
||||
if (weight > 900)
|
||||
weight = 900;
|
||||
@@ -573,10 +572,10 @@ gfxFontStyle::gfxFontStyle(PRUint8 aStyle, PRUint8 aVariant,
|
||||
}
|
||||
|
||||
gfxFontStyle::gfxFontStyle(const gfxFontStyle& aStyle) :
|
||||
style(aStyle.style), systemFont(aStyle.systemFont), variant(aStyle.variant),
|
||||
style(aStyle.style), systemFont(aStyle.systemFont),
|
||||
familyNameQuirks(aStyle.familyNameQuirks), weight(aStyle.weight),
|
||||
decorations(aStyle.decorations), size(aStyle.size),
|
||||
langGroup(aStyle.langGroup), sizeAdjust(aStyle.sizeAdjust)
|
||||
size(aStyle.size), langGroup(aStyle.langGroup),
|
||||
sizeAdjust(aStyle.sizeAdjust)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -106,18 +106,14 @@ SetupTests()
|
||||
|
||||
/* some common styles */
|
||||
gfxFontStyle style_western_normal_16 (FONT_STYLE_NORMAL,
|
||||
FONT_VARIANT_NORMAL,
|
||||
400,
|
||||
FONT_DECORATION_NONE,
|
||||
16.0,
|
||||
nsDependentCString("x-western"),
|
||||
0.0,
|
||||
PR_FALSE, PR_FALSE);
|
||||
|
||||
gfxFontStyle style_western_bold_16 (FONT_STYLE_NORMAL,
|
||||
FONT_VARIANT_NORMAL,
|
||||
700,
|
||||
FONT_DECORATION_NONE,
|
||||
16.0,
|
||||
nsDependentCString("x-western"),
|
||||
0.0,
|
||||
|
||||
@@ -90,9 +90,7 @@ void
|
||||
RunTest (TestEntry *test, gfxContext *ctx) {
|
||||
if (!lastFamilies || strcmp(lastFamilies, test->mFamilies)) {
|
||||
gfxFontStyle style_western_normal_16 (FONT_STYLE_NORMAL,
|
||||
FONT_VARIANT_NORMAL,
|
||||
400,
|
||||
FONT_DECORATION_NONE,
|
||||
16.0,
|
||||
nsDependentCString("x-western"),
|
||||
0.0,
|
||||
|
||||
@@ -140,11 +140,9 @@ nsSVGGlyphFrame::DidSetStyleContext()
|
||||
langGroup.Assign(lg);
|
||||
}
|
||||
|
||||
// XXX decorations are ignored by gfxFontStyle - still need to implement
|
||||
mFontStyle = new gfxFontStyle(font.style, font.variant,
|
||||
font.weight, font.decorations,
|
||||
size, langGroup, font.sizeAdjust,
|
||||
font.systemFont, font.familyNameQuirks);
|
||||
mFontStyle = new gfxFontStyle(font.style, font.weight, size, langGroup,
|
||||
font.sizeAdjust, font.systemFont,
|
||||
font.familyNameQuirks);
|
||||
|
||||
if (mFontStyle) {
|
||||
mFontGroup =
|
||||
|
||||
Reference in New Issue
Block a user