bug 735439 - optimize order of fields in gfxFontStyle to save space. r=jdaggett

This commit is contained in:
Jonathan Kew 2012-03-15 09:03:00 +00:00
parent 96d2b41275
commit 0c0e3015b0
2 changed files with 38 additions and 37 deletions

View File

@ -3749,12 +3749,12 @@ gfxFontStyle::ParseFontLanguageOverride(const nsString& aLangTag)
}
gfxFontStyle::gfxFontStyle() :
style(FONT_STYLE_NORMAL), systemFont(true), printerFont(false),
weight(FONT_WEIGHT_NORMAL),
stretch(NS_FONT_STRETCH_NORMAL), size(DEFAULT_PIXEL_FONT_SIZE),
sizeAdjust(0.0f),
language(gfxAtoms::x_western),
languageOverride(NO_FONT_LANGUAGE_OVERRIDE)
size(DEFAULT_PIXEL_FONT_SIZE), sizeAdjust(0.0f),
languageOverride(NO_FONT_LANGUAGE_OVERRIDE),
weight(FONT_WEIGHT_NORMAL), stretch(NS_FONT_STRETCH_NORMAL),
systemFont(true), printerFont(false),
style(FONT_STYLE_NORMAL)
{
}
@ -3764,11 +3764,12 @@ gfxFontStyle::gfxFontStyle(PRUint8 aStyle, PRUint16 aWeight, PRInt16 aStretch,
bool aPrinterFont,
const nsString& aFeatureSettings,
const nsString& aLanguageOverride):
style(aStyle), systemFont(aSystemFont), printerFont(aPrinterFont),
weight(aWeight), stretch(aStretch),
size(aSize), sizeAdjust(aSizeAdjust),
language(aLanguage),
languageOverride(ParseFontLanguageOverride(aLanguageOverride))
size(aSize), sizeAdjust(aSizeAdjust),
languageOverride(ParseFontLanguageOverride(aLanguageOverride)),
weight(aWeight), stretch(aStretch),
systemFont(aSystemFont), printerFont(aPrinterFont),
style(aStyle)
{
ParseFontFeatureSettings(aFeatureSettings, featureSettings);
@ -3792,12 +3793,12 @@ gfxFontStyle::gfxFontStyle(PRUint8 aStyle, PRUint16 aWeight, PRInt16 aStretch,
}
gfxFontStyle::gfxFontStyle(const gfxFontStyle& aStyle) :
style(aStyle.style), systemFont(aStyle.systemFont), printerFont(aStyle.printerFont),
weight(aStyle.weight),
stretch(aStyle.stretch), size(aStyle.size),
sizeAdjust(aStyle.sizeAdjust),
language(aStyle.language),
languageOverride(aStyle.languageOverride)
size(aStyle.size), sizeAdjust(aStyle.sizeAdjust),
languageOverride(aStyle.languageOverride),
weight(aStyle.weight), stretch(aStyle.stretch),
systemFont(aStyle.systemFont), printerFont(aStyle.printerFont),
style(aStyle.style)
{
featureSettings.AppendElements(aStyle.featureSettings);
}

View File

@ -122,23 +122,13 @@ struct THEBES_API gfxFontStyle {
const nsString& aLanguageOverride);
gfxFontStyle(const gfxFontStyle& aStyle);
// The style of font (normal, italic, oblique)
PRUint8 style : 7;
// the language (may be an internal langGroup code rather than an actual
// language code) specified in the document or element's lang property,
// or inferred from the charset
nsRefPtr<nsIAtom> language;
// Say that this font is a system font and therefore does not
// require certain fixup that we do for fonts from untrusted
// sources.
bool systemFont : 1;
// Say that this font is used for print or print preview.
bool printerFont : 1;
// The weight of the font: 100, 200, ... 900.
PRUint16 weight;
// The stretch of the font (the sum of various NS_FONT_STRETCH_*
// constants; see gfxFontConstants.h).
PRInt16 stretch;
// custom opentype feature settings
nsTArray<gfxFontFeature> featureSettings;
// The logical size of the font, in pixels
gfxFloat size;
@ -149,11 +139,6 @@ struct THEBES_API gfxFontStyle {
// needs to be done.
float sizeAdjust;
// the language (may be an internal langGroup code rather than an actual
// language code) specified in the document or element's lang property,
// or inferred from the charset
nsRefPtr<nsIAtom> language;
// Language system tag, to override document language;
// an OpenType "language system" tag represented as a 32-bit integer
// (see http://www.microsoft.com/typography/otspec/languagetags.htm).
@ -166,8 +151,23 @@ struct THEBES_API gfxFontStyle {
// in order to get correct glyph shapes.)
PRUint32 languageOverride;
// custom opentype feature settings
nsTArray<gfxFontFeature> featureSettings;
// The weight of the font: 100, 200, ... 900.
PRUint16 weight;
// The stretch of the font (the sum of various NS_FONT_STRETCH_*
// constants; see gfxFontConstants.h).
PRInt8 stretch;
// Say that this font is a system font and therefore does not
// require certain fixup that we do for fonts from untrusted
// sources.
bool systemFont : 1;
// Say that this font is used for print or print preview.
bool printerFont : 1;
// The style of font (normal, italic, oblique)
PRUint8 style : 2;
// Return the final adjusted font size for the given aspect ratio.
// Not meant to be called when sizeAdjust = 0.