author | Carsten "Tomcat" Book <cbook@mozilla.com> |
Tue, 12 May 2015 12:20:38 +0200 | |
changeset 243521 | 11e007625001b84c56bc594f4b91eb4c0c2433a4 |
parent 243520 | 194bf0d7b9aae885ce84afe32f6f468ec5776b7b |
child 243522 | 4b53114ec9d4e9fce5e06c9bd2c8e91e10faec58 |
push id | 28741 |
push user | kwierso@gmail.com |
push date | Tue, 12 May 2015 23:24:40 +0000 |
treeherder | mozilla-central@d476776d920d [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
bugs | 1056479 |
milestone | 40.0a1 |
backs out | a8fca346b1ffd62bdf5c55449698c494ccd8142f |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
gfx/thebes/gfxFcPlatformFontList.cpp | file | annotate | diff | comparison | revisions | |
gfx/thebes/gfxFcPlatformFontList.h | file | annotate | diff | comparison | revisions |
--- a/gfx/thebes/gfxFcPlatformFontList.cpp +++ b/gfx/thebes/gfxFcPlatformFontList.cpp @@ -238,17 +238,17 @@ GetSampleLangForGroup(nsIAtom* aLanguage } else { // Not a special mozilla language group. // Use aLangGroup as a language code. aLanguage->ToUTF8String(aLangStr); } } } -gfxFontconfigFontEntry::gfxFontconfigFontEntry(const nsAString& aFaceName, +gfxFontConfigFontEntry::gfxFontConfigFontEntry(const nsAString& aFaceName, FcPattern* aFontPattern) : gfxFontEntry(aFaceName), mFontPattern(aFontPattern), mFTFace(nullptr), mFTFaceInitialized(false), mAspect(0.0), mFontData(nullptr) { // italic int slant; if (FcPatternGetInteger(aFontPattern, FC_SLANT, 0, &slant) != FcResultMatch) { @@ -268,17 +268,17 @@ gfxFontconfigFontEntry::gfxFontconfigFon // width int width; if (FcPatternGetInteger(aFontPattern, FC_WIDTH, 0, &width) != FcResultMatch) { width = FC_WIDTH_NORMAL; } mStretch = MapFcWidth(width); } -gfxFontconfigFontEntry::gfxFontconfigFontEntry(const nsAString& aFaceName, +gfxFontConfigFontEntry::gfxFontConfigFontEntry(const nsAString& aFaceName, uint16_t aWeight, int16_t aStretch, bool aItalic, const uint8_t *aData, FT_Face aFace) : gfxFontEntry(aFaceName), mFontPattern(FcPatternCreate()), mFTFace(aFace), mFTFaceInitialized(true), mAspect(0.0), mFontData(aData) @@ -290,37 +290,37 @@ gfxFontconfigFontEntry::gfxFontconfigFon // Make a new pattern and store the face in it so that cairo uses // that when creating a cairo font face. FcPatternAddFTFace(mFontPattern, FC_FT_FACE, mFTFace); mUserFontData = new FTUserFontData(mFTFace, mFontData); } -gfxFontconfigFontEntry::gfxFontconfigFontEntry(const nsAString& aFaceName, +gfxFontConfigFontEntry::gfxFontConfigFontEntry(const nsAString& aFaceName, FcPattern* aFontPattern, uint16_t aWeight, int16_t aStretch, bool aItalic) : gfxFontEntry(aFaceName), mFontPattern(aFontPattern), mFTFace(nullptr), mFTFaceInitialized(false), mAspect(0.0), mFontData(nullptr) { mWeight = aWeight; mItalic = aItalic; mStretch = aStretch; mIsLocalUserFont = true; } -gfxFontconfigFontEntry::~gfxFontconfigFontEntry() +gfxFontConfigFontEntry::~gfxFontConfigFontEntry() { } bool -gfxFontconfigFontEntry::SupportsLangGroup(nsIAtom *aLangGroup) const +gfxFontConfigFontEntry::SupportsLangGroup(nsIAtom *aLangGroup) const { if (!aLangGroup || aLangGroup == nsGkAtoms::Unicode) { return true; } nsAutoCString fcLang; GetSampleLangForGroup(aLangGroup, fcLang); if (fcLang.IsEmpty()) { @@ -336,17 +336,17 @@ gfxFontconfigFontEntry::SupportsLangGrou if (FcLangSetHasLang(langset, (FcChar8 *)fcLang.get()) != FcLangDifferentLang) { return true; } return false; } nsresult -gfxFontconfigFontEntry::ReadCMAP(FontInfoData *aFontInfoData) +gfxFontConfigFontEntry::ReadCMAP(FontInfoData *aFontInfoData) { // attempt this once, if errors occur leave a blank cmap if (mCharacterMap) { return NS_OK; } nsRefPtr<gfxCharacterMap> charmap; nsresult rv; @@ -404,69 +404,69 @@ static bool HasChar(FcPattern *aFont, FcChar32 aCh) { FcCharSet *charset = nullptr; FcPatternGetCharSet(aFont, FC_CHARSET, 0, &charset); return charset && FcCharSetHasChar(charset, aCh); } bool -gfxFontconfigFontEntry::TestCharacterMap(uint32_t aCh) +gfxFontConfigFontEntry::TestCharacterMap(uint32_t aCh) { // for system fonts, use the charmap in the pattern if (!mIsDataUserFont) { return HasChar(mFontPattern, aCh); } return gfxFontEntry::TestCharacterMap(aCh); } hb_blob_t* -gfxFontconfigFontEntry::GetFontTable(uint32_t aTableTag) +gfxFontConfigFontEntry::GetFontTable(uint32_t aTableTag) { // for data fonts, read directly from the font data if (mFontData) { return GetTableFromFontData(mFontData, aTableTag); } return gfxFontEntry::GetFontTable(aTableTag); } void -gfxFontconfigFontEntry::MaybeReleaseFTFace() +gfxFontConfigFontEntry::MaybeReleaseFTFace() { // don't release if either HB or Gr face still exists if (mHBFace || mGrFace) { return; } // only close out FT_Face for system fonts, not for data fonts if (!mIsDataUserFont) { if (mFTFace) { FT_Done_Face(mFTFace); mFTFace = nullptr; } mFTFaceInitialized = false; } } void -gfxFontconfigFontEntry::ForgetHBFace() +gfxFontConfigFontEntry::ForgetHBFace() { gfxFontEntry::ForgetHBFace(); MaybeReleaseFTFace(); } void -gfxFontconfigFontEntry::ReleaseGrFace(gr_face* aFace) +gfxFontConfigFontEntry::ReleaseGrFace(gr_face* aFace) { gfxFontEntry::ReleaseGrFace(aFace); MaybeReleaseFTFace(); } double -gfxFontconfigFontEntry::GetAspect() +gfxFontConfigFontEntry::GetAspect() { if (mAspect == 0.0) { // default to aspect = 0.5 mAspect = 0.5; // create a font to calculate x-height / em-height gfxFontStyle s; s.size = 100.0; // pick large size to avoid possible hinting artifacts @@ -638,17 +638,17 @@ PrepareFontOptions(FcPattern* aPattern, antialias = CAIRO_ANTIALIAS_GRAY; } else { antialias = CAIRO_ANTIALIAS_SUBPIXEL; } cairo_font_options_set_antialias(aFontOptions, antialias); } cairo_scaled_font_t* -gfxFontconfigFontEntry::CreateScaledFont(FcPattern* aRenderPattern, +gfxFontConfigFontEntry::CreateScaledFont(FcPattern* aRenderPattern, const gfxFontStyle *aStyle, bool aNeedsBold) { if (aNeedsBold) { FcPatternAddBool(aRenderPattern, FC_EMBOLDEN, FcTrue); } // synthetic oblique by skewing via the font matrix @@ -749,37 +749,37 @@ PreparePattern(FcPattern* aPattern, bool ApplyGdkScreenFontOptions(aPattern); #endif } FcDefaultSubstitute(aPattern); } gfxFont* -gfxFontconfigFontEntry::CreateFontInstance(const gfxFontStyle *aFontStyle, +gfxFontConfigFontEntry::CreateFontInstance(const gfxFontStyle *aFontStyle, bool aNeedsBold) { nsAutoRef<FcPattern> pattern(FcPatternCreate()); FcPatternAddDouble(pattern, FC_PIXEL_SIZE, aFontStyle->size); PreparePattern(pattern, aFontStyle->printerFont); nsAutoRef<FcPattern> renderPattern (FcFontRenderPrepare(nullptr, pattern, mFontPattern)); cairo_scaled_font_t* scaledFont = CreateScaledFont(renderPattern, aFontStyle, aNeedsBold); gfxFont* newFont = - new gfxFontconfigFont(scaledFont, this, aFontStyle, aNeedsBold); + new gfxFontConfigFont(scaledFont, this, aFontStyle, aNeedsBold); cairo_scaled_font_destroy(scaledFont); return newFont; } nsresult -gfxFontconfigFontEntry::CopyFontTable(uint32_t aTableTag, +gfxFontConfigFontEntry::CopyFontTable(uint32_t aTableTag, FallibleTArray<uint8_t>& aBuffer) { NS_ASSERTION(!mIsDataUserFont, "data fonts should be reading tables directly from memory"); if (!mFTFaceInitialized) { mFTFaceInitialized = true; FcChar8 *filename; @@ -811,17 +811,17 @@ gfxFontconfigFontEntry::CopyFontTable(ui aBuffer.Clear(); return NS_ERROR_FAILURE; } return NS_OK; } void -gfxFontconfigFontFamily::FindStyleVariations(FontInfoData *aFontInfoData) +gfxFontConfigFontFamily::FindStyleVariations(FontInfoData *aFontInfoData) { if (mHasStyles) { return; } // add font entries for each of the faces gfxPlatformFontList *fp = gfxPlatformFontList::PlatformFontList(); uint32_t numFonts = mFontPatterns.Length(); @@ -829,18 +829,18 @@ gfxFontconfigFontFamily::FindStyleVariat for (uint32_t i = 0; i < numFonts; i++) { FcPattern* face = mFontPatterns[i]; // figure out the psname/fullname and choose which to use as the facename nsAutoString psname, fullname; GetFaceNames(face, mName, psname, fullname); const nsAutoString& faceName = !psname.IsEmpty() ? psname : fullname; - gfxFontconfigFontEntry *fontEntry = - new gfxFontconfigFontEntry(faceName, face); + gfxFontConfigFontEntry *fontEntry = + new gfxFontConfigFontEntry(faceName, face); AddFontEntry(fontEntry); // add entry to local name lists if (!psname.IsEmpty()) { fp->AddPostscriptName(fontEntry, psname); } NS_ASSERTION(!fullname.IsEmpty(), "empty font fullname"); if (!fullname.IsEmpty()) { @@ -862,40 +862,40 @@ gfxFontconfigFontFamily::FindStyleVariat #endif } mFaceNamesInitialized = true; mFontPatterns.Clear(); SetHasStyles(true); } void -gfxFontconfigFontFamily::AddFontPattern(FcPattern* aFontPattern) +gfxFontConfigFontFamily::AddFontPattern(FcPattern* aFontPattern) { NS_ASSERTION(!mHasStyles, "font patterns must not be added to already enumerated families"); nsCountedRef<FcPattern> pattern(aFontPattern); mFontPatterns.AppendElement(pattern); } -gfxFontconfigFont::gfxFontconfigFont(cairo_scaled_font_t *aScaledFont, +gfxFontConfigFont::gfxFontConfigFont(cairo_scaled_font_t *aScaledFont, gfxFontEntry *aFontEntry, const gfxFontStyle *aFontStyle, bool aNeedsBold) : gfxFT2FontBase(aScaledFont, aFontEntry, aFontStyle) { } -gfxFontconfigFont::~gfxFontconfigFont() +gfxFontConfigFont::~gfxFontConfigFont() { } #ifdef USE_SKIA mozilla::TemporaryRef<mozilla::gfx::GlyphRenderingOptions> -gfxFontconfigFont::GetGlyphRenderingOptions(const TextRunDrawParams* aRunParams) +gfxFontConfigFont::GetGlyphRenderingOptions(const TextRunDrawParams* aRunParams) { cairo_scaled_font_t *scaled_font = CairoScaledFont(); cairo_font_options_t *options = cairo_font_options_create(); cairo_scaled_font_get_font_options(scaled_font, options); cairo_hint_style_t hint_style = cairo_font_options_get_hint_style(options); cairo_font_options_destroy(options); mozilla::gfx::FontHinting hinting; @@ -989,17 +989,17 @@ gfxFcPlatformFontList::AddFontSetFamilie // add new family if one doesn't already exist familyName.Truncate(); AppendUTF8toUTF16(ToCharPtr(canonical), familyName); nsAutoString keyName(familyName); ToLowerCase(keyName); fontFamily = mFontFamilies.GetWeak(keyName); if (!fontFamily) { - fontFamily = new gfxFontconfigFontFamily(familyName); + fontFamily = new gfxFontConfigFontFamily(familyName); mFontFamilies.Put(keyName, fontFamily); } // Add pointers to other localized family names. Most fonts // only have a single name, so the first call to GetString // will usually not match FcChar8* otherName; int n = (cIndex == 0 ? 1 : 0); @@ -1009,18 +1009,18 @@ gfxFcPlatformFontList::AddFontSetFamilie n++; if (n == int(cIndex)) { n++; // skip over canonical name } } } NS_ASSERTION(fontFamily, "font must belong to a font family"); - gfxFontconfigFontFamily* fcFamily = - static_cast<gfxFontconfigFontFamily*>(fontFamily); + gfxFontConfigFontFamily* fcFamily = + static_cast<gfxFontConfigFontFamily*>(fontFamily); fcFamily->AddFontPattern(font); // map the psname, fullname ==> font family for local font lookups nsAutoString psname, fullname; GetFaceNames(font, familyName, psname, fullname); if (!psname.IsEmpty()) { ToLowerCase(psname); mLocalNames.Put(psname, fontFamily); @@ -1182,20 +1182,20 @@ gfxFcPlatformFontList::LookupLocalFont(c // facename ==> font entry should now be in the list lookup = FindFaceName(aFontName); NS_ASSERTION(lookup, "facename to family mapping failure"); if (!lookup) { return nullptr; } } - gfxFontconfigFontEntry* fcFontEntry = - static_cast<gfxFontconfigFontEntry*>(lookup); + gfxFontConfigFontEntry* fcFontEntry = + static_cast<gfxFontConfigFontEntry*>(lookup); - return new gfxFontconfigFontEntry(fcFontEntry->Name(), + return new gfxFontConfigFontEntry(fcFontEntry->Name(), fcFontEntry->GetPattern(), aWeight, aStretch, aItalic); } gfxFontEntry* gfxFcPlatformFontList::MakePlatformFont(const nsAString& aFontName, uint16_t aWeight, int16_t aStretch, @@ -1212,17 +1212,17 @@ gfxFcPlatformFontList::MakePlatformFont( return nullptr; } if (FT_Err_Ok != FT_Select_Charmap(face, FT_ENCODING_UNICODE)) { FT_Done_Face(face); NS_Free((void*)aFontData); return nullptr; } - return new gfxFontconfigFontEntry(aFontName, aWeight, aStretch, aItalic, + return new gfxFontConfigFontEntry(aFontName, aWeight, aStretch, aItalic, aFontData, face); } gfxFontFamily* gfxFcPlatformFontList::FindFamily(const nsAString& aFamily, nsIAtom* aLanguage, bool aUseSystemFonts) {
--- a/gfx/thebes/gfxFcPlatformFontList.h +++ b/gfx/thebes/gfxFcPlatformFontList.h @@ -83,33 +83,33 @@ public: private: nsRefPtr<FTUserFontData> mUserFontData; }; // The names for the font entry and font classes should really // the common 'Fc' abbreviation but the gfxPangoFontGroup code already // defines versions of these, so use the verbose name for now. -class gfxFontconfigFontEntry : public gfxFontEntry { +class gfxFontConfigFontEntry : public gfxFontEntry { public: // used for system fonts with explicit patterns - explicit gfxFontconfigFontEntry(const nsAString& aFaceName, + explicit gfxFontConfigFontEntry(const nsAString& aFaceName, FcPattern* aFontPattern); // used for data fonts where the fontentry takes ownership // of the font data and the FT_Face - explicit gfxFontconfigFontEntry(const nsAString& aFaceName, + explicit gfxFontConfigFontEntry(const nsAString& aFaceName, uint16_t aWeight, int16_t aStretch, bool aItalic, const uint8_t *aData, FT_Face aFace); // used for @font-face local system fonts with explicit patterns - explicit gfxFontconfigFontEntry(const nsAString& aFaceName, + explicit gfxFontConfigFontEntry(const nsAString& aFaceName, FcPattern* aFontPattern, uint16_t aWeight, int16_t aStretch, bool aItalic); FcPattern* GetPattern() { return mFontPattern; } bool SupportsLangGroup(nsIAtom *aLangGroup) const override; @@ -118,17 +118,17 @@ public: bool TestCharacterMap(uint32_t aCh) override; hb_blob_t* GetFontTable(uint32_t aTableTag) override; void ForgetHBFace() override; void ReleaseGrFace(gr_face* aFace) override; protected: - virtual ~gfxFontconfigFontEntry(); + virtual ~gfxFontConfigFontEntry(); gfxFont *CreateFontInstance(const gfxFontStyle *aFontStyle, bool aNeedsBold) override; // helper method for creating cairo font from pattern cairo_scaled_font_t* CreateScaledFont(FcPattern* aRenderPattern, const gfxFontStyle *aStyle, @@ -154,47 +154,47 @@ protected: FT_Face mFTFace; bool mFTFaceInitialized; double mAspect; // data font const uint8_t* mFontData; }; -class gfxFontconfigFontFamily : public gfxFontFamily { +class gfxFontConfigFontFamily : public gfxFontFamily { public: - gfxFontconfigFontFamily(const nsAString& aName) : + gfxFontConfigFontFamily(const nsAString& aName) : gfxFontFamily(aName) { } void FindStyleVariations(FontInfoData *aFontInfoData = nullptr) override; // Families are constructed initially with just references to patterns. // When necessary, these are enumerated within FindStyleVariations. void AddFontPattern(FcPattern* aFontPattern); protected: - virtual ~gfxFontconfigFontFamily() { } + virtual ~gfxFontConfigFontFamily() { } nsTArray<nsCountedRef<FcPattern> > mFontPatterns; }; -class gfxFontconfigFont : public gfxFT2FontBase { +class gfxFontConfigFont : public gfxFT2FontBase { public: - gfxFontconfigFont(cairo_scaled_font_t *aScaledFont, + gfxFontConfigFont(cairo_scaled_font_t *aScaledFont, gfxFontEntry *aFontEntry, const gfxFontStyle *aFontStyle, bool aNeedsBold); #ifdef USE_SKIA virtual mozilla::TemporaryRef<mozilla::gfx::GlyphRenderingOptions> GetGlyphRenderingOptions(const TextRunDrawParams* aRunParams = nullptr) override; #endif protected: - virtual ~gfxFontconfigFont(); + virtual ~gfxFontConfigFont(); }; class gfxFcPlatformFontList : public gfxPlatformFontList { public: gfxFcPlatformFontList(); // initialize font lists nsresult InitFontList() override;