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,
uint16_t aWeight,
int16_t aStretch,
uint8_t aStyle)
bool aItalic)
{
return gfxPlatformFontList::PlatformFontList()->LookupLocalFont(aFontName,
aWeight,
aStretch,
aStyle);
aItalic);
}
gfxFontEntry*
gfxAndroidPlatform::MakePlatformFont(const nsAString& aFontName,
uint16_t aWeight,
int16_t aStretch,
uint8_t aStyle,
bool aItalic,
const uint8_t* aFontData,
uint32_t aLength)
{
return gfxPlatformFontList::PlatformFontList()->MakePlatformFont(aFontName,
aWeight,
aStretch,
aStyle,
aItalic,
aFontData,
aLength);
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -99,7 +99,7 @@ public:
explicit gfxFontconfigFontEntry(const nsAString& aFaceName,
uint16_t aWeight,
int16_t aStretch,
uint8_t aStyle,
bool aItalic,
const uint8_t *aData,
FT_Face aFace);
@ -108,7 +108,7 @@ public:
FcPattern* aFontPattern,
uint16_t aWeight,
int16_t aStretch,
uint8_t aStyle);
bool aItalic);
FcPattern* GetPattern() { return mFontPattern; }
@ -209,12 +209,11 @@ public:
gfxFontEntry*
LookupLocalFont(const nsAString& aFontName, uint16_t aWeight,
int16_t aStretch, uint8_t aStyle) override;
int16_t aStretch, bool aItalic) override;
gfxFontEntry*
MakePlatformFont(const nsAString& aFontName, uint16_t aWeight,
int16_t aStretch,
uint8_t aStyle,
int16_t aStretch, bool aItalic,
const uint8_t* aFontData,
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
// for the top-right of the glyphs being skewed to the right, and the
// bottom-left being skewed further left.
if (mStyle.style != NS_FONT_STYLE_NORMAL &&
mFontEntry->IsUpright() &&
mStyle.allowSyntheticStyle) {
if (mStyle.style != NS_FONT_STYLE_NORMAL && !mFontEntry->IsItalic()) {
gfxFloat extendLeftEdge =
ceil(OBLIQUE_SKEW_FACTOR * metrics.mBoundingBox.YMost());
gfxFloat extendRightEdge =

View File

@ -68,7 +68,7 @@ gfxCharacterMap::NotifyReleased()
}
gfxFontEntry::gfxFontEntry() :
mStyle(NS_FONT_STYLE_NORMAL), mFixedPitch(false),
mItalic(false), mFixedPitch(false),
mIsValid(true),
mIsBadUnderlineFont(false),
mIsUserFontContainer(false),
@ -108,7 +108,7 @@ gfxFontEntry::gfxFontEntry() :
}
gfxFontEntry::gfxFontEntry(const nsAString& aName, bool aIsStandardFace) :
mName(aName), mStyle(NS_FONT_STYLE_NORMAL), mFixedPitch(false),
mName(aName), mItalic(false), mFixedPitch(false),
mIsValid(true),
mIsBadUnderlineFont(false),
mIsUserFontContainer(false),
@ -1155,69 +1155,57 @@ gfxFontFamily::FindFontForStyle(const gfxFontStyle& aFontStyle,
return nullptr;
}
#define STYLE_SHIFT 2 // number of bits to contain style distance
// style distance ==> [0,2]
static inline uint32_t
StyleDistance(uint32_t aFontStyle, uint32_t aTargetStyle)
StyleStretchDistance(gfxFontEntry *aFontEntry, bool aTargetItalic,
int16_t aTargetStretch)
{
if (aFontStyle == aTargetStyle) {
return 0; // styles match exactly ==> 0
}
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
}
// Compute a measure of the "distance" between the requested style
// and the given fontEntry,
// considering italicness and font-stretch but not weight.
#define REVERSE_STRETCH_DISTANCE 5
// stretch distance ==> [0,13]
static inline uint32_t
StretchDistance(int16_t aFontStretch, int16_t aTargetStretch)
{
int32_t distance = 0;
if (aTargetStretch != aFontStretch) {
if (aTargetStretch != aFontEntry->mStretch) {
// stretch values are in the range -4 .. +4
// if aTargetStretch is positive, we prefer more-positive values;
// if zero or negative, prefer more-negative
if (aTargetStretch > 0) {
distance = (aFontStretch - aTargetStretch);
distance = (aFontEntry->mStretch - aTargetStretch) * 2;
} else {
distance = (aTargetStretch - aFontStretch);
distance = (aTargetStretch - aFontEntry->mStretch) * 2;
}
// if the computed "distance" here is negative, it means that
// aFontEntry lies in the "non-preferred" direction from aTargetStretch,
// 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) {
distance = -distance + REVERSE_STRETCH_DISTANCE;
distance = -distance + 10;
}
}
if (aFontEntry->IsItalic() != aTargetItalic) {
distance += 1;
}
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
// matching code below does not assume this.
//
// Calculate weight distance with values in the range (0..1000). In general,
// heavier weights match towards even heavier weights while lighter weights
// match towards even lighter weights. Target weight values in the range
// [400..500] are special, since they will first match up to 500, then down
// towards 0, then up again towards 999.
// Calculate weight values with range (0..1000). In general, heavier weights
// match towards even heavier weights while lighter weights match towards even
// lighter weights. Target weight values in the range [400..500] are special,
// since they will first match up to 500, then down to 0, then up again
// towards 999.
//
// 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
// weights are farther away than lighter weights. If the target is 5 and the
// font weight 995, the distance would be 1590 for the same reason.
// target 300 and font weight 600, distance will be 1300, since heavier weights
// are farther away than lighter weights. If the target is 5 and the font weight
// 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
WeightDistance(uint32_t aFontWeight, uint32_t aTargetWeight)
WeightDistance(uint32_t aTargetWeight, uint32_t aFontWeight)
{
// Compute a measure of the "distance" between the requested
// weight and the given fontEntry
@ -1247,34 +1235,13 @@ WeightDistance(uint32_t aFontWeight, uint32_t aTargetWeight)
}
}
if (distance < 0) {
distance = -distance + REVERSE_WEIGHT_DISTANCE;
distance = -distance + NON_DESIRED_DIRECTION_DISTANCE;
}
distance += addedDistance;
}
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
gfxFontFamily::FindAllFontsForStyle(const gfxFontStyle& aFontStyle,
nsTArray<gfxFontEntry*>& aFontEntryList,
@ -1304,6 +1271,9 @@ gfxFontFamily::FindAllFontsForStyle(const gfxFontStyle& aFontStyle,
return;
}
bool wantItalic = (aFontStyle.style &
(NS_FONT_STYLE_ITALIC | NS_FONT_STYLE_OBLIQUE)) != 0;
// 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,
// 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;
// calculate which one we want.
// 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) |
(wantBold ? kBoldMask : 0);
@ -1363,14 +1332,16 @@ gfxFontFamily::FindAllFontsForStyle(const gfxFontStyle& aFontStyle,
// weight/style/stretch combination, only the last matched font entry will
// be added.
uint32_t minDistance = MAX_DISTANCE;
uint32_t minDistance = 0xffffffff;
gfxFontEntry* matched = nullptr;
// iterate in forward order so that faces like 'Bold' are matched before
// matching style distance faces such as 'Bold Outline' (see bug 1185812)
for (uint32_t i = 0; i < count; i++) {
fe = mAvailableFonts[i];
// weight/style/stretch priority: stretch >> style >> weight
uint32_t distance = WeightStyleStretchDistance(fe, aFontStyle);
uint32_t distance =
WeightDistance(aFontStyle.weight, fe->Weight()) +
(StyleStretchDistance(fe, wantItalic, aFontStyle.stretch) *
MAX_WEIGHT_DISTANCE);
if (distance < minDistance) {
matched = fe;
if (!aFontEntryList.IsEmpty()) {
@ -1420,9 +1391,8 @@ gfxFontFamily::CheckForSimpleFamily()
gfxFontEntry *faces[4] = { 0 };
for (uint8_t i = 0; i < count; ++i) {
gfxFontEntry *fe = mAvailableFonts[i];
if (fe->Stretch() != firstStretch || fe->IsOblique()) {
// simple families don't have varying font-stretch or oblique
return;
if (fe->Stretch() != firstStretch) {
return; // font-stretch doesn't match, don't treat as simple family
}
uint8_t faceIndex = (fe->IsItalic() ? kItalicMask : 0) |
(fe->Weight() >= 600 ? kBoldMask : 0);
@ -1478,8 +1448,9 @@ CalcStyleMatch(gfxFontEntry *aFontEntry, const gfxFontStyle *aStyle)
int32_t rank = 0;
if (aStyle) {
// italics
bool wantUpright = (aStyle->style == NS_FONT_STYLE_NORMAL);
if (aFontEntry->IsUpright() == wantUpright) {
bool wantItalic =
(aStyle->style & (NS_FONT_STYLE_ITALIC | NS_FONT_STYLE_OBLIQUE)) != 0;
if (aFontEntry->IsItalic() == wantItalic) {
rank += 10;
}
@ -1487,7 +1458,7 @@ CalcStyleMatch(gfxFontEntry *aFontEntry, const gfxFontStyle *aStyle)
rank += 9 - DeprecatedAbs(aFontEntry->Weight() / 100 - aStyle->ComputeWeight());
} else {
// if no font to match, prefer non-bold, non-italic fonts
if (aFontEntry->IsUpright()) {
if (!aFontEntry->IsItalic()) {
rank += 3;
}
if (!aFontEntry->IsBold()) {

View File

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

View File

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

View File

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

View File

@ -177,8 +177,9 @@ gfxGDIFont::Initialize()
// Figure out if we want to do synthetic oblique styling.
GDIFontEntry* fe = static_cast<GDIFontEntry*>(GetFontEntry());
bool wantFakeItalic = mStyle.style != NS_FONT_STYLE_NORMAL &&
fe->IsUpright() && mStyle.allowSyntheticStyle;
bool wantFakeItalic =
(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
// 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,
gfxWindowsFontType aFontType,
uint8_t aStyle, uint16_t aWeight,
int16_t aStretch,
bool aItalic, uint16_t aWeight, int16_t aStretch,
gfxUserFontData *aUserFontData,
bool aFamilyHasItalicFace)
: gfxFontEntry(aFaceName),
@ -130,7 +129,7 @@ GDIFontEntry::GDIFontEntry(const nsAString& aFaceName,
mCharset(), mUnicodeRanges()
{
mUserFontData = aUserFontData;
mStyle = aStyle;
mItalic = aItalic;
mWeight = aWeight;
mStretch = aStretch;
if (IsType1())
@ -307,10 +306,9 @@ GDIFontEntry::TestCharacterMap(uint32_t aCh)
return false;
// previous code was using the group style
gfxFontStyle fakeStyle;
if (!IsUpright()) {
gfxFontStyle fakeStyle;
if (mItalic)
fakeStyle.style = NS_FONT_STYLE_ITALIC;
}
fakeStyle.weight = mWeight * 100;
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
// it may give us a regular one based on weight. Windows should
// do fake italic for us in that case.
mLogFont.lfItalic = !IsUpright();
mLogFont.lfItalic = mItalic;
mLogFont.lfWeight = mWeight;
int len = std::min<int>(aName.Length(), LF_FACESIZE - 1);
@ -399,15 +397,14 @@ GDIFontEntry::InitLogFont(const nsAString& aName,
GDIFontEntry*
GDIFontEntry::CreateFontEntry(const nsAString& aName,
gfxWindowsFontType aFontType,
uint8_t aStyle,
gfxWindowsFontType aFontType, bool aItalic,
uint16_t aWeight, int16_t aStretch,
gfxUserFontData* aUserFontData,
bool aFamilyHasItalicFace)
{
// 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,
aFamilyHasItalicFace);
@ -459,7 +456,7 @@ GDIFontFamily::FamilyAddStylesProc(const ENUMLOGFONTEXW *lpelfe,
fe = static_cast<GDIFontEntry*>(ff->mAvailableFonts[i].get());
// check if we already know about this face
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
fe->mCharset.set(metrics.tmCharSet);
return 1;
@ -469,10 +466,8 @@ GDIFontFamily::FamilyAddStylesProc(const ENUMLOGFONTEXW *lpelfe,
// We can't set the hasItalicFace flag correctly here,
// 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.
uint8_t italicStyle = (logFont.lfItalic == 0xFF ?
NS_FONT_STYLE_ITALIC : NS_FONT_STYLE_NORMAL);
fe = GDIFontEntry::CreateFontEntry(nsDependentString(lpelfe->elfFullName),
feType, italicStyle,
feType, (logFont.lfItalic == 0xFF),
(uint16_t) (logFont.lfWeight), 0,
nullptr, false);
if (!fe)
@ -717,7 +712,7 @@ gfxFontEntry*
gfxGDIFontList::LookupLocalFont(const nsAString& aFontName,
uint16_t aWeight,
int16_t aStretch,
uint8_t aStyle)
bool aItalic)
{
gfxFontEntry *lookup;
@ -734,9 +729,10 @@ gfxGDIFontList::LookupLocalFont(const nsAString& aFontName,
// 'Arial Vet' which can be used as a key in GDI font lookups).
GDIFontEntry *fe = GDIFontEntry::CreateFontEntry(lookup->Name(),
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);
if (!fe)
return nullptr;
@ -744,7 +740,7 @@ gfxGDIFontList::LookupLocalFont(const nsAString& aFontName,
// make the new font entry match the userfont entry style characteristics
fe->mWeight = (aWeight == 0 ? 400 : aWeight);
fe->mStyle = aStyle;
fe->mItalic = aItalic;
return fe;
}
@ -753,7 +749,7 @@ gfxFontEntry*
gfxGDIFontList::MakePlatformFont(const nsAString& aFontName,
uint16_t aWeight,
int16_t aStretch,
uint8_t aStyle,
bool aItalic,
const uint8_t* aFontData,
uint32_t aLength)
{
@ -812,16 +808,17 @@ gfxGDIFontList::MakePlatformFont(const nsAString& aFontName,
WinUserFontData *winUserFontData = new WinUserFontData(fontRef);
uint16_t w = (aWeight == 0 ? 400 : aWeight);
GDIFontEntry *fe = GDIFontEntry::CreateFontEntry(uniqueName,
gfxWindowsFontType(isCFF ? GFX_FONT_TYPE_PS_OPENTYPE : GFX_FONT_TYPE_TRUETYPE) /*type*/,
aStyle, w, aStretch, winUserFontData, false);
GDIFontEntry *fe = GDIFontEntry::CreateFontEntry(uniqueName,
gfxWindowsFontType(isCFF ? GFX_FONT_TYPE_PS_OPENTYPE : GFX_FONT_TYPE_TRUETYPE) /*type*/,
uint32_t(aItalic ? NS_FONT_STYLE_ITALIC : NS_FONT_STYLE_NORMAL),
w, aStretch, winUserFontData, false);
if (!fe)
return fe;
fe->mIsDataUserFont = true;
// Uniscribe doesn't place CFF fonts loaded privately
// Uniscribe doesn't place CFF fonts loaded privately
// via AddFontMemResourceEx on XP/Vista
if (isCFF && !IsWin7OrLater()) {
fe->mForceGDI = true;

View File

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

View File

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

View File

@ -33,7 +33,7 @@ public:
// for use with data fonts
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);
virtual ~MacOSFontEntry() {
@ -86,12 +86,12 @@ public:
gfxFontEntry* LookupLocalFont(const nsAString& aFontName,
uint16_t aWeight,
int16_t aStretch,
uint8_t aStyle) override;
bool aItalic) override;
gfxFontEntry* MakePlatformFont(const nsAString& aFontName,
uint16_t aWeight,
int16_t aStretch,
uint8_t aStyle,
bool aItalic,
const uint8_t* aFontData,
uint32_t aLength) override;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -193,7 +193,7 @@ public:
virtual gfxFontEntry* LookupLocalFont(const nsAString& aFontName,
uint16_t aWeight,
int16_t aStretch,
uint8_t aStyle);
bool aItalic);
/**
* Activate a platform font (needed to support @font-face src url() )
@ -201,7 +201,7 @@ public:
virtual gfxFontEntry* MakePlatformFont(const nsAString& aFontName,
uint16_t aWeight,
int16_t aStretch,
uint8_t aStyle,
bool aItalic,
const uint8_t* aFontData,
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;
# relevant fonts not present on other platforms.
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,
uint32_t aWeight,
int32_t aStretch,
uint8_t aStyle,
uint32_t aItalicStyle,
const nsTArray<gfxFontFeature>& aFeatureSettings,
uint32_t aLanguageOverride,
gfxSparseBitSet* aUnicodeRanges)
: gfxUserFontEntry(aFontSet, aFontFaceSrcList, aWeight, aStretch,
aStyle, aFeatureSettings, aLanguageOverride,
aItalicStyle, aFeatureSettings, aLanguageOverride,
aUnicodeRanges) {}
virtual void SetLoadState(UserFontLoadState aLoadState) override;

View File

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

View File

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