Back out 2 changesets (bug 543715) because Mulet is why we can't have nice things

Backed out changeset 2d1d8e9b095c (bug 543715)
Backed out changeset bc90276ec090 (bug 543715)
This commit is contained in:
Phil Ringnalda 2015-10-18 11:22:22 -07:00
parent 17ee102808
commit 8f424e8250
55 changed files with 239 additions and 784 deletions

View File

@ -328,26 +328,26 @@ gfxFontEntry*
gfxAndroidPlatform::LookupLocalFont(const nsAString& aFontName, gfxAndroidPlatform::LookupLocalFont(const nsAString& aFontName,
uint16_t aWeight, uint16_t aWeight,
int16_t aStretch, int16_t aStretch,
uint8_t aStyle) bool aItalic)
{ {
return gfxPlatformFontList::PlatformFontList()->LookupLocalFont(aFontName, return gfxPlatformFontList::PlatformFontList()->LookupLocalFont(aFontName,
aWeight, aWeight,
aStretch, aStretch,
aStyle); aItalic);
} }
gfxFontEntry* gfxFontEntry*
gfxAndroidPlatform::MakePlatformFont(const nsAString& aFontName, gfxAndroidPlatform::MakePlatformFont(const nsAString& aFontName,
uint16_t aWeight, uint16_t aWeight,
int16_t aStretch, int16_t aStretch,
uint8_t aStyle, bool aItalic,
const uint8_t* aFontData, const uint8_t* aFontData,
uint32_t aLength) uint32_t aLength)
{ {
return gfxPlatformFontList::PlatformFontList()->MakePlatformFont(aFontName, return gfxPlatformFontList::PlatformFontList()->MakePlatformFont(aFontName,
aWeight, aWeight,
aStretch, aStretch,
aStyle, aItalic,
aFontData, aFontData,
aLength); aLength);
} }

View File

@ -48,11 +48,11 @@ public:
virtual gfxFontEntry* LookupLocalFont(const nsAString& aFontName, virtual gfxFontEntry* LookupLocalFont(const nsAString& aFontName,
uint16_t aWeight, uint16_t aWeight,
int16_t aStretch, int16_t aStretch,
uint8_t aStyle); bool aItalic);
virtual gfxFontEntry* MakePlatformFont(const nsAString& aFontName, virtual gfxFontEntry* MakePlatformFont(const nsAString& aFontName,
uint16_t aWeight, uint16_t aWeight,
int16_t aStretch, int16_t aStretch,
uint8_t aStyle, bool aItalic,
const uint8_t* aFontData, const uint8_t* aFontData,
uint32_t aLength); uint32_t aLength);

View File

@ -217,8 +217,7 @@ gfxDWriteFontFamily::FindStyleVariations(FontInfoData *aFontInfoData)
" with style: %s weight: %d stretch: %d psname: %s fullname: %s", " with style: %s weight: %d stretch: %d psname: %s fullname: %s",
NS_ConvertUTF16toUTF8(fe->Name()).get(), NS_ConvertUTF16toUTF8(fe->Name()).get(),
NS_ConvertUTF16toUTF8(Name()).get(), NS_ConvertUTF16toUTF8(Name()).get(),
(fe->IsItalic()) ? (fe->IsItalic()) ? "italic" : "normal",
"italic" : (fe->IsOblique() ? "oblique" : "normal"),
fe->Weight(), fe->Stretch(), fe->Weight(), fe->Stretch(),
NS_ConvertUTF16toUTF8(psname).get(), NS_ConvertUTF16toUTF8(psname).get(),
NS_ConvertUTF16toUTF8(fullname).get())); NS_ConvertUTF16toUTF8(fullname).get()));
@ -389,7 +388,7 @@ gfxDWriteFontEntry::CopyFontTable(uint32_t aTableTag,
// potential cmap discrepancies, see bug 629386. // potential cmap discrepancies, see bug 629386.
// Ditto for Hebrew, bug 837498. // Ditto for Hebrew, bug 837498.
if (mFont && pFontList->UseGDIFontTableAccess() && if (mFont && pFontList->UseGDIFontTableAccess() &&
!(mStyle && UsingArabicOrHebrewScriptSystemLocale()) && !(mItalic && UsingArabicOrHebrewScriptSystemLocale()) &&
!mFont->IsSymbolFont()) !mFont->IsSymbolFont())
{ {
LOGFONTW logfont = { 0 }; LOGFONTW logfont = { 0 };
@ -744,7 +743,7 @@ gfxFontEntry *
gfxDWriteFontList::LookupLocalFont(const nsAString& aFontName, gfxDWriteFontList::LookupLocalFont(const nsAString& aFontName,
uint16_t aWeight, uint16_t aWeight,
int16_t aStretch, int16_t aStretch,
uint8_t aStyle) bool aItalic)
{ {
gfxFontEntry *lookup; gfxFontEntry *lookup;
@ -759,7 +758,7 @@ gfxDWriteFontList::LookupLocalFont(const nsAString& aFontName,
dwriteLookup->mFont, dwriteLookup->mFont,
aWeight, aWeight,
aStretch, aStretch,
aStyle); aItalic);
fe->SetForceGDIClassic(dwriteLookup->GetForceGDIClassic()); fe->SetForceGDIClassic(dwriteLookup->GetForceGDIClassic());
return fe; return fe;
} }
@ -768,7 +767,7 @@ gfxFontEntry *
gfxDWriteFontList::MakePlatformFont(const nsAString& aFontName, gfxDWriteFontList::MakePlatformFont(const nsAString& aFontName,
uint16_t aWeight, uint16_t aWeight,
int16_t aStretch, int16_t aStretch,
uint8_t aStyle, bool aItalic,
const uint8_t* aFontData, const uint8_t* aFontData,
uint32_t aLength) uint32_t aLength)
{ {
@ -833,7 +832,7 @@ gfxDWriteFontList::MakePlatformFont(const nsAString& aFontName,
fontFile, fontFile,
aWeight, aWeight,
aStretch, aStretch,
aStyle); aItalic);
fontFile->Analyze(&isSupported, &fileType, &entry->mFaceType, &numFaces); fontFile->Analyze(&isSupported, &fileType, &entry->mFaceType, &numFaces);
if (!isSupported || numFaces > 1) { if (!isSupported || numFaces > 1) {
@ -975,8 +974,7 @@ gfxDWriteFontList::InitFontList()
" with style: %s weight: %d stretch: %d", " with style: %s weight: %d stretch: %d",
NS_ConvertUTF16toUTF8(fe->Name()).get(), NS_ConvertUTF16toUTF8(fe->Name()).get(),
NS_ConvertUTF16toUTF8(gillSansMTFamily->Name()).get(), NS_ConvertUTF16toUTF8(gillSansMTFamily->Name()).get(),
(fe->IsItalic()) ? (fe->IsItalic()) ? "italic" : "normal",
"italic" : (fe->IsOblique() ? "oblique" : "normal"),
fe->Weight(), fe->Stretch())); fe->Weight(), fe->Stretch()));
} }
} }

View File

@ -80,11 +80,8 @@ public:
: gfxFontEntry(aFaceName), mFont(aFont), mFontFile(nullptr), : gfxFontEntry(aFaceName), mFont(aFont), mFontFile(nullptr),
mForceGDIClassic(false) mForceGDIClassic(false)
{ {
DWRITE_FONT_STYLE dwriteStyle = aFont->GetStyle(); mItalic = (aFont->GetStyle() == DWRITE_FONT_STYLE_ITALIC ||
mStyle = (dwriteStyle == DWRITE_FONT_STYLE_ITALIC ? aFont->GetStyle() == DWRITE_FONT_STYLE_OBLIQUE);
NS_FONT_STYLE_ITALIC :
(dwriteStyle == DWRITE_FONT_STYLE_OBLIQUE ?
NS_FONT_STYLE_OBLIQUE : NS_FONT_STYLE_NORMAL));
mStretch = FontStretchFromDWriteStretch(aFont->GetStretch()); mStretch = FontStretchFromDWriteStretch(aFont->GetStretch());
uint16_t weight = NS_ROUNDUP(aFont->GetWeight() - 50, 100); uint16_t weight = NS_ROUNDUP(aFont->GetWeight() - 50, 100);
@ -104,19 +101,19 @@ public:
* \param aFont DirectWrite font object * \param aFont DirectWrite font object
* \param aWeight Weight of the font * \param aWeight Weight of the font
* \param aStretch Stretch of the font * \param aStretch Stretch of the font
* \param aStyle italic or oblique of font * \param aItalic True if italic
*/ */
gfxDWriteFontEntry(const nsAString& aFaceName, gfxDWriteFontEntry(const nsAString& aFaceName,
IDWriteFont *aFont, IDWriteFont *aFont,
uint16_t aWeight, uint16_t aWeight,
int16_t aStretch, int16_t aStretch,
uint8_t aStyle) bool aItalic)
: gfxFontEntry(aFaceName), mFont(aFont), mFontFile(nullptr), : gfxFontEntry(aFaceName), mFont(aFont), mFontFile(nullptr),
mForceGDIClassic(false) mForceGDIClassic(false)
{ {
mWeight = aWeight; mWeight = aWeight;
mStretch = aStretch; mStretch = aStretch;
mStyle = aStyle; mItalic = aItalic;
mIsLocalUserFont = true; mIsLocalUserFont = true;
mIsCJK = UNINITIALIZED_VALUE; mIsCJK = UNINITIALIZED_VALUE;
} }
@ -128,19 +125,19 @@ public:
* \param aFontFile DirectWrite fontfile object * \param aFontFile DirectWrite fontfile object
* \param aWeight Weight of the font * \param aWeight Weight of the font
* \param aStretch Stretch of the font * \param aStretch Stretch of the font
* \param aStyle italic or oblique of font * \param aItalic True if italic
*/ */
gfxDWriteFontEntry(const nsAString& aFaceName, gfxDWriteFontEntry(const nsAString& aFaceName,
IDWriteFontFile *aFontFile, IDWriteFontFile *aFontFile,
uint16_t aWeight, uint16_t aWeight,
int16_t aStretch, int16_t aStretch,
uint8_t aStyle) bool aItalic)
: gfxFontEntry(aFaceName), mFont(nullptr), mFontFile(aFontFile), : gfxFontEntry(aFaceName), mFont(nullptr), mFontFile(aFontFile),
mForceGDIClassic(false) mForceGDIClassic(false)
{ {
mWeight = aWeight; mWeight = aWeight;
mStretch = aStretch; mStretch = aStretch;
mStyle = aStyle; mItalic = aItalic;
mIsDataUserFont = true; mIsDataUserFont = true;
mIsCJK = UNINITIALIZED_VALUE; mIsCJK = UNINITIALIZED_VALUE;
} }
@ -352,12 +349,12 @@ public:
virtual gfxFontEntry* LookupLocalFont(const nsAString& aFontName, virtual gfxFontEntry* LookupLocalFont(const nsAString& aFontName,
uint16_t aWeight, uint16_t aWeight,
int16_t aStretch, int16_t aStretch,
uint8_t aStyle); bool aItalic);
virtual gfxFontEntry* MakePlatformFont(const nsAString& aFontName, virtual gfxFontEntry* MakePlatformFont(const nsAString& aFontName,
uint16_t aWeight, uint16_t aWeight,
int16_t aStretch, int16_t aStretch,
uint8_t aStyle, bool aItalic,
const uint8_t* aFontData, const uint8_t* aFontData,
uint32_t aLength); uint32_t aLength);

View File

@ -85,9 +85,8 @@ gfxDWriteFont::gfxDWriteFont(gfxFontEntry *aFontEntry,
static_cast<gfxDWriteFontEntry*>(aFontEntry); static_cast<gfxDWriteFontEntry*>(aFontEntry);
nsresult rv; nsresult rv;
DWRITE_FONT_SIMULATIONS sims = DWRITE_FONT_SIMULATIONS_NONE; DWRITE_FONT_SIMULATIONS sims = DWRITE_FONT_SIMULATIONS_NONE;
if ((GetStyle()->style != NS_FONT_STYLE_NORMAL) && if ((GetStyle()->style & (NS_FONT_STYLE_ITALIC | NS_FONT_STYLE_OBLIQUE)) &&
fe->IsUpright() && !fe->IsItalic() && GetStyle()->allowSyntheticStyle) {
GetStyle()->allowSyntheticStyle) {
// For this we always use the font_matrix for uniformity. Not the // For this we always use the font_matrix for uniformity. Not the
// DWrite simulation. // DWrite simulation.
mNeedsOblique = true; mNeedsOblique = true;

View File

@ -188,9 +188,9 @@ FT2FontEntry::CreateScaledFont(const gfxFontStyle *aStyle)
cairo_matrix_init_identity(&identityMatrix); cairo_matrix_init_identity(&identityMatrix);
// synthetic oblique by skewing via the font matrix // synthetic oblique by skewing via the font matrix
bool needsOblique = IsUpright() && bool needsOblique = !IsItalic() &&
aStyle->style != NS_FONT_STYLE_NORMAL && (aStyle->style & (NS_FONT_STYLE_ITALIC | NS_FONT_STYLE_OBLIQUE)) &&
aStyle->allowSyntheticStyle; aStyle->allowSyntheticStyle;
if (needsOblique) { if (needsOblique) {
cairo_matrix_t style; cairo_matrix_t style;
@ -251,7 +251,7 @@ FT2FontEntry*
FT2FontEntry::CreateFontEntry(const nsAString& aFontName, FT2FontEntry::CreateFontEntry(const nsAString& aFontName,
uint16_t aWeight, uint16_t aWeight,
int16_t aStretch, int16_t aStretch,
uint8_t aStyle, bool aItalic,
const uint8_t* aFontData, const uint8_t* aFontData,
uint32_t aLength) uint32_t aLength)
{ {
@ -277,7 +277,7 @@ FT2FontEntry::CreateFontEntry(const nsAString& aFontName,
FT2FontEntry::CreateFontEntry(face, nullptr, 0, aFontName, FT2FontEntry::CreateFontEntry(face, nullptr, 0, aFontName,
aFontData); aFontData);
if (fe) { if (fe) {
fe->mStyle = aStyle; fe->mItalic = aItalic;
fe->mWeight = aWeight; fe->mWeight = aWeight;
fe->mStretch = aStretch; fe->mStretch = aStretch;
fe->mIsDataUserFont = true; fe->mIsDataUserFont = true;
@ -323,7 +323,7 @@ FT2FontEntry::CreateFontEntry(const FontListEntry& aFLE)
fe->mFTFontIndex = aFLE.index(); fe->mFTFontIndex = aFLE.index();
fe->mWeight = aFLE.weight(); fe->mWeight = aFLE.weight();
fe->mStretch = aFLE.stretch(); fe->mStretch = aFLE.stretch();
fe->mStyle = (aFLE.italic() ? NS_FONT_STYLE_ITALIC : NS_FONT_STYLE_NORMAL); fe->mItalic = aFLE.italic();
return fe; return fe;
} }
@ -380,8 +380,7 @@ FT2FontEntry::CreateFontEntry(FT_Face aFace,
const uint8_t* aFontData) const uint8_t* aFontData)
{ {
FT2FontEntry *fe = new FT2FontEntry(aName); FT2FontEntry *fe = new FT2FontEntry(aName);
fe->mStyle = (FTFaceIsItalic(aFace) ? fe->mItalic = FTFaceIsItalic(aFace);
NS_FONT_STYLE_ITALIC : NS_FONT_STYLE_NORMAL);
fe->mWeight = FTFaceGetWeight(aFace); fe->mWeight = FTFaceGetWeight(aFace);
fe->mFilename = aFilename; fe->mFilename = aFilename;
fe->mFTFontIndex = aIndex; fe->mFTFontIndex = aIndex;
@ -597,7 +596,7 @@ FT2FontFamily::AddFacesToFontList(InfallibleTArray<FontListEntry>* aFontList,
aFontList->AppendElement(FontListEntry(Name(), fe->Name(), aFontList->AppendElement(FontListEntry(Name(), fe->Name(),
fe->mFilename, fe->mFilename,
fe->Weight(), fe->Stretch(), fe->Weight(), fe->Stretch(),
fe->mStyle, fe->IsItalic(),
fe->mFTFontIndex, fe->mFTFontIndex,
aVisibility == kHidden)); aVisibility == kHidden));
} }
@ -1453,7 +1452,7 @@ gfxFontEntry*
gfxFT2FontList::LookupLocalFont(const nsAString& aFontName, gfxFT2FontList::LookupLocalFont(const nsAString& aFontName,
uint16_t aWeight, uint16_t aWeight,
int16_t aStretch, int16_t aStretch,
uint8_t aStyle) bool aItalic)
{ {
// walk over list of names // walk over list of names
FT2FontEntry* fontEntry = nullptr; FT2FontEntry* fontEntry = nullptr;
@ -1510,7 +1509,7 @@ searchDone:
fontEntry->mFTFontIndex, fontEntry->mFTFontIndex,
fontEntry->Name(), nullptr); fontEntry->Name(), nullptr);
if (fe) { if (fe) {
fe->mStyle = aStyle; fe->mItalic = aItalic;
fe->mWeight = aWeight; fe->mWeight = aWeight;
fe->mStretch = aStretch; fe->mStretch = aStretch;
fe->mIsLocalUserFont = true; fe->mIsLocalUserFont = true;
@ -1539,7 +1538,7 @@ gfxFontEntry*
gfxFT2FontList::MakePlatformFont(const nsAString& aFontName, gfxFT2FontList::MakePlatformFont(const nsAString& aFontName,
uint16_t aWeight, uint16_t aWeight,
int16_t aStretch, int16_t aStretch,
uint8_t aStyle, bool aItalic,
const uint8_t* aFontData, const uint8_t* aFontData,
uint32_t aLength) uint32_t aLength)
{ {
@ -1547,7 +1546,7 @@ gfxFT2FontList::MakePlatformFont(const nsAString& aFontName,
// but instead pass ownership to the font entry. // but instead pass ownership to the font entry.
// Deallocation will happen later, when the font face is destroyed. // Deallocation will happen later, when the font face is destroyed.
return FT2FontEntry::CreateFontEntry(aFontName, aWeight, aStretch, return FT2FontEntry::CreateFontEntry(aFontName, aWeight, aStretch,
aStyle, aFontData, aLength); aItalic, aFontData, aLength);
} }
void void

View File

@ -42,7 +42,7 @@ public:
CreateFontEntry(const nsAString& aFontName, CreateFontEntry(const nsAString& aFontName,
uint16_t aWeight, uint16_t aWeight,
int16_t aStretch, int16_t aStretch,
uint8_t aStyle, bool aItalic,
const uint8_t* aFontData, const uint8_t* aFontData,
uint32_t aLength); uint32_t aLength);
@ -125,12 +125,12 @@ public:
virtual gfxFontEntry* LookupLocalFont(const nsAString& aFontName, virtual gfxFontEntry* LookupLocalFont(const nsAString& aFontName,
uint16_t aWeight, uint16_t aWeight,
int16_t aStretch, int16_t aStretch,
uint8_t aStyle); bool aItalic);
virtual gfxFontEntry* MakePlatformFont(const nsAString& aFontName, virtual gfxFontEntry* MakePlatformFont(const nsAString& aFontName,
uint16_t aWeight, uint16_t aWeight,
int16_t aStretch, int16_t aStretch,
uint8_t aStyle, bool aItalic,
const uint8_t* aFontData, const uint8_t* aFontData,
uint32_t aLength); uint32_t aLength);

View File

@ -256,10 +256,8 @@ gfxFontconfigFontEntry::gfxFontconfigFontEntry(const nsAString& aFaceName,
if (FcPatternGetInteger(aFontPattern, FC_SLANT, 0, &slant) != FcResultMatch) { if (FcPatternGetInteger(aFontPattern, FC_SLANT, 0, &slant) != FcResultMatch) {
slant = FC_SLANT_ROMAN; slant = FC_SLANT_ROMAN;
} }
if (slant == FC_SLANT_OBLIQUE) { if (slant > 0) {
mStyle = NS_FONT_STYLE_OBLIQUE; mItalic = true;
} else if (slant > 0) {
mStyle = NS_FONT_STYLE_ITALIC;
} }
// weight // weight
@ -280,7 +278,7 @@ gfxFontconfigFontEntry::gfxFontconfigFontEntry(const nsAString& aFaceName,
gfxFontconfigFontEntry::gfxFontconfigFontEntry(const nsAString& aFaceName, gfxFontconfigFontEntry::gfxFontconfigFontEntry(const nsAString& aFaceName,
uint16_t aWeight, uint16_t aWeight,
int16_t aStretch, int16_t aStretch,
uint8_t aStyle, bool aItalic,
const uint8_t *aData, const uint8_t *aData,
FT_Face aFace) FT_Face aFace)
: gfxFontEntry(aFaceName), : gfxFontEntry(aFaceName),
@ -288,7 +286,7 @@ gfxFontconfigFontEntry::gfxFontconfigFontEntry(const nsAString& aFaceName,
mAspect(0.0), mFontData(aData) mAspect(0.0), mFontData(aData)
{ {
mWeight = aWeight; mWeight = aWeight;
mStyle = aStyle; mItalic = aItalic;
mStretch = aStretch; mStretch = aStretch;
mIsDataUserFont = true; mIsDataUserFont = true;
@ -321,13 +319,13 @@ gfxFontconfigFontEntry::gfxFontconfigFontEntry(const nsAString& aFaceName,
FcPattern* aFontPattern, FcPattern* aFontPattern,
uint16_t aWeight, uint16_t aWeight,
int16_t aStretch, int16_t aStretch,
uint8_t aStyle) bool aItalic)
: gfxFontEntry(aFaceName), mFontPattern(aFontPattern), : gfxFontEntry(aFaceName), mFontPattern(aFontPattern),
mFTFace(nullptr), mFTFaceInitialized(false), mFTFace(nullptr), mFTFaceInitialized(false),
mAspect(0.0), mFontData(nullptr) mAspect(0.0), mFontData(nullptr)
{ {
mWeight = aWeight; mWeight = aWeight;
mStyle = aStyle; mItalic = aItalic;
mStretch = aStretch; mStretch = aStretch;
mIsLocalUserFont = true; mIsLocalUserFont = true;
} }
@ -672,9 +670,9 @@ gfxFontconfigFontEntry::CreateScaledFont(FcPattern* aRenderPattern,
} }
// synthetic oblique by skewing via the font matrix // synthetic oblique by skewing via the font matrix
bool needsOblique = IsUpright() && bool needsOblique = !IsItalic() &&
aStyle->style != NS_FONT_STYLE_NORMAL && (aStyle->style & (NS_FONT_STYLE_ITALIC | NS_FONT_STYLE_OBLIQUE)) &&
aStyle->allowSyntheticStyle; aStyle->allowSyntheticStyle;
if (needsOblique) { if (needsOblique) {
// disable embedded bitmaps (mimics behavior in 90-synthetic.conf) // disable embedded bitmaps (mimics behavior in 90-synthetic.conf)
@ -865,8 +863,7 @@ gfxFontconfigFontFamily::FindStyleVariations(FontInfoData *aFontInfoData)
" psname: %s fullname: %s", " psname: %s fullname: %s",
NS_ConvertUTF16toUTF8(fontEntry->Name()).get(), NS_ConvertUTF16toUTF8(fontEntry->Name()).get(),
NS_ConvertUTF16toUTF8(Name()).get(), NS_ConvertUTF16toUTF8(Name()).get(),
(fontEntry->IsItalic()) ? fontEntry->IsItalic() ? "italic" : "normal",
"italic" : (fontEntry->IsOblique() ? "oblique" : "normal"),
fontEntry->Weight(), fontEntry->Stretch(), fontEntry->Weight(), fontEntry->Stretch(),
NS_ConvertUTF16toUTF8(psname).get(), NS_ConvertUTF16toUTF8(psname).get(),
NS_ConvertUTF16toUTF8(fullname).get())); NS_ConvertUTF16toUTF8(fullname).get()));
@ -1175,7 +1172,7 @@ gfxFontEntry*
gfxFcPlatformFontList::LookupLocalFont(const nsAString& aFontName, gfxFcPlatformFontList::LookupLocalFont(const nsAString& aFontName,
uint16_t aWeight, uint16_t aWeight,
int16_t aStretch, int16_t aStretch,
uint8_t aStyle) bool aItalic)
{ {
nsAutoString keyName(aFontName); nsAutoString keyName(aFontName);
ToLowerCase(keyName); ToLowerCase(keyName);
@ -1188,14 +1185,14 @@ gfxFcPlatformFontList::LookupLocalFont(const nsAString& aFontName,
return new gfxFontconfigFontEntry(aFontName, return new gfxFontconfigFontEntry(aFontName,
fontPattern, fontPattern,
aWeight, aStretch, aStyle); aWeight, aStretch, aItalic);
} }
gfxFontEntry* gfxFontEntry*
gfxFcPlatformFontList::MakePlatformFont(const nsAString& aFontName, gfxFcPlatformFontList::MakePlatformFont(const nsAString& aFontName,
uint16_t aWeight, uint16_t aWeight,
int16_t aStretch, int16_t aStretch,
uint8_t aStyle, bool aItalic,
const uint8_t* aFontData, const uint8_t* aFontData,
uint32_t aLength) uint32_t aLength)
{ {
@ -1213,8 +1210,8 @@ gfxFcPlatformFontList::MakePlatformFont(const nsAString& aFontName,
return nullptr; return nullptr;
} }
return new gfxFontconfigFontEntry(aFontName, aWeight, aStretch, return new gfxFontconfigFontEntry(aFontName, aWeight, aStretch, aItalic,
aStyle, aFontData, face); aFontData, face);
} }
gfxFontFamily* gfxFontFamily*

View File

@ -99,7 +99,7 @@ public:
explicit gfxFontconfigFontEntry(const nsAString& aFaceName, explicit gfxFontconfigFontEntry(const nsAString& aFaceName,
uint16_t aWeight, uint16_t aWeight,
int16_t aStretch, int16_t aStretch,
uint8_t aStyle, bool aItalic,
const uint8_t *aData, const uint8_t *aData,
FT_Face aFace); FT_Face aFace);
@ -108,7 +108,7 @@ public:
FcPattern* aFontPattern, FcPattern* aFontPattern,
uint16_t aWeight, uint16_t aWeight,
int16_t aStretch, int16_t aStretch,
uint8_t aStyle); bool aItalic);
FcPattern* GetPattern() { return mFontPattern; } FcPattern* GetPattern() { return mFontPattern; }
@ -209,12 +209,11 @@ public:
gfxFontEntry* gfxFontEntry*
LookupLocalFont(const nsAString& aFontName, uint16_t aWeight, LookupLocalFont(const nsAString& aFontName, uint16_t aWeight,
int16_t aStretch, uint8_t aStyle) override; int16_t aStretch, bool aItalic) override;
gfxFontEntry* gfxFontEntry*
MakePlatformFont(const nsAString& aFontName, uint16_t aWeight, MakePlatformFont(const nsAString& aFontName, uint16_t aWeight,
int16_t aStretch, int16_t aStretch, bool aItalic,
uint8_t aStyle,
const uint8_t* aFontData, const uint8_t* aFontData,
uint32_t aLength) override; uint32_t aLength) override;

View File

@ -2290,9 +2290,7 @@ gfxFont::Measure(gfxTextRun *aTextRun,
// If the font may be rendered with a fake-italic effect, we need to allow // If the font may be rendered with a fake-italic effect, we need to allow
// for the top-right of the glyphs being skewed to the right, and the // for the top-right of the glyphs being skewed to the right, and the
// bottom-left being skewed further left. // bottom-left being skewed further left.
if (mStyle.style != NS_FONT_STYLE_NORMAL && if (mStyle.style != NS_FONT_STYLE_NORMAL && !mFontEntry->IsItalic()) {
mFontEntry->IsUpright() &&
mStyle.allowSyntheticStyle) {
gfxFloat extendLeftEdge = gfxFloat extendLeftEdge =
ceil(OBLIQUE_SKEW_FACTOR * metrics.mBoundingBox.YMost()); ceil(OBLIQUE_SKEW_FACTOR * metrics.mBoundingBox.YMost());
gfxFloat extendRightEdge = gfxFloat extendRightEdge =

View File

@ -68,7 +68,7 @@ gfxCharacterMap::NotifyReleased()
} }
gfxFontEntry::gfxFontEntry() : gfxFontEntry::gfxFontEntry() :
mStyle(NS_FONT_STYLE_NORMAL), mFixedPitch(false), mItalic(false), mFixedPitch(false),
mIsValid(true), mIsValid(true),
mIsBadUnderlineFont(false), mIsBadUnderlineFont(false),
mIsUserFontContainer(false), mIsUserFontContainer(false),
@ -108,7 +108,7 @@ gfxFontEntry::gfxFontEntry() :
} }
gfxFontEntry::gfxFontEntry(const nsAString& aName, bool aIsStandardFace) : gfxFontEntry::gfxFontEntry(const nsAString& aName, bool aIsStandardFace) :
mName(aName), mStyle(NS_FONT_STYLE_NORMAL), mFixedPitch(false), mName(aName), mItalic(false), mFixedPitch(false),
mIsValid(true), mIsValid(true),
mIsBadUnderlineFont(false), mIsBadUnderlineFont(false),
mIsUserFontContainer(false), mIsUserFontContainer(false),
@ -1155,69 +1155,57 @@ gfxFontFamily::FindFontForStyle(const gfxFontStyle& aFontStyle,
return nullptr; return nullptr;
} }
#define STYLE_SHIFT 2 // number of bits to contain style distance
// style distance ==> [0,2]
static inline uint32_t static inline uint32_t
StyleDistance(uint32_t aFontStyle, uint32_t aTargetStyle) StyleStretchDistance(gfxFontEntry *aFontEntry, bool aTargetItalic,
int16_t aTargetStretch)
{ {
if (aFontStyle == aTargetStyle) { // Compute a measure of the "distance" between the requested style
return 0; // styles match exactly ==> 0 // and the given fontEntry,
} // considering italicness and font-stretch but not weight.
if (aFontStyle == NS_FONT_STYLE_NORMAL ||
aTargetStyle == NS_FONT_STYLE_NORMAL) {
return 2; // one is normal (but not the other) ==> 2
}
return 1; // neither is normal; must be italic vs oblique ==> 1
}
#define REVERSE_STRETCH_DISTANCE 5
// stretch distance ==> [0,13]
static inline uint32_t
StretchDistance(int16_t aFontStretch, int16_t aTargetStretch)
{
int32_t distance = 0; int32_t distance = 0;
if (aTargetStretch != aFontStretch) { if (aTargetStretch != aFontEntry->mStretch) {
// stretch values are in the range -4 .. +4 // stretch values are in the range -4 .. +4
// if aTargetStretch is positive, we prefer more-positive values; // if aTargetStretch is positive, we prefer more-positive values;
// if zero or negative, prefer more-negative // if zero or negative, prefer more-negative
if (aTargetStretch > 0) { if (aTargetStretch > 0) {
distance = (aFontStretch - aTargetStretch); distance = (aFontEntry->mStretch - aTargetStretch) * 2;
} else { } else {
distance = (aTargetStretch - aFontStretch); distance = (aTargetStretch - aFontEntry->mStretch) * 2;
} }
// if the computed "distance" here is negative, it means that // if the computed "distance" here is negative, it means that
// aFontEntry lies in the "non-preferred" direction from aTargetStretch, // aFontEntry lies in the "non-preferred" direction from aTargetStretch,
// so we treat that as larger than any preferred-direction distance // so we treat that as larger than any preferred-direction distance
// (max possible is 4) by adding an extra 5 to the absolute value // (max possible is 8) by adding an extra 10 to the absolute value
if (distance < 0) { if (distance < 0) {
distance = -distance + REVERSE_STRETCH_DISTANCE; distance = -distance + 10;
} }
} }
if (aFontEntry->IsItalic() != aTargetItalic) {
distance += 1;
}
return uint32_t(distance); return uint32_t(distance);
} }
#define NON_DESIRED_DIRECTION_DISTANCE 1000
#define MAX_WEIGHT_DISTANCE 2000
// CSS currently limits font weights to multiples of 100 but the weight // CSS currently limits font weights to multiples of 100 but the weight
// matching code below does not assume this. // matching code below does not assume this.
// //
// Calculate weight distance with values in the range (0..1000). In general, // Calculate weight values with range (0..1000). In general, heavier weights
// heavier weights match towards even heavier weights while lighter weights // match towards even heavier weights while lighter weights match towards even
// match towards even lighter weights. Target weight values in the range // lighter weights. Target weight values in the range [400..500] are special,
// [400..500] are special, since they will first match up to 500, then down // since they will first match up to 500, then down to 0, then up again
// towards 0, then up again towards 999. // towards 999.
// //
// Example: with target 600 and font weight 800, distance will be 200. With // Example: with target 600 and font weight 800, distance will be 200. With
// target 300 and font weight 600, distance will be 900, since heavier // target 300 and font weight 600, distance will be 1300, since heavier weights
// weights are farther away than lighter weights. If the target is 5 and the // are farther away than lighter weights. If the target is 5 and the font weight
// font weight 995, the distance would be 1590 for the same reason. // 995, the distance would be 1990 for the same reason.
#define REVERSE_WEIGHT_DISTANCE 600
#define WEIGHT_SHIFT 11 // number of bits to contain weight distance
// weight distance ==> [0,1598]
static inline uint32_t static inline uint32_t
WeightDistance(uint32_t aFontWeight, uint32_t aTargetWeight) WeightDistance(uint32_t aTargetWeight, uint32_t aFontWeight)
{ {
// Compute a measure of the "distance" between the requested // Compute a measure of the "distance" between the requested
// weight and the given fontEntry // weight and the given fontEntry
@ -1247,34 +1235,13 @@ WeightDistance(uint32_t aFontWeight, uint32_t aTargetWeight)
} }
} }
if (distance < 0) { if (distance < 0) {
distance = -distance + REVERSE_WEIGHT_DISTANCE; distance = -distance + NON_DESIRED_DIRECTION_DISTANCE;
} }
distance += addedDistance; distance += addedDistance;
} }
return uint32_t(distance); return uint32_t(distance);
} }
#define MAX_DISTANCE 0xffffffff
static inline uint32_t
WeightStyleStretchDistance(gfxFontEntry* aFontEntry,
const gfxFontStyle& aTargetStyle)
{
// weight/style/stretch priority: stretch >> style >> weight
uint32_t stretchDist =
StretchDistance(aFontEntry->mStretch, aTargetStyle.stretch);
uint32_t styleDist = StyleDistance(aFontEntry->mStyle, aTargetStyle.style);
uint32_t weightDist =
WeightDistance(aFontEntry->Weight(), aTargetStyle.weight);
NS_ASSERTION(weightDist < (1 << WEIGHT_SHIFT), "weight value out of bounds");
NS_ASSERTION(styleDist < (1 << STYLE_SHIFT), "slope value out of bounds");
return (stretchDist << (STYLE_SHIFT + WEIGHT_SHIFT)) |
(styleDist << WEIGHT_SHIFT) |
weightDist;
}
void void
gfxFontFamily::FindAllFontsForStyle(const gfxFontStyle& aFontStyle, gfxFontFamily::FindAllFontsForStyle(const gfxFontStyle& aFontStyle,
nsTArray<gfxFontEntry*>& aFontEntryList, nsTArray<gfxFontEntry*>& aFontEntryList,
@ -1304,6 +1271,9 @@ gfxFontFamily::FindAllFontsForStyle(const gfxFontStyle& aFontStyle,
return; return;
} }
bool wantItalic = (aFontStyle.style &
(NS_FONT_STYLE_ITALIC | NS_FONT_STYLE_OBLIQUE)) != 0;
// Most families are "simple", having just Regular/Bold/Italic/BoldItalic, // Most families are "simple", having just Regular/Bold/Italic/BoldItalic,
// or some subset of these. In this case, we have exactly 4 entries in mAvailableFonts, // or some subset of these. In this case, we have exactly 4 entries in mAvailableFonts,
// stored in the above order; note that some of the entries may be nullptr. // stored in the above order; note that some of the entries may be nullptr.
@ -1315,7 +1285,6 @@ gfxFontFamily::FindAllFontsForStyle(const gfxFontStyle& aFontStyle,
// Family has no more than the "standard" 4 faces, at fixed indexes; // Family has no more than the "standard" 4 faces, at fixed indexes;
// calculate which one we want. // calculate which one we want.
// Note that we cannot simply return it as not all 4 faces are necessarily present. // Note that we cannot simply return it as not all 4 faces are necessarily present.
bool wantItalic = (aFontStyle.style != NS_FONT_STYLE_NORMAL);
uint8_t faceIndex = (wantItalic ? kItalicMask : 0) | uint8_t faceIndex = (wantItalic ? kItalicMask : 0) |
(wantBold ? kBoldMask : 0); (wantBold ? kBoldMask : 0);
@ -1363,14 +1332,16 @@ gfxFontFamily::FindAllFontsForStyle(const gfxFontStyle& aFontStyle,
// weight/style/stretch combination, only the last matched font entry will // weight/style/stretch combination, only the last matched font entry will
// be added. // be added.
uint32_t minDistance = MAX_DISTANCE; uint32_t minDistance = 0xffffffff;
gfxFontEntry* matched = nullptr; gfxFontEntry* matched = nullptr;
// iterate in forward order so that faces like 'Bold' are matched before // iterate in forward order so that faces like 'Bold' are matched before
// matching style distance faces such as 'Bold Outline' (see bug 1185812) // matching style distance faces such as 'Bold Outline' (see bug 1185812)
for (uint32_t i = 0; i < count; i++) { for (uint32_t i = 0; i < count; i++) {
fe = mAvailableFonts[i]; fe = mAvailableFonts[i];
// weight/style/stretch priority: stretch >> style >> weight uint32_t distance =
uint32_t distance = WeightStyleStretchDistance(fe, aFontStyle); WeightDistance(aFontStyle.weight, fe->Weight()) +
(StyleStretchDistance(fe, wantItalic, aFontStyle.stretch) *
MAX_WEIGHT_DISTANCE);
if (distance < minDistance) { if (distance < minDistance) {
matched = fe; matched = fe;
if (!aFontEntryList.IsEmpty()) { if (!aFontEntryList.IsEmpty()) {
@ -1420,9 +1391,8 @@ gfxFontFamily::CheckForSimpleFamily()
gfxFontEntry *faces[4] = { 0 }; gfxFontEntry *faces[4] = { 0 };
for (uint8_t i = 0; i < count; ++i) { for (uint8_t i = 0; i < count; ++i) {
gfxFontEntry *fe = mAvailableFonts[i]; gfxFontEntry *fe = mAvailableFonts[i];
if (fe->Stretch() != firstStretch || fe->IsOblique()) { if (fe->Stretch() != firstStretch) {
// simple families don't have varying font-stretch or oblique return; // font-stretch doesn't match, don't treat as simple family
return;
} }
uint8_t faceIndex = (fe->IsItalic() ? kItalicMask : 0) | uint8_t faceIndex = (fe->IsItalic() ? kItalicMask : 0) |
(fe->Weight() >= 600 ? kBoldMask : 0); (fe->Weight() >= 600 ? kBoldMask : 0);
@ -1478,8 +1448,9 @@ CalcStyleMatch(gfxFontEntry *aFontEntry, const gfxFontStyle *aStyle)
int32_t rank = 0; int32_t rank = 0;
if (aStyle) { if (aStyle) {
// italics // italics
bool wantUpright = (aStyle->style == NS_FONT_STYLE_NORMAL); bool wantItalic =
if (aFontEntry->IsUpright() == wantUpright) { (aStyle->style & (NS_FONT_STYLE_ITALIC | NS_FONT_STYLE_OBLIQUE)) != 0;
if (aFontEntry->IsItalic() == wantItalic) {
rank += 10; rank += 10;
} }
@ -1487,7 +1458,7 @@ CalcStyleMatch(gfxFontEntry *aFontEntry, const gfxFontStyle *aStyle)
rank += 9 - DeprecatedAbs(aFontEntry->Weight() / 100 - aStyle->ComputeWeight()); rank += 9 - DeprecatedAbs(aFontEntry->Weight() / 100 - aStyle->ComputeWeight());
} else { } else {
// if no font to match, prefer non-bold, non-italic fonts // if no font to match, prefer non-bold, non-italic fonts
if (aFontEntry->IsUpright()) { if (!aFontEntry->IsItalic()) {
rank += 3; rank += 3;
} }
if (!aFontEntry->IsBold()) { if (!aFontEntry->IsBold()) {

View File

@ -8,7 +8,6 @@
#include "gfxTypes.h" #include "gfxTypes.h"
#include "nsString.h" #include "nsString.h"
#include "gfxFontConstants.h"
#include "gfxFontFeatures.h" #include "gfxFontFeatures.h"
#include "gfxFontUtils.h" #include "gfxFontUtils.h"
#include "nsTArray.h" #include "nsTArray.h"
@ -122,9 +121,7 @@ public:
bool IsUserFont() const { return mIsDataUserFont || mIsLocalUserFont; } bool IsUserFont() const { return mIsDataUserFont || mIsLocalUserFont; }
bool IsLocalUserFont() const { return mIsLocalUserFont; } bool IsLocalUserFont() const { return mIsLocalUserFont; }
bool IsFixedPitch() const { return mFixedPitch; } bool IsFixedPitch() const { return mFixedPitch; }
bool IsItalic() const { return mStyle == NS_FONT_STYLE_ITALIC; } bool IsItalic() const { return mItalic; }
bool IsOblique() const { return mStyle == NS_FONT_STYLE_OBLIQUE; }
bool IsUpright() const { return mStyle == NS_FONT_STYLE_NORMAL; }
bool IsBold() const { return mWeight >= 600; } // bold == weights 600 and above bool IsBold() const { return mWeight >= 600; } // bold == weights 600 and above
bool IgnoreGDEF() const { return mIgnoreGDEF; } bool IgnoreGDEF() const { return mIgnoreGDEF; }
bool IgnoreGSUB() const { return mIgnoreGSUB; } bool IgnoreGSUB() const { return mIgnoreGSUB; }
@ -391,7 +388,7 @@ public:
nsString mName; nsString mName;
nsString mFamilyName; nsString mFamilyName;
uint8_t mStyle : 2; // italic/oblique bool mItalic : 1;
bool mFixedPitch : 1; bool mFixedPitch : 1;
bool mIsValid : 1; bool mIsValid : 1;
bool mIsBadUnderlineFont : 1; bool mIsBadUnderlineFont : 1;

View File

@ -335,10 +335,10 @@ protected:
explicit gfxUserFcFontEntry(const nsAString& aFontName, explicit gfxUserFcFontEntry(const nsAString& aFontName,
uint16_t aWeight, uint16_t aWeight,
int16_t aStretch, int16_t aStretch,
uint8_t aStyle) bool aItalic)
: gfxFcFontEntry(aFontName) : gfxFcFontEntry(aFontName)
{ {
mStyle = aStyle; mItalic = aItalic;
mWeight = aWeight; mWeight = aWeight;
mStretch = aStretch; mStretch = aStretch;
} }
@ -421,9 +421,9 @@ public:
gfxLocalFcFontEntry(const nsAString& aFontName, gfxLocalFcFontEntry(const nsAString& aFontName,
uint16_t aWeight, uint16_t aWeight,
int16_t aStretch, int16_t aStretch,
uint8_t aStyle, bool aItalic,
const nsTArray< nsCountedRef<FcPattern> >& aPatterns) const nsTArray< nsCountedRef<FcPattern> >& aPatterns)
: gfxUserFcFontEntry(aFontName, aWeight, aStretch, aStyle) : gfxUserFcFontEntry(aFontName, aWeight, aStretch, aItalic)
{ {
if (!mPatterns.SetCapacity(aPatterns.Length(), fallible)) if (!mPatterns.SetCapacity(aPatterns.Length(), fallible))
return; // OOM return; // OOM
@ -458,9 +458,9 @@ public:
gfxDownloadedFcFontEntry(const nsAString& aFontName, gfxDownloadedFcFontEntry(const nsAString& aFontName,
uint16_t aWeight, uint16_t aWeight,
int16_t aStretch, int16_t aStretch,
uint8_t aStyle, bool aItalic,
const uint8_t *aData, FT_Face aFace) const uint8_t *aData, FT_Face aFace)
: gfxUserFcFontEntry(aFontName, aWeight, aStretch, aStyle), : gfxUserFcFontEntry(aFontName, aWeight, aStretch, aItalic),
mFontData(aData), mFace(aFace) mFontData(aData), mFace(aFace)
{ {
NS_PRECONDITION(aFace != nullptr, "aFace is NULL!"); NS_PRECONDITION(aFace != nullptr, "aFace is NULL!");
@ -1748,7 +1748,7 @@ gfxPangoFontGroup::Shutdown()
gfxPangoFontGroup::NewFontEntry(const nsAString& aFontName, gfxPangoFontGroup::NewFontEntry(const nsAString& aFontName,
uint16_t aWeight, uint16_t aWeight,
int16_t aStretch, int16_t aStretch,
uint8_t aStyle) bool aItalic)
{ {
gfxFontconfigUtils *utils = gfxFontconfigUtils::GetFontconfigUtils(); gfxFontconfigUtils *utils = gfxFontconfigUtils::GetFontconfigUtils();
if (!utils) if (!utils)
@ -1791,7 +1791,7 @@ gfxPangoFontGroup::NewFontEntry(const nsAString& aFontName,
return new gfxLocalFcFontEntry(aFontName, return new gfxLocalFcFontEntry(aFontName,
aWeight, aWeight,
aStretch, aStretch,
aStyle, aItalic,
fonts); fonts);
} }
@ -1833,7 +1833,7 @@ gfxPangoFontGroup::GetFTLibrary()
gfxPangoFontGroup::NewFontEntry(const nsAString& aFontName, gfxPangoFontGroup::NewFontEntry(const nsAString& aFontName,
uint16_t aWeight, uint16_t aWeight,
int16_t aStretch, int16_t aStretch,
uint8_t aStyle, bool aItalic,
const uint8_t* aFontData, const uint8_t* aFontData,
uint32_t aLength) uint32_t aLength)
{ {
@ -1851,7 +1851,7 @@ gfxPangoFontGroup::NewFontEntry(const nsAString& aFontName,
} }
return new gfxDownloadedFcFontEntry(aFontName, aWeight, return new gfxDownloadedFcFontEntry(aFontName, aWeight,
aStretch, aStyle, aStretch, aItalic,
aFontData, face); aFontData, face);
} }

View File

@ -45,12 +45,12 @@ public:
static gfxFontEntry *NewFontEntry(const nsAString& aFontName, static gfxFontEntry *NewFontEntry(const nsAString& aFontName,
uint16_t aWeight, uint16_t aWeight,
int16_t aStretch, int16_t aStretch,
uint8_t aStyle); bool aItalic);
// Used for @font-face { src: url(); } // Used for @font-face { src: url(); }
static gfxFontEntry *NewFontEntry(const nsAString& aFontName, static gfxFontEntry *NewFontEntry(const nsAString& aFontName,
uint16_t aWeight, uint16_t aWeight,
int16_t aStretch, int16_t aStretch,
uint8_t aStyle, bool aItalic,
const uint8_t* aFontData, const uint8_t* aFontData,
uint32_t aLength); uint32_t aLength);

View File

@ -177,8 +177,9 @@ gfxGDIFont::Initialize()
// Figure out if we want to do synthetic oblique styling. // Figure out if we want to do synthetic oblique styling.
GDIFontEntry* fe = static_cast<GDIFontEntry*>(GetFontEntry()); GDIFontEntry* fe = static_cast<GDIFontEntry*>(GetFontEntry());
bool wantFakeItalic = mStyle.style != NS_FONT_STYLE_NORMAL && bool wantFakeItalic =
fe->IsUpright() && mStyle.allowSyntheticStyle; (mStyle.style & (NS_FONT_STYLE_ITALIC | NS_FONT_STYLE_OBLIQUE)) &&
!fe->IsItalic() && mStyle.allowSyntheticStyle;
// If the font's family has an actual italic face (but font matching // If the font's family has an actual italic face (but font matching
// didn't choose it), we have to use a cairo transform instead of asking // didn't choose it), we have to use a cairo transform instead of asking

View File

@ -118,8 +118,7 @@ FontTypeToOutPrecision(uint8_t fontType)
GDIFontEntry::GDIFontEntry(const nsAString& aFaceName, GDIFontEntry::GDIFontEntry(const nsAString& aFaceName,
gfxWindowsFontType aFontType, gfxWindowsFontType aFontType,
uint8_t aStyle, uint16_t aWeight, bool aItalic, uint16_t aWeight, int16_t aStretch,
int16_t aStretch,
gfxUserFontData *aUserFontData, gfxUserFontData *aUserFontData,
bool aFamilyHasItalicFace) bool aFamilyHasItalicFace)
: gfxFontEntry(aFaceName), : gfxFontEntry(aFaceName),
@ -130,7 +129,7 @@ GDIFontEntry::GDIFontEntry(const nsAString& aFaceName,
mCharset(), mUnicodeRanges() mCharset(), mUnicodeRanges()
{ {
mUserFontData = aUserFontData; mUserFontData = aUserFontData;
mStyle = aStyle; mItalic = aItalic;
mWeight = aWeight; mWeight = aWeight;
mStretch = aStretch; mStretch = aStretch;
if (IsType1()) if (IsType1())
@ -307,10 +306,9 @@ GDIFontEntry::TestCharacterMap(uint32_t aCh)
return false; return false;
// previous code was using the group style // previous code was using the group style
gfxFontStyle fakeStyle; gfxFontStyle fakeStyle;
if (!IsUpright()) { if (mItalic)
fakeStyle.style = NS_FONT_STYLE_ITALIC; fakeStyle.style = NS_FONT_STYLE_ITALIC;
}
fakeStyle.weight = mWeight * 100; fakeStyle.weight = mWeight * 100;
RefPtr<gfxFont> tempFont = FindOrMakeFont(&fakeStyle, false); RefPtr<gfxFont> tempFont = FindOrMakeFont(&fakeStyle, false);
@ -389,7 +387,7 @@ GDIFontEntry::InitLogFont(const nsAString& aName,
// do its best to give us an italic font entry, but if no face exists // do its best to give us an italic font entry, but if no face exists
// it may give us a regular one based on weight. Windows should // it may give us a regular one based on weight. Windows should
// do fake italic for us in that case. // do fake italic for us in that case.
mLogFont.lfItalic = !IsUpright(); mLogFont.lfItalic = mItalic;
mLogFont.lfWeight = mWeight; mLogFont.lfWeight = mWeight;
int len = std::min<int>(aName.Length(), LF_FACESIZE - 1); int len = std::min<int>(aName.Length(), LF_FACESIZE - 1);
@ -399,15 +397,14 @@ GDIFontEntry::InitLogFont(const nsAString& aName,
GDIFontEntry* GDIFontEntry*
GDIFontEntry::CreateFontEntry(const nsAString& aName, GDIFontEntry::CreateFontEntry(const nsAString& aName,
gfxWindowsFontType aFontType, gfxWindowsFontType aFontType, bool aItalic,
uint8_t aStyle,
uint16_t aWeight, int16_t aStretch, uint16_t aWeight, int16_t aStretch,
gfxUserFontData* aUserFontData, gfxUserFontData* aUserFontData,
bool aFamilyHasItalicFace) bool aFamilyHasItalicFace)
{ {
// jtdfix - need to set charset, unicode ranges, pitch/family // jtdfix - need to set charset, unicode ranges, pitch/family
GDIFontEntry *fe = new GDIFontEntry(aName, aFontType, aStyle, GDIFontEntry *fe = new GDIFontEntry(aName, aFontType, aItalic,
aWeight, aStretch, aUserFontData, aWeight, aStretch, aUserFontData,
aFamilyHasItalicFace); aFamilyHasItalicFace);
@ -459,7 +456,7 @@ GDIFontFamily::FamilyAddStylesProc(const ENUMLOGFONTEXW *lpelfe,
fe = static_cast<GDIFontEntry*>(ff->mAvailableFonts[i].get()); fe = static_cast<GDIFontEntry*>(ff->mAvailableFonts[i].get());
// check if we already know about this face // check if we already know about this face
if (fe->mWeight == logFont.lfWeight && if (fe->mWeight == logFont.lfWeight &&
fe->IsItalic() == (logFont.lfItalic == 0xFF)) { fe->mItalic == (logFont.lfItalic == 0xFF)) {
// update the charset bit here since this could be different // update the charset bit here since this could be different
fe->mCharset.set(metrics.tmCharSet); fe->mCharset.set(metrics.tmCharSet);
return 1; return 1;
@ -469,10 +466,8 @@ GDIFontFamily::FamilyAddStylesProc(const ENUMLOGFONTEXW *lpelfe,
// We can't set the hasItalicFace flag correctly here, // We can't set the hasItalicFace flag correctly here,
// because we might not have seen the family's italic face(s) yet. // because we might not have seen the family's italic face(s) yet.
// So we'll set that flag for all members after loading all the faces. // So we'll set that flag for all members after loading all the faces.
uint8_t italicStyle = (logFont.lfItalic == 0xFF ?
NS_FONT_STYLE_ITALIC : NS_FONT_STYLE_NORMAL);
fe = GDIFontEntry::CreateFontEntry(nsDependentString(lpelfe->elfFullName), fe = GDIFontEntry::CreateFontEntry(nsDependentString(lpelfe->elfFullName),
feType, italicStyle, feType, (logFont.lfItalic == 0xFF),
(uint16_t) (logFont.lfWeight), 0, (uint16_t) (logFont.lfWeight), 0,
nullptr, false); nullptr, false);
if (!fe) if (!fe)
@ -717,7 +712,7 @@ gfxFontEntry*
gfxGDIFontList::LookupLocalFont(const nsAString& aFontName, gfxGDIFontList::LookupLocalFont(const nsAString& aFontName,
uint16_t aWeight, uint16_t aWeight,
int16_t aStretch, int16_t aStretch,
uint8_t aStyle) bool aItalic)
{ {
gfxFontEntry *lookup; gfxFontEntry *lookup;
@ -734,9 +729,10 @@ gfxGDIFontList::LookupLocalFont(const nsAString& aFontName,
// 'Arial Vet' which can be used as a key in GDI font lookups). // 'Arial Vet' which can be used as a key in GDI font lookups).
GDIFontEntry *fe = GDIFontEntry::CreateFontEntry(lookup->Name(), GDIFontEntry *fe = GDIFontEntry::CreateFontEntry(lookup->Name(),
gfxWindowsFontType(isCFF ? GFX_FONT_TYPE_PS_OPENTYPE : GFX_FONT_TYPE_TRUETYPE) /*type*/, gfxWindowsFontType(isCFF ? GFX_FONT_TYPE_PS_OPENTYPE : GFX_FONT_TYPE_TRUETYPE) /*type*/,
lookup->mStyle, lookup->mWeight, aStretch, nullptr, lookup->mItalic ? NS_FONT_STYLE_ITALIC : NS_FONT_STYLE_NORMAL,
lookup->mWeight, aStretch, nullptr,
static_cast<GDIFontEntry*>(lookup)->mFamilyHasItalicFace); static_cast<GDIFontEntry*>(lookup)->mFamilyHasItalicFace);
if (!fe) if (!fe)
return nullptr; return nullptr;
@ -744,7 +740,7 @@ gfxGDIFontList::LookupLocalFont(const nsAString& aFontName,
// make the new font entry match the userfont entry style characteristics // make the new font entry match the userfont entry style characteristics
fe->mWeight = (aWeight == 0 ? 400 : aWeight); fe->mWeight = (aWeight == 0 ? 400 : aWeight);
fe->mStyle = aStyle; fe->mItalic = aItalic;
return fe; return fe;
} }
@ -753,7 +749,7 @@ gfxFontEntry*
gfxGDIFontList::MakePlatformFont(const nsAString& aFontName, gfxGDIFontList::MakePlatformFont(const nsAString& aFontName,
uint16_t aWeight, uint16_t aWeight,
int16_t aStretch, int16_t aStretch,
uint8_t aStyle, bool aItalic,
const uint8_t* aFontData, const uint8_t* aFontData,
uint32_t aLength) uint32_t aLength)
{ {
@ -812,16 +808,17 @@ gfxGDIFontList::MakePlatformFont(const nsAString& aFontName,
WinUserFontData *winUserFontData = new WinUserFontData(fontRef); WinUserFontData *winUserFontData = new WinUserFontData(fontRef);
uint16_t w = (aWeight == 0 ? 400 : aWeight); uint16_t w = (aWeight == 0 ? 400 : aWeight);
GDIFontEntry *fe = GDIFontEntry::CreateFontEntry(uniqueName, GDIFontEntry *fe = GDIFontEntry::CreateFontEntry(uniqueName,
gfxWindowsFontType(isCFF ? GFX_FONT_TYPE_PS_OPENTYPE : GFX_FONT_TYPE_TRUETYPE) /*type*/, gfxWindowsFontType(isCFF ? GFX_FONT_TYPE_PS_OPENTYPE : GFX_FONT_TYPE_TRUETYPE) /*type*/,
aStyle, w, aStretch, winUserFontData, false); uint32_t(aItalic ? NS_FONT_STYLE_ITALIC : NS_FONT_STYLE_NORMAL),
w, aStretch, winUserFontData, false);
if (!fe) if (!fe)
return fe; return fe;
fe->mIsDataUserFont = true; fe->mIsDataUserFont = true;
// Uniscribe doesn't place CFF fonts loaded privately // Uniscribe doesn't place CFF fonts loaded privately
// via AddFontMemResourceEx on XP/Vista // via AddFontMemResourceEx on XP/Vista
if (isCFF && !IsWin7OrLater()) { if (isCFF && !IsWin7OrLater()) {
fe->mForceGDI = true; fe->mForceGDI = true;

View File

@ -236,7 +236,7 @@ public:
// create a font entry for a font with a given name // create a font entry for a font with a given name
static GDIFontEntry* CreateFontEntry(const nsAString& aName, static GDIFontEntry* CreateFontEntry(const nsAString& aName,
gfxWindowsFontType aFontType, gfxWindowsFontType aFontType,
uint8_t aStyle, bool aItalic,
uint16_t aWeight, int16_t aStretch, uint16_t aWeight, int16_t aStretch,
gfxUserFontData* aUserFontData, gfxUserFontData* aUserFontData,
bool aFamilyHasItalicFace); bool aFamilyHasItalicFace);
@ -245,7 +245,7 @@ public:
static GDIFontEntry* LoadLocalFont(const nsAString& aFontName, static GDIFontEntry* LoadLocalFont(const nsAString& aFontName,
uint16_t aWeight, uint16_t aWeight,
int16_t aStretch, int16_t aStretch,
uint8_t aStyle); bool aItalic);
uint8_t mWindowsFamily; uint8_t mWindowsFamily;
uint8_t mWindowsPitch; uint8_t mWindowsPitch;
@ -266,7 +266,7 @@ protected:
friend class gfxWindowsFont; friend class gfxWindowsFont;
GDIFontEntry(const nsAString& aFaceName, gfxWindowsFontType aFontType, GDIFontEntry(const nsAString& aFaceName, gfxWindowsFontType aFontType,
uint8_t aStyle, uint16_t aWeight, int16_t aStretch, bool aItalic, uint16_t aWeight, int16_t aStretch,
gfxUserFontData *aUserFontData, bool aFamilyHasItalicFace); gfxUserFontData *aUserFontData, bool aFamilyHasItalicFace);
void InitLogFont(const nsAString& aName, gfxWindowsFontType aFontType); void InitLogFont(const nsAString& aName, gfxWindowsFontType aFontType);
@ -311,12 +311,12 @@ public:
virtual gfxFontEntry* LookupLocalFont(const nsAString& aFontName, virtual gfxFontEntry* LookupLocalFont(const nsAString& aFontName,
uint16_t aWeight, uint16_t aWeight,
int16_t aStretch, int16_t aStretch,
uint8_t aStyle); bool aItalic);
virtual gfxFontEntry* MakePlatformFont(const nsAString& aFontName, virtual gfxFontEntry* MakePlatformFont(const nsAString& aFontName,
uint16_t aWeight, uint16_t aWeight,
int16_t aStretch, int16_t aStretch,
uint8_t aStyle, bool aItalic,
const uint8_t* aFontData, const uint8_t* aFontData,
uint32_t aLength); uint32_t aLength);

View File

@ -61,10 +61,11 @@ gfxMacFont::gfxMacFont(MacOSFontEntry *aFontEntry, const gfxFontStyle *aFontStyl
cairo_matrix_init_scale(&sizeMatrix, mAdjustedSize, mAdjustedSize); cairo_matrix_init_scale(&sizeMatrix, mAdjustedSize, mAdjustedSize);
// synthetic oblique by skewing via the font matrix // synthetic oblique by skewing via the font matrix
bool needsOblique = mFontEntry != nullptr && bool needsOblique =
mFontEntry->IsUpright() && (mFontEntry != nullptr) &&
mStyle.style != NS_FONT_STYLE_NORMAL && (!mFontEntry->IsItalic() &&
mStyle.allowSyntheticStyle; (mStyle.style & (NS_FONT_STYLE_ITALIC | NS_FONT_STYLE_OBLIQUE))) &&
mStyle.allowSyntheticStyle;
if (needsOblique) { if (needsOblique) {
cairo_matrix_t style; cairo_matrix_t style;

View File

@ -33,7 +33,7 @@ public:
// for use with data fonts // for use with data fonts
MacOSFontEntry(const nsAString& aPostscriptName, CGFontRef aFontRef, MacOSFontEntry(const nsAString& aPostscriptName, CGFontRef aFontRef,
uint16_t aWeight, uint16_t aStretch, uint8_t aStyle, uint16_t aWeight, uint16_t aStretch, uint32_t aItalicStyle,
bool aIsDataUserFont, bool aIsLocal); bool aIsDataUserFont, bool aIsLocal);
virtual ~MacOSFontEntry() { virtual ~MacOSFontEntry() {
@ -86,12 +86,12 @@ public:
gfxFontEntry* LookupLocalFont(const nsAString& aFontName, gfxFontEntry* LookupLocalFont(const nsAString& aFontName,
uint16_t aWeight, uint16_t aWeight,
int16_t aStretch, int16_t aStretch,
uint8_t aStyle) override; bool aItalic) override;
gfxFontEntry* MakePlatformFont(const nsAString& aFontName, gfxFontEntry* MakePlatformFont(const nsAString& aFontName,
uint16_t aWeight, uint16_t aWeight,
int16_t aStretch, int16_t aStretch,
uint8_t aStyle, bool aItalic,
const uint8_t* aFontData, const uint8_t* aFontData,
uint32_t aLength) override; uint32_t aLength) override;

View File

@ -268,7 +268,7 @@ MacOSFontEntry::MacOSFontEntry(const nsAString& aPostscriptName,
MacOSFontEntry::MacOSFontEntry(const nsAString& aPostscriptName, MacOSFontEntry::MacOSFontEntry(const nsAString& aPostscriptName,
CGFontRef aFontRef, CGFontRef aFontRef,
uint16_t aWeight, uint16_t aStretch, uint16_t aWeight, uint16_t aStretch,
uint8_t aStyle, uint32_t aItalicStyle,
bool aIsDataUserFont, bool aIsDataUserFont,
bool aIsLocalUserFont) bool aIsLocalUserFont)
: gfxFontEntry(aPostscriptName, false), : gfxFontEntry(aPostscriptName, false),
@ -285,7 +285,7 @@ MacOSFontEntry::MacOSFontEntry(const nsAString& aPostscriptName,
mWeight = aWeight; mWeight = aWeight;
mStretch = aStretch; mStretch = aStretch;
mFixedPitch = false; // xxx - do we need this for downloaded fonts? mFixedPitch = false; // xxx - do we need this for downloaded fonts?
mStyle = aStyle; mItalic = (aItalicStyle & (NS_FONT_STYLE_ITALIC | NS_FONT_STYLE_OBLIQUE)) != 0;
NS_ASSERTION(!(aIsDataUserFont && aIsLocalUserFont), NS_ASSERTION(!(aIsDataUserFont && aIsLocalUserFont),
"userfont is either a data font or a local font"); "userfont is either a data font or a local font");
@ -523,7 +523,7 @@ gfxMacFontFamily::FindStyleVariations(FontInfoData *aFontInfoData)
[facename hasSuffix:@"Italic"] || [facename hasSuffix:@"Italic"] ||
[facename hasSuffix:@"Oblique"]) [facename hasSuffix:@"Oblique"])
{ {
fontEntry->mStyle = NS_FONT_STYLE_ITALIC; fontEntry->mItalic = true;
} }
if (macTraits & NSFixedPitchFontMask) { if (macTraits & NSFixedPitchFontMask) {
fontEntry->mFixedPitch = true; fontEntry->mFixedPitch = true;
@ -1009,7 +1009,7 @@ gfxFontEntry*
gfxMacPlatformFontList::LookupLocalFont(const nsAString& aFontName, gfxMacPlatformFontList::LookupLocalFont(const nsAString& aFontName,
uint16_t aWeight, uint16_t aWeight,
int16_t aStretch, int16_t aStretch,
uint8_t aStyle) bool aItalic)
{ {
nsAutoreleasePool localPool; nsAutoreleasePool localPool;
@ -1026,7 +1026,10 @@ gfxMacPlatformFontList::LookupLocalFont(const nsAString& aFontName,
"bogus font weight value!"); "bogus font weight value!");
newFontEntry = newFontEntry =
new MacOSFontEntry(aFontName, fontRef, aWeight, aStretch, aStyle, new MacOSFontEntry(aFontName, fontRef,
aWeight, aStretch,
aItalic ?
NS_FONT_STYLE_ITALIC : NS_FONT_STYLE_NORMAL,
false, true); false, true);
::CFRelease(fontRef); ::CFRelease(fontRef);
@ -1042,7 +1045,7 @@ gfxFontEntry*
gfxMacPlatformFontList::MakePlatformFont(const nsAString& aFontName, gfxMacPlatformFontList::MakePlatformFont(const nsAString& aFontName,
uint16_t aWeight, uint16_t aWeight,
int16_t aStretch, int16_t aStretch,
uint8_t aStyle, bool aItalic,
const uint8_t* aFontData, const uint8_t* aFontData,
uint32_t aLength) uint32_t aLength)
{ {
@ -1070,7 +1073,11 @@ gfxMacPlatformFontList::MakePlatformFont(const nsAString& aFontName,
nsAutoPtr<MacOSFontEntry> nsAutoPtr<MacOSFontEntry>
newFontEntry(new MacOSFontEntry(uniqueName, fontRef, aWeight, newFontEntry(new MacOSFontEntry(uniqueName, fontRef, aWeight,
aStretch, aStyle, true, false)); aStretch,
aItalic ?
NS_FONT_STYLE_ITALIC :
NS_FONT_STYLE_NORMAL,
true, false));
::CFRelease(fontRef); ::CFRelease(fontRef);
// if succeeded and font cmap is good, return the new font // if succeeded and font cmap is good, return the new font

View File

@ -1376,7 +1376,7 @@ gfxFontEntry*
gfxPlatform::MakePlatformFont(const nsAString& aFontName, gfxPlatform::MakePlatformFont(const nsAString& aFontName,
uint16_t aWeight, uint16_t aWeight,
int16_t aStretch, int16_t aStretch,
uint8_t aStyle, bool aItalic,
const uint8_t* aFontData, const uint8_t* aFontData,
uint32_t aLength) uint32_t aLength)
{ {

View File

@ -348,7 +348,7 @@ public:
virtual gfxFontEntry* LookupLocalFont(const nsAString& aFontName, virtual gfxFontEntry* LookupLocalFont(const nsAString& aFontName,
uint16_t aWeight, uint16_t aWeight,
int16_t aStretch, int16_t aStretch,
uint8_t aStyle) bool aItalic)
{ return nullptr; } { return nullptr; }
/** /**
@ -362,7 +362,7 @@ public:
virtual gfxFontEntry* MakePlatformFont(const nsAString& aFontName, virtual gfxFontEntry* MakePlatformFont(const nsAString& aFontName,
uint16_t aWeight, uint16_t aWeight,
int16_t aStretch, int16_t aStretch,
uint8_t aStyle, bool aItalic,
const uint8_t* aFontData, const uint8_t* aFontData,
uint32_t aLength); uint32_t aLength);

View File

@ -153,14 +153,14 @@ public:
virtual gfxFontEntry* LookupLocalFont(const nsAString& aFontName, virtual gfxFontEntry* LookupLocalFont(const nsAString& aFontName,
uint16_t aWeight, uint16_t aWeight,
int16_t aStretch, int16_t aStretch,
uint8_t aStyle) = 0; bool aItalic) = 0;
// create a new platform font from downloaded data (@font-face) // create a new platform font from downloaded data (@font-face)
// this method is responsible to ensure aFontData is free()'d // this method is responsible to ensure aFontData is free()'d
virtual gfxFontEntry* MakePlatformFont(const nsAString& aFontName, virtual gfxFontEntry* MakePlatformFont(const nsAString& aFontName,
uint16_t aWeight, uint16_t aWeight,
int16_t aStretch, int16_t aStretch,
uint8_t aStyle, bool aItalic,
const uint8_t* aFontData, const uint8_t* aFontData,
uint32_t aLength) = 0; uint32_t aLength) = 0;

View File

@ -256,35 +256,34 @@ gfxFontEntry*
gfxPlatformGtk::LookupLocalFont(const nsAString& aFontName, gfxPlatformGtk::LookupLocalFont(const nsAString& aFontName,
uint16_t aWeight, uint16_t aWeight,
int16_t aStretch, int16_t aStretch,
uint8_t aStyle) bool aItalic)
{ {
if (sUseFcFontList) { if (sUseFcFontList) {
gfxPlatformFontList* pfl = gfxPlatformFontList::PlatformFontList(); gfxPlatformFontList* pfl = gfxPlatformFontList::PlatformFontList();
return pfl->LookupLocalFont(aFontName, aWeight, aStretch, return pfl->LookupLocalFont(aFontName, aWeight, aStretch, aItalic);
aStyle);
} }
return gfxPangoFontGroup::NewFontEntry(aFontName, aWeight, return gfxPangoFontGroup::NewFontEntry(aFontName, aWeight,
aStretch, aStyle); aStretch, aItalic);
} }
gfxFontEntry* gfxFontEntry*
gfxPlatformGtk::MakePlatformFont(const nsAString& aFontName, gfxPlatformGtk::MakePlatformFont(const nsAString& aFontName,
uint16_t aWeight, uint16_t aWeight,
int16_t aStretch, int16_t aStretch,
uint8_t aStyle, bool aItalic,
const uint8_t* aFontData, const uint8_t* aFontData,
uint32_t aLength) uint32_t aLength)
{ {
if (sUseFcFontList) { if (sUseFcFontList) {
gfxPlatformFontList* pfl = gfxPlatformFontList::PlatformFontList(); gfxPlatformFontList* pfl = gfxPlatformFontList::PlatformFontList();
return pfl->MakePlatformFont(aFontName, aWeight, aStretch, return pfl->MakePlatformFont(aFontName, aWeight, aStretch, aItalic,
aStyle, aFontData, aLength); aFontData, aLength);
} }
// passing ownership of the font data to the new font entry // passing ownership of the font data to the new font entry
return gfxPangoFontGroup::NewFontEntry(aFontName, aWeight, return gfxPangoFontGroup::NewFontEntry(aFontName, aWeight,
aStretch, aStyle, aStretch, aItalic,
aFontData, aLength); aFontData, aLength);
} }

View File

@ -63,7 +63,7 @@ public:
virtual gfxFontEntry* LookupLocalFont(const nsAString& aFontName, virtual gfxFontEntry* LookupLocalFont(const nsAString& aFontName,
uint16_t aWeight, uint16_t aWeight,
int16_t aStretch, int16_t aStretch,
uint8_t aStyle) override; bool aItalic) override;
/** /**
* Activate a platform font (needed to support @font-face src url() ) * Activate a platform font (needed to support @font-face src url() )
@ -72,7 +72,7 @@ public:
virtual gfxFontEntry* MakePlatformFont(const nsAString& aFontName, virtual gfxFontEntry* MakePlatformFont(const nsAString& aFontName,
uint16_t aWeight, uint16_t aWeight,
int16_t aStretch, int16_t aStretch,
uint8_t aStyle, bool aItalic,
const uint8_t* aFontData, const uint8_t* aFontData,
uint32_t aLength) override; uint32_t aLength) override;

View File

@ -152,19 +152,19 @@ gfxFontEntry*
gfxPlatformMac::LookupLocalFont(const nsAString& aFontName, gfxPlatformMac::LookupLocalFont(const nsAString& aFontName,
uint16_t aWeight, uint16_t aWeight,
int16_t aStretch, int16_t aStretch,
uint8_t aStyle) bool aItalic)
{ {
return gfxPlatformFontList::PlatformFontList()->LookupLocalFont(aFontName, return gfxPlatformFontList::PlatformFontList()->LookupLocalFont(aFontName,
aWeight, aWeight,
aStretch, aStretch,
aStyle); aItalic);
} }
gfxFontEntry* gfxFontEntry*
gfxPlatformMac::MakePlatformFont(const nsAString& aFontName, gfxPlatformMac::MakePlatformFont(const nsAString& aFontName,
uint16_t aWeight, uint16_t aWeight,
int16_t aStretch, int16_t aStretch,
uint8_t aStyle, bool aItalic,
const uint8_t* aFontData, const uint8_t* aFontData,
uint32_t aLength) uint32_t aLength)
{ {
@ -174,7 +174,7 @@ gfxPlatformMac::MakePlatformFont(const nsAString& aFontName,
return gfxPlatformFontList::PlatformFontList()->MakePlatformFont(aFontName, return gfxPlatformFontList::PlatformFontList()->MakePlatformFont(aFontName,
aWeight, aWeight,
aStretch, aStretch,
aStyle, aItalic,
aFontData, aFontData,
aLength); aLength);
} }

View File

@ -44,14 +44,14 @@ public:
virtual gfxFontEntry* LookupLocalFont(const nsAString& aFontName, virtual gfxFontEntry* LookupLocalFont(const nsAString& aFontName,
uint16_t aWeight, uint16_t aWeight,
int16_t aStretch, int16_t aStretch,
uint8_t aStyle) override; bool aItalic) override;
virtual gfxPlatformFontList* CreatePlatformFontList() override; virtual gfxPlatformFontList* CreatePlatformFontList() override;
virtual gfxFontEntry* MakePlatformFont(const nsAString& aFontName, virtual gfxFontEntry* MakePlatformFont(const nsAString& aFontName,
uint16_t aWeight, uint16_t aWeight,
int16_t aStretch, int16_t aStretch,
uint8_t aStyle, bool aItalic,
const uint8_t* aFontData, const uint8_t* aFontData,
uint32_t aLength) override; uint32_t aLength) override;

View File

@ -132,23 +132,23 @@ gfxFontEntry*
gfxQtPlatform::LookupLocalFont(const nsAString& aFontName, gfxQtPlatform::LookupLocalFont(const nsAString& aFontName,
uint16_t aWeight, uint16_t aWeight,
int16_t aStretch, int16_t aStretch,
uint8_t aStyle) bool aItalic)
{ {
return gfxPangoFontGroup::NewFontEntry(aFontName, aWeight, return gfxPangoFontGroup::NewFontEntry(aFontName, aWeight,
aStretch, aStyle); aStretch, aItalic);
} }
gfxFontEntry* gfxFontEntry*
gfxQtPlatform::MakePlatformFont(const nsAString& aFontName, gfxQtPlatform::MakePlatformFont(const nsAString& aFontName,
uint16_t aWeight, uint16_t aWeight,
int16_t aStretch, int16_t aStretch,
uint8_t aStyle, bool aItalic,
const uint8_t* aFontData, const uint8_t* aFontData,
uint32_t aLength) uint32_t aLength)
{ {
// passing ownership of the font data to the new font entry // passing ownership of the font data to the new font entry
return gfxPangoFontGroup::NewFontEntry(aFontName, aWeight, return gfxPangoFontGroup::NewFontEntry(aFontName, aWeight,
aStretch, aStyle, aStretch, aItalic,
aFontData, aLength); aFontData, aLength);
} }

View File

@ -54,7 +54,7 @@ public:
virtual gfxFontEntry* LookupLocalFont(const nsAString& aFontName, virtual gfxFontEntry* LookupLocalFont(const nsAString& aFontName,
uint16_t aWeight, uint16_t aWeight,
int16_t aStretch, int16_t aStretch,
uint8_t aStyle) override; bool aItalic) override;
/** /**
* Activate a platform font (needed to support @font-face src url() ) * Activate a platform font (needed to support @font-face src url() )
@ -63,7 +63,7 @@ public:
virtual gfxFontEntry* MakePlatformFont(const nsAString& aFontName, virtual gfxFontEntry* MakePlatformFont(const nsAString& aFontName,
uint16_t aWeight, uint16_t aWeight,
int16_t aStretch, int16_t aStretch,
uint8_t aStyle, bool aItalic,
const uint8_t* aFontData, const uint8_t* aFontData,
uint32_t aLength) override; uint32_t aLength) override;

View File

@ -109,7 +109,7 @@ gfxUserFontEntry::gfxUserFontEntry(gfxUserFontSet* aFontSet,
const nsTArray<gfxFontFaceSrc>& aFontFaceSrcList, const nsTArray<gfxFontFaceSrc>& aFontFaceSrcList,
uint32_t aWeight, uint32_t aWeight,
int32_t aStretch, int32_t aStretch,
uint8_t aStyle, uint32_t aItalicStyle,
const nsTArray<gfxFontFeature>& aFeatureSettings, const nsTArray<gfxFontFeature>& aFeatureSettings,
uint32_t aLanguageOverride, uint32_t aLanguageOverride,
gfxSparseBitSet* aUnicodeRanges) gfxSparseBitSet* aUnicodeRanges)
@ -127,7 +127,9 @@ gfxUserFontEntry::gfxUserFontEntry(gfxUserFontSet* aFontSet,
mSrcIndex = 0; mSrcIndex = 0;
mWeight = aWeight; mWeight = aWeight;
mStretch = aStretch; mStretch = aStretch;
mStyle = aStyle; // XXX Currently, we don't distinguish 'italic' and 'oblique' styles;
// we need to fix this. (Bug 543715)
mItalic = (aItalicStyle & (NS_FONT_STYLE_ITALIC | NS_FONT_STYLE_OBLIQUE)) != 0;
mFeatureSettings.AppendElements(aFeatureSettings); mFeatureSettings.AppendElements(aFeatureSettings);
mLanguageOverride = aLanguageOverride; mLanguageOverride = aLanguageOverride;
@ -145,14 +147,18 @@ bool
gfxUserFontEntry::Matches(const nsTArray<gfxFontFaceSrc>& aFontFaceSrcList, gfxUserFontEntry::Matches(const nsTArray<gfxFontFaceSrc>& aFontFaceSrcList,
uint32_t aWeight, uint32_t aWeight,
int32_t aStretch, int32_t aStretch,
uint8_t aStyle, uint32_t aItalicStyle,
const nsTArray<gfxFontFeature>& aFeatureSettings, const nsTArray<gfxFontFeature>& aFeatureSettings,
uint32_t aLanguageOverride, uint32_t aLanguageOverride,
gfxSparseBitSet* aUnicodeRanges) gfxSparseBitSet* aUnicodeRanges)
{ {
// XXX font entries don't distinguish italic from oblique (bug 543715)
bool isItalic =
(aItalicStyle & (NS_FONT_STYLE_ITALIC | NS_FONT_STYLE_OBLIQUE)) != 0;
return mWeight == aWeight && return mWeight == aWeight &&
mStretch == aStretch && mStretch == aStretch &&
mStyle == aStyle && mItalic == isItalic &&
mFeatureSettings == aFeatureSettings && mFeatureSettings == aFeatureSettings &&
mLanguageOverride == aLanguageOverride && mLanguageOverride == aLanguageOverride &&
mSrcList == aFontFaceSrcList && mSrcList == aFontFaceSrcList &&
@ -406,7 +412,7 @@ gfxUserFontEntry::LoadNextSrc()
gfxPlatform::GetPlatform()->LookupLocalFont(currSrc.mLocalName, gfxPlatform::GetPlatform()->LookupLocalFont(currSrc.mLocalName,
mWeight, mWeight,
mStretch, mStretch,
mStyle); mItalic);
nsTArray<gfxUserFontSet*> fontSets; nsTArray<gfxUserFontSet*> fontSets;
GetUserFontSets(fontSets); GetUserFontSets(fontSets);
for (gfxUserFontSet* fontSet : fontSets) { for (gfxUserFontSet* fontSet : fontSets) {
@ -606,10 +612,11 @@ gfxUserFontEntry::LoadPlatformFont(const uint8_t* aFontData, uint32_t& aLength)
originalFullName); originalFullName);
// Here ownership of saneData is passed to the platform, // Here ownership of saneData is passed to the platform,
// which will delete it when no longer required // which will delete it when no longer required
fe = gfxPlatform::GetPlatform()->MakePlatformFont(mName, fe = gfxPlatform::GetPlatform()->MakePlatformFont(mName,
mWeight, mWeight,
mStretch, mStretch,
mStyle, mItalic,
saneData, saneData,
saneLen); saneLen);
if (!fe) { if (!fe) {
@ -764,7 +771,7 @@ gfxUserFontSet::FindOrCreateUserFontEntry(
const nsTArray<gfxFontFaceSrc>& aFontFaceSrcList, const nsTArray<gfxFontFaceSrc>& aFontFaceSrcList,
uint32_t aWeight, uint32_t aWeight,
int32_t aStretch, int32_t aStretch,
uint8_t aStyle, uint32_t aItalicStyle,
const nsTArray<gfxFontFeature>& aFeatureSettings, const nsTArray<gfxFontFeature>& aFeatureSettings,
uint32_t aLanguageOverride, uint32_t aLanguageOverride,
gfxSparseBitSet* aUnicodeRanges) gfxSparseBitSet* aUnicodeRanges)
@ -780,14 +787,14 @@ gfxUserFontSet::FindOrCreateUserFontEntry(
gfxUserFontFamily* family = LookupFamily(aFamilyName); gfxUserFontFamily* family = LookupFamily(aFamilyName);
if (family) { if (family) {
entry = FindExistingUserFontEntry(family, aFontFaceSrcList, aWeight, entry = FindExistingUserFontEntry(family, aFontFaceSrcList, aWeight,
aStretch, aStyle, aStretch, aItalicStyle,
aFeatureSettings, aLanguageOverride, aFeatureSettings, aLanguageOverride,
aUnicodeRanges); aUnicodeRanges);
} }
if (!entry) { if (!entry) {
entry = CreateUserFontEntry(aFontFaceSrcList, aWeight, aStretch, entry = CreateUserFontEntry(aFontFaceSrcList, aWeight, aStretch,
aStyle, aFeatureSettings, aItalicStyle, aFeatureSettings,
aLanguageOverride, aUnicodeRanges); aLanguageOverride, aUnicodeRanges);
entry->mFamilyName = aFamilyName; entry->mFamilyName = aFamilyName;
} }
@ -800,7 +807,7 @@ gfxUserFontSet::CreateUserFontEntry(
const nsTArray<gfxFontFaceSrc>& aFontFaceSrcList, const nsTArray<gfxFontFaceSrc>& aFontFaceSrcList,
uint32_t aWeight, uint32_t aWeight,
int32_t aStretch, int32_t aStretch,
uint8_t aStyle, uint32_t aItalicStyle,
const nsTArray<gfxFontFeature>& aFeatureSettings, const nsTArray<gfxFontFeature>& aFeatureSettings,
uint32_t aLanguageOverride, uint32_t aLanguageOverride,
gfxSparseBitSet* aUnicodeRanges) gfxSparseBitSet* aUnicodeRanges)
@ -808,7 +815,7 @@ gfxUserFontSet::CreateUserFontEntry(
RefPtr<gfxUserFontEntry> userFontEntry = RefPtr<gfxUserFontEntry> userFontEntry =
new gfxUserFontEntry(this, aFontFaceSrcList, aWeight, new gfxUserFontEntry(this, aFontFaceSrcList, aWeight,
aStretch, aStyle, aFeatureSettings, aStretch, aItalicStyle, aFeatureSettings,
aLanguageOverride, aUnicodeRanges); aLanguageOverride, aUnicodeRanges);
return userFontEntry.forget(); return userFontEntry.forget();
} }
@ -819,7 +826,7 @@ gfxUserFontSet::FindExistingUserFontEntry(
const nsTArray<gfxFontFaceSrc>& aFontFaceSrcList, const nsTArray<gfxFontFaceSrc>& aFontFaceSrcList,
uint32_t aWeight, uint32_t aWeight,
int32_t aStretch, int32_t aStretch,
uint8_t aStyle, uint32_t aItalicStyle,
const nsTArray<gfxFontFeature>& aFeatureSettings, const nsTArray<gfxFontFeature>& aFeatureSettings,
uint32_t aLanguageOverride, uint32_t aLanguageOverride,
gfxSparseBitSet* aUnicodeRanges) gfxSparseBitSet* aUnicodeRanges)
@ -837,7 +844,7 @@ gfxUserFontSet::FindExistingUserFontEntry(
gfxUserFontEntry* existingUserFontEntry = gfxUserFontEntry* existingUserFontEntry =
static_cast<gfxUserFontEntry*>(fontList[i].get()); static_cast<gfxUserFontEntry*>(fontList[i].get());
if (!existingUserFontEntry->Matches(aFontFaceSrcList, if (!existingUserFontEntry->Matches(aFontFaceSrcList,
aWeight, aStretch, aStyle, aWeight, aStretch, aItalicStyle,
aFeatureSettings, aLanguageOverride, aFeatureSettings, aLanguageOverride,
aUnicodeRanges)) { aUnicodeRanges)) {
continue; continue;
@ -860,8 +867,7 @@ gfxUserFontSet::AddUserFontEntry(const nsAString& aFamilyName,
LOG(("userfonts (%p) added to \"%s\" (%p) style: %s weight: %d " LOG(("userfonts (%p) added to \"%s\" (%p) style: %s weight: %d "
"stretch: %d", "stretch: %d",
this, NS_ConvertUTF16toUTF8(aFamilyName).get(), aUserFontEntry, this, NS_ConvertUTF16toUTF8(aFamilyName).get(), aUserFontEntry,
(aUserFontEntry->IsItalic() ? "italic" : (aUserFontEntry->IsItalic() ? "italic" : "normal"),
(aUserFontEntry->IsOblique() ? "oblique" : "normal")),
aUserFontEntry->Weight(), aUserFontEntry->Stretch())); aUserFontEntry->Weight(), aUserFontEntry->Stretch()));
} }
} }
@ -1044,7 +1050,7 @@ gfxUserFontSet::UserFontCache::Entry::KeyEquals(const KeyTypePointer aKey) const
} }
} }
if (mFontEntry->mStyle != fe->mStyle || if (mFontEntry->mItalic != fe->mItalic ||
mFontEntry->mWeight != fe->mWeight || mFontEntry->mWeight != fe->mWeight ||
mFontEntry->mStretch != fe->mStretch || mFontEntry->mStretch != fe->mStretch ||
mFontEntry->mFeatureSettings != fe->mFeatureSettings || mFontEntry->mFeatureSettings != fe->mFeatureSettings ||

View File

@ -16,7 +16,6 @@
#include "nsIScriptError.h" #include "nsIScriptError.h"
#include "nsURIHashKey.h" #include "nsURIHashKey.h"
#include "mozilla/net/ReferrerPolicy.h" #include "mozilla/net/ReferrerPolicy.h"
#include "gfxFontConstants.h"
class nsFontFaceLoader; class nsFontFaceLoader;
@ -211,7 +210,7 @@ public:
const nsTArray<gfxFontFaceSrc>& aFontFaceSrcList, const nsTArray<gfxFontFaceSrc>& aFontFaceSrcList,
uint32_t aWeight, uint32_t aWeight,
int32_t aStretch, int32_t aStretch,
uint8_t aStyle, uint32_t aItalicStyle,
const nsTArray<gfxFontFeature>& aFeatureSettings, const nsTArray<gfxFontFeature>& aFeatureSettings,
uint32_t aLanguageOverride, uint32_t aLanguageOverride,
gfxSparseBitSet* aUnicodeRanges) = 0; gfxSparseBitSet* aUnicodeRanges) = 0;
@ -223,7 +222,7 @@ public:
const nsTArray<gfxFontFaceSrc>& aFontFaceSrcList, const nsTArray<gfxFontFaceSrc>& aFontFaceSrcList,
uint32_t aWeight, uint32_t aWeight,
int32_t aStretch, int32_t aStretch,
uint8_t aStyle, uint32_t aItalicStyle,
const nsTArray<gfxFontFeature>& aFeatureSettings, const nsTArray<gfxFontFeature>& aFeatureSettings,
uint32_t aLanguageOverride, uint32_t aLanguageOverride,
gfxSparseBitSet* aUnicodeRanges); gfxSparseBitSet* aUnicodeRanges);
@ -417,9 +416,9 @@ public:
nsURIHashKey::HashKey(aKey->mURI), nsURIHashKey::HashKey(aKey->mURI),
HashFeatures(aKey->mFontEntry->mFeatureSettings), HashFeatures(aKey->mFontEntry->mFeatureSettings),
mozilla::HashString(aKey->mFontEntry->mFamilyName), mozilla::HashString(aKey->mFontEntry->mFamilyName),
(aKey->mFontEntry->mStyle | ((uint32_t)aKey->mFontEntry->mItalic |
(aKey->mFontEntry->mWeight << 2) | (aKey->mFontEntry->mWeight << 1) |
(aKey->mFontEntry->mStretch << 11) ) ^ (aKey->mFontEntry->mStretch << 10) ) ^
aKey->mFontEntry->mLanguageOverride); aKey->mFontEntry->mLanguageOverride);
} }
@ -496,7 +495,7 @@ protected:
const nsTArray<gfxFontFaceSrc>& aFontFaceSrcList, const nsTArray<gfxFontFaceSrc>& aFontFaceSrcList,
uint32_t aWeight, uint32_t aWeight,
int32_t aStretch, int32_t aStretch,
uint8_t aStyle, uint32_t aItalicStyle,
const nsTArray<gfxFontFeature>& aFeatureSettings, const nsTArray<gfxFontFeature>& aFeatureSettings,
uint32_t aLanguageOverride, uint32_t aLanguageOverride,
gfxSparseBitSet* aUnicodeRanges); gfxSparseBitSet* aUnicodeRanges);
@ -535,7 +534,7 @@ public:
const nsTArray<gfxFontFaceSrc>& aFontFaceSrcList, const nsTArray<gfxFontFaceSrc>& aFontFaceSrcList,
uint32_t aWeight, uint32_t aWeight,
int32_t aStretch, int32_t aStretch,
uint8_t aStyle, uint32_t aItalicStyle,
const nsTArray<gfxFontFeature>& aFeatureSettings, const nsTArray<gfxFontFeature>& aFeatureSettings,
uint32_t aLanguageOverride, uint32_t aLanguageOverride,
gfxSparseBitSet* aUnicodeRanges); gfxSparseBitSet* aUnicodeRanges);
@ -546,7 +545,7 @@ public:
bool Matches(const nsTArray<gfxFontFaceSrc>& aFontFaceSrcList, bool Matches(const nsTArray<gfxFontFaceSrc>& aFontFaceSrcList,
uint32_t aWeight, uint32_t aWeight,
int32_t aStretch, int32_t aStretch,
uint8_t aStyle, uint32_t aItalicStyle,
const nsTArray<gfxFontFeature>& aFeatureSettings, const nsTArray<gfxFontFeature>& aFeatureSettings,
uint32_t aLanguageOverride, uint32_t aLanguageOverride,
gfxSparseBitSet* aUnicodeRanges); gfxSparseBitSet* aUnicodeRanges);

View File

@ -1056,26 +1056,26 @@ gfxFontEntry*
gfxWindowsPlatform::LookupLocalFont(const nsAString& aFontName, gfxWindowsPlatform::LookupLocalFont(const nsAString& aFontName,
uint16_t aWeight, uint16_t aWeight,
int16_t aStretch, int16_t aStretch,
uint8_t aStyle) bool aItalic)
{ {
return gfxPlatformFontList::PlatformFontList()->LookupLocalFont(aFontName, return gfxPlatformFontList::PlatformFontList()->LookupLocalFont(aFontName,
aWeight, aWeight,
aStretch, aStretch,
aStyle); aItalic);
} }
gfxFontEntry* gfxFontEntry*
gfxWindowsPlatform::MakePlatformFont(const nsAString& aFontName, gfxWindowsPlatform::MakePlatformFont(const nsAString& aFontName,
uint16_t aWeight, uint16_t aWeight,
int16_t aStretch, int16_t aStretch,
uint8_t aStyle, bool aItalic,
const uint8_t* aFontData, const uint8_t* aFontData,
uint32_t aLength) uint32_t aLength)
{ {
return gfxPlatformFontList::PlatformFontList()->MakePlatformFont(aFontName, return gfxPlatformFontList::PlatformFontList()->MakePlatformFont(aFontName,
aWeight, aWeight,
aStretch, aStretch,
aStyle, aItalic,
aFontData, aFontData,
aLength); aLength);
} }

View File

@ -193,7 +193,7 @@ public:
virtual gfxFontEntry* LookupLocalFont(const nsAString& aFontName, virtual gfxFontEntry* LookupLocalFont(const nsAString& aFontName,
uint16_t aWeight, uint16_t aWeight,
int16_t aStretch, int16_t aStretch,
uint8_t aStyle); bool aItalic);
/** /**
* Activate a platform font (needed to support @font-face src url() ) * Activate a platform font (needed to support @font-face src url() )
@ -201,7 +201,7 @@ public:
virtual gfxFontEntry* MakePlatformFont(const nsAString& aFontName, virtual gfxFontEntry* MakePlatformFont(const nsAString& aFontName,
uint16_t aWeight, uint16_t aWeight,
int16_t aStretch, int16_t aStretch,
uint8_t aStyle, bool aItalic,
const uint8_t* aFontData, const uint8_t* aFontData,
uint32_t aLength); uint32_t aLength);

View File

@ -1,31 +0,0 @@
<!DOCTYPE HTML>
<head>
<title>style matching - italic/oblique</title>
<link rel="author" title="John Daggett" href="mailto:jdaggett@mozilla.com">
<link rel="author" title="Mozilla" href="http://www.mozilla.org/">
<link rel="help" href="http://www.w3.org/TR/css3-fonts/#font-style-prop">
<link rel="help" href="http://www.w3.org/TR/css3-fonts/#font-style-matching">
<link rel="match" href="italic-oblique-ref.html">
<meta name="flags" content="font matching must distinguish between italic and oblique">
<style>
@font-face {
font-family: test;
src: url(../fonts/markA.woff);
}
@font-face {
font-family: test;
src: url(../fonts/markB.woff);
font-style: italic;
}
body { margin: 30px }
p { margin: 0; font: italic 300% test, serif; }
</style>
</head>
<body>
<p>BBB</p>
</body>
</html>

View File

@ -1,31 +0,0 @@
<!DOCTYPE HTML>
<head>
<title>style matching - italic/oblique</title>
<link rel="author" title="John Daggett" href="mailto:jdaggett@mozilla.com">
<link rel="author" title="Mozilla" href="http://www.mozilla.org/">
<link rel="help" href="http://www.w3.org/TR/css3-fonts/#font-style-prop">
<link rel="help" href="http://www.w3.org/TR/css3-fonts/#font-style-matching">
<link rel="match" href="italic-oblique-ref.html">
<meta name="flags" content="font matching must distinguish between italic and oblique">
<style>
@font-face {
font-family: test;
src: url(../fonts/markA.woff);
}
@font-face {
font-family: test;
src: url(../fonts/markC.woff);
font-style: oblique;
}
body { margin: 30px }
p { margin: 0; font: italic 300% test, serif; }
</style>
</head>
<body>
<p>CCC</p>
</body>
</html>

View File

@ -1,37 +0,0 @@
<!DOCTYPE HTML>
<head>
<title>style matching - italic/oblique</title>
<link rel="author" title="John Daggett" href="mailto:jdaggett@mozilla.com">
<link rel="author" title="Mozilla" href="http://www.mozilla.org/">
<link rel="help" href="http://www.w3.org/TR/css3-fonts/#font-style-prop">
<link rel="help" href="http://www.w3.org/TR/css3-fonts/#font-style-matching">
<link rel="match" href="italic-oblique-ref.html">
<meta name="flags" content="font matching must distinguish between italic and oblique">
<style>
@font-face {
font-family: test;
src: url(../fonts/markA.woff);
}
@font-face {
font-family: test;
src: url(../fonts/markB.woff);
font-style: italic;
}
@font-face {
font-family: test;
src: url(../fonts/mark2B.woff);
font-style: oblique;
}
body { margin: 30px }
p { margin: 0; font: italic 300% test, serif; }
</style>
</head>
<body>
<p>BBB</p>
</body>
</html>

View File

@ -1,37 +0,0 @@
<!DOCTYPE HTML>
<head>
<title>style matching - italic/oblique</title>
<link rel="author" title="John Daggett" href="mailto:jdaggett@mozilla.com">
<link rel="author" title="Mozilla" href="http://www.mozilla.org/">
<link rel="help" href="http://www.w3.org/TR/css3-fonts/#font-style-prop">
<link rel="help" href="http://www.w3.org/TR/css3-fonts/#font-style-matching">
<link rel="match" href="italic-oblique-ref.html">
<meta name="flags" content="font matching must distinguish between italic and oblique">
<style>
@font-face {
font-family: test;
src: url(../fonts/markA.woff);
}
@font-face {
font-family: test;
src: url(../fonts/mark2B.woff);
font-style: oblique;
}
@font-face {
font-family: test;
src: url(../fonts/markB.woff);
font-style: italic;
}
body { margin: 30px }
p { margin: 0; font: italic 300% test, serif; }
</style>
</head>
<body>
<p>BBB</p>
</body>
</html>

View File

@ -1,37 +0,0 @@
<!DOCTYPE HTML>
<head>
<title>style matching - italic/oblique</title>
<link rel="author" title="John Daggett" href="mailto:jdaggett@mozilla.com">
<link rel="author" title="Mozilla" href="http://www.mozilla.org/">
<link rel="help" href="http://www.w3.org/TR/css3-fonts/#font-style-prop">
<link rel="help" href="http://www.w3.org/TR/css3-fonts/#font-style-matching">
<link rel="match" href="italic-oblique-ref.html">
<meta name="flags" content="font matching must distinguish between italic and oblique">
<style>
@font-face {
font-family: test;
src: url(../fonts/markA.woff);
}
@font-face {
font-family: test;
src: url(../fonts/mark2B.woff);
font-style: italic;
}
@font-face {
font-family: test;
src: url(../fonts/markB.woff);
font-style: oblique;
}
body { margin: 30px }
p { margin: 0; font: oblique 300% test, serif; }
</style>
</head>
<body>
<p>BBB</p>
</body>
</html>

View File

@ -1,37 +0,0 @@
<!DOCTYPE HTML>
<head>
<title>style matching - italic/oblique</title>
<link rel="author" title="John Daggett" href="mailto:jdaggett@mozilla.com">
<link rel="author" title="Mozilla" href="http://www.mozilla.org/">
<link rel="help" href="http://www.w3.org/TR/css3-fonts/#font-style-prop">
<link rel="help" href="http://www.w3.org/TR/css3-fonts/#font-style-matching">
<link rel="match" href="italic-oblique-ref.html">
<meta name="flags" content="font matching must distinguish between italic and oblique">
<style>
@font-face {
font-family: test;
src: url(../fonts/markA.woff);
}
@font-face {
font-family: test;
src: url(../fonts/markB.woff);
font-style: italic;
}
@font-face {
font-family: test;
src: url(../fonts/markC.woff);
font-style: oblique;
}
body { margin: 30px }
p { margin: 0; font: oblique 300% test, serif; }
</style>
</head>
<body>
<p>CCC</p>
</body>
</html>

View File

@ -1,37 +0,0 @@
<!DOCTYPE HTML>
<head>
<title>style matching - italic/oblique</title>
<link rel="author" title="John Daggett" href="mailto:jdaggett@mozilla.com">
<link rel="author" title="Mozilla" href="http://www.mozilla.org/">
<link rel="help" href="http://www.w3.org/TR/css3-fonts/#font-style-prop">
<link rel="help" href="http://www.w3.org/TR/css3-fonts/#font-style-matching">
<link rel="match" href="italic-oblique-ref.html">
<meta name="flags" content="font matching must distinguish between italic and oblique">
<style>
@font-face {
font-family: test;
src: url(../fonts/markA.woff);
font-style: oblique;
}
@font-face {
font-family: test;
src: url(../fonts/markB.woff);
}
@font-face {
font-family: test;
src: url(../fonts/mark2B.woff);
font-style: italic;
}
body { margin: 30px }
p { margin: 0; font: oblique 300% test, serif; }
</style>
</head>
<body>
<p>AAA</p>
</body>
</html>

View File

@ -1,43 +0,0 @@
<!DOCTYPE HTML>
<head>
<title>style matching - italic/oblique</title>
<link rel="author" title="John Daggett" href="mailto:jdaggett@mozilla.com">
<link rel="author" title="Mozilla" href="http://www.mozilla.org/">
<link rel="help" href="http://www.w3.org/TR/css3-fonts/#font-style-prop">
<link rel="help" href="http://www.w3.org/TR/css3-fonts/#font-style-matching">
<link rel="match" href="italic-oblique-ref.html">
<meta name="flags" content="font matching must distinguish between italic and oblique">
<style>
@font-face {
font-family: test1;
src: url(../fonts/markA.woff);
}
@font-face {
font-family: test2;
src: url(../fonts/markB.woff);
font-style: italic;
}
@font-face {
font-family: test3;
src: url(../fonts/markC.woff);
font-style: oblique;
}
@font-face {
font-family: test3;
src: url(../fonts/mark2C.woff);
font-style: italic;
}
body { margin: 30px }
p { margin: 0; font: oblique 300% test1, test2, test3, serif; }
</style>
</head>
<body>
<p>CCC</p>
</body>
</html>

View File

@ -1,43 +0,0 @@
<!DOCTYPE HTML>
<head>
<title>style matching - italic/oblique</title>
<link rel="author" title="John Daggett" href="mailto:jdaggett@mozilla.com">
<link rel="author" title="Mozilla" href="http://www.mozilla.org/">
<link rel="help" href="http://www.w3.org/TR/css3-fonts/#font-style-prop">
<link rel="help" href="http://www.w3.org/TR/css3-fonts/#font-style-matching">
<link rel="match" href="italic-oblique-ref.html">
<meta name="flags" content="font matching must distinguish between italic and oblique">
<style>
@font-face {
font-family: test1;
src: url(../fonts/markA.woff);
}
@font-face {
font-family: test2;
src: url(../fonts/markC.woff);
font-style: italic;
}
@font-face {
font-family: test3;
src: url(../fonts/mark2C.woff);
font-style: oblique;
}
@font-face {
font-family: test3;
src: url(../fonts/mark2A.woff);
font-style: italic;
}
body { margin: 30px }
p { margin: 0; font: oblique 300% test1, test2, test3, serif; }
</style>
</head>
<body>
<p>CCC</p>
</body>
</html>

View File

@ -1,37 +0,0 @@
<!DOCTYPE HTML>
<head>
<title>style matching - italic/oblique</title>
<link rel="author" title="John Daggett" href="mailto:jdaggett@mozilla.com">
<link rel="author" title="Mozilla" href="http://www.mozilla.org/">
<link rel="help" href="http://www.w3.org/TR/css3-fonts/#font-style-prop">
<link rel="help" href="http://www.w3.org/TR/css3-fonts/#font-style-matching">
<link rel="match" href="italic-oblique-ref.html">
<meta name="flags" content="font matching must distinguish between italic and oblique">
<style>
@font-face {
font-family: test;
src: url(../fonts/mark2A.woff);
font-style: oblique;
}
@font-face {
font-family: test;
src: url(../fonts/markB.woff);
}
@font-face {
font-family: test;
src: url(../fonts/markA.woff);
font-style: italic;
}
body { margin: 30px }
p { margin: 0; font: italic 300% kinnari, test, serif; }
</style>
</head>
<body>
<p>AAA</p>
</body>
</html>

View File

@ -1,37 +0,0 @@
<!DOCTYPE HTML>
<head>
<title>style matching - italic/oblique</title>
<link rel="author" title="John Daggett" href="mailto:jdaggett@mozilla.com">
<link rel="author" title="Mozilla" href="http://www.mozilla.org/">
<link rel="help" href="http://www.w3.org/TR/css3-fonts/#font-style-prop">
<link rel="help" href="http://www.w3.org/TR/css3-fonts/#font-style-matching">
<link rel="match" href="italic-oblique-ref.html">
<meta name="flags" content="font matching must distinguish between italic and oblique">
<style>
@font-face {
font-family: test;
src: url(../fonts/mark2A.woff);
font-style: oblique;
}
@font-face {
font-family: test;
src: url(../fonts/markB.woff);
}
@font-face {
font-family: test;
src: url(../fonts/markA.woff);
font-style: italic;
}
body { margin: 30px }
p { margin: 0; font: oblique 300% kinnari, test, serif; }
</style>
</head>
<body>
<p>AAA</p>
</body>
</html>

View File

@ -1,24 +0,0 @@
<!DOCTYPE HTML>
<head>
<title>style matching - italic/oblique</title>
<link rel="author" title="John Daggett" href="mailto:jdaggett@mozilla.com">
<link rel="author" title="Mozilla" href="http://www.mozilla.org/">
<link rel="help" href="http://www.w3.org/TR/css3-fonts/#font-style-prop">
<link rel="help" href="http://www.w3.org/TR/css3-fonts/#font-style-matching">
<link rel="match" href="italic-oblique-1-ref.html">
<meta name="flags" content="font matching must distinguish between italic and oblique">
<style>
@font-face {
font-family: test;
src: url(../fonts/markA.woff);
}
body { margin: 30px }
p { margin: 0; font: 300% test, serif; }
</style>
</head>
<body>
<p>AAA</p>
</body>
</html>

View File

@ -98,16 +98,3 @@ skip-if(Mulet) HTTP(..) == font-synthesis-2.html font-synthesis-2-ref.html # MUL
# Bug 1060791 - support for format 10 cmap in Apple Symbols; # Bug 1060791 - support for format 10 cmap in Apple Symbols;
# relevant fonts not present on other platforms. # relevant fonts not present on other platforms.
skip-if(!cocoaWidget) HTTP(..) != apple-symbols-1.html apple-symbols-1-notref.html skip-if(!cocoaWidget) HTTP(..) != apple-symbols-1.html apple-symbols-1-notref.html
# distinguish between italic and oblique
== simple-oblique.html simple-oblique-ref.html
== italic-oblique-1.html italic-oblique-ref.html
== italic-oblique-2.html italic-oblique-ref.html
== italic-oblique-3.html italic-oblique-ref.html
== italic-oblique-4.html italic-oblique-ref.html
== italic-oblique-5.html italic-oblique-ref.html
== italic-oblique-6.html italic-oblique-ref.html
== italic-oblique-7.html italic-oblique-ref.html
== italic-oblique-8.html italic-oblique-ref.html
== italic-oblique-9.html italic-oblique-ref.html
!= italic-oblique-kinnari.html italic-oblique-kinnari-ref.html

View File

@ -1,33 +0,0 @@
<!DOCTYPE HTML>
<html>
<head>
<title>oblique italic equivalence</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css">
body {
margin: 50px;
font-size: 300%;
}
#sans { font-family: sans-serif; }
#serif { font-family: serif; }
#mono { font-family: monospace; }
p {
margin: 0;
font-style: italic;
line-height: 1.3em;
}
</style>
</head>
<body>
<p id=sans>UNICORN asteroid</p>
<p id=serif>UNICORN asteroid</p>
<p id=mono>UNICORN asteroid</p>
</body>
</html>

View File

@ -1,33 +0,0 @@
<!DOCTYPE HTML>
<html>
<head>
<title>oblique italic equivalence</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css">
body {
margin: 50px;
font-size: 300%;
}
#sans { font-family: sans-serif; }
#serif { font-family: serif; }
#mono { font-family: monospace; }
p {
margin: 0;
font-style: oblique;
line-height: 1.3em;
}
</style>
</head>
<body>
<p id=sans>UNICORN asteroid</p>
<p id=serif>UNICORN asteroid</p>
<p id=mono>UNICORN asteroid</p>
</body>
</html>

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -44,12 +44,12 @@ public:
const nsTArray<gfxFontFaceSrc>& aFontFaceSrcList, const nsTArray<gfxFontFaceSrc>& aFontFaceSrcList,
uint32_t aWeight, uint32_t aWeight,
int32_t aStretch, int32_t aStretch,
uint8_t aStyle, uint32_t aItalicStyle,
const nsTArray<gfxFontFeature>& aFeatureSettings, const nsTArray<gfxFontFeature>& aFeatureSettings,
uint32_t aLanguageOverride, uint32_t aLanguageOverride,
gfxSparseBitSet* aUnicodeRanges) gfxSparseBitSet* aUnicodeRanges)
: gfxUserFontEntry(aFontSet, aFontFaceSrcList, aWeight, aStretch, : gfxUserFontEntry(aFontSet, aFontFaceSrcList, aWeight, aStretch,
aStyle, aFeatureSettings, aLanguageOverride, aItalicStyle, aFeatureSettings, aLanguageOverride,
aUnicodeRanges) {} aUnicodeRanges) {}
virtual void SetLoadState(UserFontLoadState aLoadState) override; virtual void SetLoadState(UserFontLoadState aLoadState) override;

View File

@ -169,7 +169,7 @@ FontFaceSet::ParseFontShorthandForMatching(
RefPtr<FontFamilyListRefCnt>& aFamilyList, RefPtr<FontFamilyListRefCnt>& aFamilyList,
uint32_t& aWeight, uint32_t& aWeight,
int32_t& aStretch, int32_t& aStretch,
uint8_t& aStyle, uint32_t& aItalicStyle,
ErrorResult& aRv) ErrorResult& aRv)
{ {
// Parse aFont as a 'font' property value. // Parse aFont as a 'font' property value.
@ -224,7 +224,7 @@ FontFaceSet::ParseFontShorthandForMatching(
aWeight = weight; aWeight = weight;
aStretch = data->ValueFor(eCSSProperty_font_stretch)->GetIntValue(); aStretch = data->ValueFor(eCSSProperty_font_stretch)->GetIntValue();
aStyle = data->ValueFor(eCSSProperty_font_style)->GetIntValue(); aItalicStyle = data->ValueFor(eCSSProperty_font_style)->GetIntValue();
} }
static bool static bool
@ -252,7 +252,7 @@ FontFaceSet::FindMatchingFontFaces(const nsAString& aFont,
RefPtr<FontFamilyListRefCnt> familyList; RefPtr<FontFamilyListRefCnt> familyList;
uint32_t weight; uint32_t weight;
int32_t stretch; int32_t stretch;
uint8_t italicStyle; uint32_t italicStyle;
ParseFontShorthandForMatching(aFont, familyList, weight, stretch, italicStyle, ParseFontShorthandForMatching(aFont, familyList, weight, stretch, italicStyle,
aRv); aRv);
if (aRv.Failed()) { if (aRv.Failed()) {
@ -964,7 +964,7 @@ FontFaceSet::FindOrCreateUserFontEntryFromFontFace(const nsAString& aFamilyName,
uint32_t weight = NS_STYLE_FONT_WEIGHT_NORMAL; uint32_t weight = NS_STYLE_FONT_WEIGHT_NORMAL;
int32_t stretch = NS_STYLE_FONT_STRETCH_NORMAL; int32_t stretch = NS_STYLE_FONT_STRETCH_NORMAL;
uint8_t italicStyle = NS_STYLE_FONT_STYLE_NORMAL; uint32_t italicStyle = NS_STYLE_FONT_STYLE_NORMAL;
uint32_t languageOverride = NO_FONT_LANGUAGE_OVERRIDE; uint32_t languageOverride = NO_FONT_LANGUAGE_OVERRIDE;
// set up weight // set up weight
@ -1772,13 +1772,13 @@ FontFaceSet::UserFontSet::CreateUserFontEntry(
const nsTArray<gfxFontFaceSrc>& aFontFaceSrcList, const nsTArray<gfxFontFaceSrc>& aFontFaceSrcList,
uint32_t aWeight, uint32_t aWeight,
int32_t aStretch, int32_t aStretch,
uint8_t aStyle, uint32_t aItalicStyle,
const nsTArray<gfxFontFeature>& aFeatureSettings, const nsTArray<gfxFontFeature>& aFeatureSettings,
uint32_t aLanguageOverride, uint32_t aLanguageOverride,
gfxSparseBitSet* aUnicodeRanges) gfxSparseBitSet* aUnicodeRanges)
{ {
RefPtr<gfxUserFontEntry> entry = RefPtr<gfxUserFontEntry> entry =
new FontFace::Entry(this, aFontFaceSrcList, aWeight, aStretch, aStyle, new FontFace::Entry(this, aFontFaceSrcList, aWeight, aStretch, aItalicStyle,
aFeatureSettings, aLanguageOverride, aUnicodeRanges); aFeatureSettings, aLanguageOverride, aUnicodeRanges);
return entry.forget(); return entry.forget();
} }

View File

@ -83,7 +83,7 @@ public:
const nsTArray<gfxFontFaceSrc>& aFontFaceSrcList, const nsTArray<gfxFontFaceSrc>& aFontFaceSrcList,
uint32_t aWeight, uint32_t aWeight,
int32_t aStretch, int32_t aStretch,
uint8_t aStyle, uint32_t aItalicStyle,
const nsTArray<gfxFontFeature>& aFeatureSettings, const nsTArray<gfxFontFeature>& aFeatureSettings,
uint32_t aLanguageOverride, uint32_t aLanguageOverride,
gfxSparseBitSet* aUnicodeRanges) override; gfxSparseBitSet* aUnicodeRanges) override;
@ -286,7 +286,7 @@ private:
RefPtr<mozilla::css::FontFamilyListRefCnt>& aFamilyList, RefPtr<mozilla::css::FontFamilyListRefCnt>& aFamilyList,
uint32_t& aWeight, uint32_t& aWeight,
int32_t& aStretch, int32_t& aStretch,
uint8_t& aStyle, uint32_t& aItalicStyle,
ErrorResult& aRv); ErrorResult& aRv);
void FindMatchingFontFaces(const nsAString& aFont, void FindMatchingFontFaces(const nsAString& aFont,
const nsAString& aText, const nsAString& aText,