Bug 1617596 - Move mSpaceGlyph to gfxFont instead of defining it separately in each subclass, and de-virtualize gfxFont::GetSpaceGlyph(). r=lsalzman

Differential Revision: https://phabricator.services.mozilla.com/D63855

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Jonathan Kew 2020-02-24 14:36:52 +00:00
Родитель 267c8f0bf0
Коммит be14974fec
8 изменённых файлов: 4 добавлений и 25 удалений

Просмотреть файл

@ -82,7 +82,6 @@ gfxDWriteFont::gfxDWriteFont(const RefPtr<UnscaledFontDWrite>& aUnscaledFont,
: gfxFont(aUnscaledFont, aFontEntry, aFontStyle, anAAOption),
mFontFace(aFontFace ? aFontFace : aUnscaledFont->GetFontFace()),
mMetrics(nullptr),
mSpaceGlyph(0),
mUseSubpixelPositions(false),
mAllowManualShowGlyphs(true),
mAzureScaledFontUsedClearType(false) {
@ -441,8 +440,6 @@ bool gfxDWriteFont::HasBitmapStrikeForSize(uint32_t aSize) {
return hasStrike;
}
uint32_t gfxDWriteFont::GetSpaceGlyph() { return mSpaceGlyph; }
bool gfxDWriteFont::IsValid() const { return mFontFace != nullptr; }
IDWriteFontFace* gfxDWriteFont::GetFontFace() { return mFontFace.get(); }

Просмотреть файл

@ -35,8 +35,6 @@ class gfxDWriteFont : public gfxFont {
mozilla::UniquePtr<gfxFont> CopyWithAntialiasOption(
AntialiasOption anAAOption) override;
uint32_t GetSpaceGlyph() override;
bool AllowSubpixelAA() override { return mAllowManualShowGlyphs; }
bool IsValid() const;
@ -90,8 +88,6 @@ class gfxDWriteFont : public gfxFont {
// cache of glyph widths in 16.16 fixed-point pixels
mozilla::UniquePtr<nsDataHashtable<nsUint32HashKey, int32_t>> mGlyphWidths;
uint32_t mSpaceGlyph;
bool mUseSubpixelPositions;
bool mAllowManualShowGlyphs;

Просмотреть файл

@ -34,7 +34,6 @@ gfxFT2FontBase::gfxFT2FontBase(
const gfxFontStyle* aFontStyle, int aLoadFlags, bool aEmbolden)
: gfxFont(aUnscaledFont, aFontEntry, aFontStyle, kAntialiasDefault),
mFTFace(std::move(aFTFace)),
mSpaceGlyph(0),
mFTLoadFlags(aLoadFlags | FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH |
FT_LOAD_COLOR),
mEmbolden(aEmbolden),
@ -452,9 +451,6 @@ const gfxFont::Metrics& gfxFT2FontBase::GetHorizontalMetrics() {
return mMetrics;
}
// Get the glyphID of a space
uint32_t gfxFT2FontBase::GetSpaceGlyph() { return mSpaceGlyph; }
uint32_t gfxFT2FontBase::GetGlyph(uint32_t unicode,
uint32_t variation_selector) {
if (variation_selector) {

Просмотреть файл

@ -42,7 +42,6 @@ class gfxFT2FontBase : public gfxFont {
virtual ~gfxFT2FontBase();
uint32_t GetGlyph(uint32_t aCharCode);
uint32_t GetSpaceGlyph() override;
bool ProvidesGetGlyph() const override { return true; }
virtual uint32_t GetGlyph(uint32_t unicode,
uint32_t variation_selector) override;
@ -77,7 +76,6 @@ class gfxFT2FontBase : public gfxFont {
RefPtr<mozilla::gfx::SharedFTFace> mFTFace;
uint32_t mSpaceGlyph;
Metrics mMetrics;
int mFTLoadFlags;
bool mEmbolden;

Просмотреть файл

@ -1682,7 +1682,7 @@ class gfxFont {
nsExpirationState* GetExpirationState() { return &mExpirationState; }
// Get the glyphID of a space
virtual uint32_t GetSpaceGlyph() = 0;
uint16_t GetSpaceGlyph() { return mSpaceGlyph; }
gfxGlyphExtents* GetOrCreateGlyphExtents(int32_t aAppUnitsPerDevUnit);
@ -2116,6 +2116,9 @@ class gfxFont {
nsExpirationState mExpirationState;
// Glyph ID of the font's <space> glyph, zero if missing
uint16_t mSpaceGlyph = 0;
// the AA setting requested for this font - may affect glyph bounds
AntialiasOption mAntialiasOption;

Просмотреть файл

@ -30,7 +30,6 @@ gfxGDIFont::gfxGDIFont(GDIFontEntry* aFontEntry, const gfxFontStyle* aFontStyle,
: gfxFont(nullptr, aFontEntry, aFontStyle, anAAOption),
mFont(nullptr),
mMetrics(nullptr),
mSpaceGlyph(0),
mIsBitmap(false),
mScriptCache(nullptr) {
mNeedsSyntheticBold = aFontStyle->NeedsSyntheticBold(aFontEntry);
@ -73,8 +72,6 @@ bool gfxGDIFont::ShapeText(DrawTarget* aDrawTarget, const char16_t* aText,
const gfxFont::Metrics& gfxGDIFont::GetHorizontalMetrics() { return *mMetrics; }
uint32_t gfxGDIFont::GetSpaceGlyph() { return mSpaceGlyph; }
already_AddRefed<ScaledFont> gfxGDIFont::GetScaledFont(DrawTarget* aTarget) {
if (!mAzureScaledFont) {
LOGFONT lf;

Просмотреть файл

@ -24,9 +24,6 @@ class gfxGDIFont : public gfxFont {
HFONT GetHFONT() { return mFont; }
/* overrides for the pure virtual methods in gfxFont */
uint32_t GetSpaceGlyph() override;
already_AddRefed<mozilla::gfx::ScaledFont> GetScaledFont(
DrawTarget* aTarget) override;
@ -81,7 +78,6 @@ class gfxGDIFont : public gfxFont {
HFONT mFont;
Metrics* mMetrics;
uint32_t mSpaceGlyph;
bool mIsBitmap;
bool mNeedsSyntheticBold;

Просмотреть файл

@ -23,9 +23,6 @@ class gfxMacFont : public gfxFont {
CGFontRef GetCGFontRef() const { return mCGFont; }
/* overrides for the pure virtual methods in gfxFont */
uint32_t GetSpaceGlyph() override { return mSpaceGlyph; }
/* override Measure to add padding for antialiasing */
RunMetrics Measure(const gfxTextRun* aTextRun, uint32_t aStart, uint32_t aEnd,
BoundingBoxType aBoundingBoxType, DrawTarget* aDrawTargetForTightBoundingBox,
@ -87,7 +84,6 @@ class gfxMacFont : public gfxFont {
mozilla::UniquePtr<gfxFontShaper> mCoreTextShaper;
Metrics mMetrics;
uint32_t mSpaceGlyph;
nscolor mFontSmoothingBackgroundColor;
bool mVariationFont; // true if font has OpenType variations