Bug 1097615 - Add MOZ_OVERRIDE annotations to subclasses of gfxFont. r=jdaggett

This commit is contained in:
Jonathan Kew 2014-11-17 09:59:50 +00:00
parent 84b55b1c12
commit 43167d1667
5 changed files with 61 additions and 43 deletions

View File

@ -469,7 +469,7 @@ gfxDWriteFont::SetupCairoFont(gfxContext *aContext)
}
bool
gfxDWriteFont::IsValid()
gfxDWriteFont::IsValid() const
{
return mFontFace != nullptr;
}

View File

@ -28,17 +28,19 @@ public:
AntialiasOption = kAntialiasDefault);
~gfxDWriteFont();
virtual gfxFont* CopyWithAntialiasOption(AntialiasOption anAAOption);
virtual gfxFont*
CopyWithAntialiasOption(AntialiasOption anAAOption) MOZ_OVERRIDE;
virtual uint32_t GetSpaceGlyph();
virtual uint32_t GetSpaceGlyph() MOZ_OVERRIDE;
virtual bool SetupCairoFont(gfxContext *aContext);
virtual bool SetupCairoFont(gfxContext *aContext) MOZ_OVERRIDE;
virtual bool AllowSubpixelAA() { return mAllowManualShowGlyphs; }
virtual bool AllowSubpixelAA() MOZ_OVERRIDE
{ return mAllowManualShowGlyphs; }
virtual bool IsValid();
bool IsValid() const;
gfxFloat GetAdjustedSize() {
virtual gfxFloat GetAdjustedSize() const MOZ_OVERRIDE {
return mAdjustedSize;
}
@ -50,14 +52,15 @@ public:
BoundingBoxType aBoundingBoxType,
gfxContext *aContextForTightBoundingBox,
Spacing *aSpacing,
uint16_t aOrientation);
uint16_t aOrientation) MOZ_OVERRIDE;
virtual bool ProvidesGlyphWidths() const;
virtual bool ProvidesGlyphWidths() const MOZ_OVERRIDE;
virtual int32_t GetGlyphWidth(DrawTarget& aDrawTarget, uint16_t aGID);
virtual int32_t GetGlyphWidth(DrawTarget& aDrawTarget,
uint16_t aGID) MOZ_OVERRIDE;
virtual mozilla::TemporaryRef<mozilla::gfx::GlyphRenderingOptions>
GetGlyphRenderingOptions(const TextRunDrawParams* aRunParams = nullptr) MOZ_OVERRIDE;
GetGlyphRenderingOptions(const TextRunDrawParams* aRunParams = nullptr) MOZ_OVERRIDE;
virtual void AddSizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf,
FontCacheSizes* aSizes) const;
@ -66,12 +69,13 @@ public:
virtual FontType GetType() const { return FONT_TYPE_DWRITE; }
virtual mozilla::TemporaryRef<mozilla::gfx::ScaledFont> GetScaledFont(mozilla::gfx::DrawTarget *aTarget);
virtual mozilla::TemporaryRef<mozilla::gfx::ScaledFont>
GetScaledFont(mozilla::gfx::DrawTarget *aTarget) MOZ_OVERRIDE;
virtual cairo_scaled_font_t *GetCairoScaledFont();
virtual cairo_scaled_font_t *GetCairoScaledFont() MOZ_OVERRIDE;
protected:
virtual const Metrics& GetHorizontalMetrics();
virtual const Metrics& GetHorizontalMetrics() MOZ_OVERRIDE;
bool GetFakeMetricsForArialBlack(DWRITE_FONT_METRICS *aFontMetrics);

View File

@ -21,21 +21,23 @@ public:
uint32_t GetGlyph(uint32_t aCharCode);
void GetGlyphExtents(uint32_t aGlyph,
cairo_text_extents_t* aExtents);
virtual uint32_t GetSpaceGlyph();
virtual bool ProvidesGetGlyph() const { return true; }
virtual uint32_t GetGlyph(uint32_t unicode, uint32_t variation_selector);
virtual bool ProvidesGlyphWidths() const { return true; }
virtual int32_t GetGlyphWidth(DrawTarget& aDrawTarget, uint16_t aGID);
virtual uint32_t GetSpaceGlyph() MOZ_OVERRIDE;
virtual bool ProvidesGetGlyph() const MOZ_OVERRIDE { return true; }
virtual uint32_t GetGlyph(uint32_t unicode,
uint32_t variation_selector) MOZ_OVERRIDE;
virtual bool ProvidesGlyphWidths() const MOZ_OVERRIDE { return true; }
virtual int32_t GetGlyphWidth(DrawTarget& aDrawTarget,
uint16_t aGID) MOZ_OVERRIDE;
cairo_scaled_font_t *CairoScaledFont() { return mScaledFont; };
virtual bool SetupCairoFont(gfxContext *aContext);
virtual bool SetupCairoFont(gfxContext *aContext) MOZ_OVERRIDE;
virtual FontType GetType() const { return FONT_TYPE_FT2; }
virtual FontType GetType() const MOZ_OVERRIDE { return FONT_TYPE_FT2; }
mozilla::gfx::FontOptions* GetFontOptions() { return &mFontOptions; }
protected:
virtual const Metrics& GetHorizontalMetrics();
virtual const Metrics& GetHorizontalMetrics() MOZ_OVERRIDE;
uint32_t mSpaceGlyph;
bool mHasMetrics;

View File

@ -28,15 +28,21 @@ public:
HFONT GetHFONT() { if (!mMetrics) Initialize(); return mFont; }
gfxFloat GetAdjustedSize() { if (!mMetrics) Initialize(); return mAdjustedSize; }
virtual gfxFloat GetAdjustedSize()
{
if (!mMetrics) {
Initialize();
}
return mAdjustedSize;
}
cairo_font_face_t *CairoFontFace() { return mFontFace; }
cairo_scaled_font_t *CairoScaledFont() { return mScaledFont; }
/* overrides for the pure virtual methods in gfxFont */
virtual uint32_t GetSpaceGlyph();
virtual uint32_t GetSpaceGlyph() MOZ_OVERRIDE;
virtual bool SetupCairoFont(gfxContext *aContext);
virtual bool SetupCairoFont(gfxContext *aContext) MOZ_OVERRIDE;
/* override Measure to add padding for antialiasing */
virtual RunMetrics Measure(gfxTextRun *aTextRun,
@ -44,33 +50,36 @@ public:
BoundingBoxType aBoundingBoxType,
gfxContext *aContextForTightBoundingBox,
Spacing *aSpacing,
uint16_t aOrientation);
uint16_t aOrientation) MOZ_OVERRIDE;
/* required for MathML to suppress effects of ClearType "padding" */
virtual gfxFont* CopyWithAntialiasOption(AntialiasOption anAAOption);
virtual gfxFont*
CopyWithAntialiasOption(AntialiasOption anAAOption) MOZ_OVERRIDE;
// If the font has a cmap table, we handle it purely with harfbuzz;
// but if not (e.g. .fon fonts), we'll use a GDI callback to get glyphs.
virtual bool ProvidesGetGlyph() const {
virtual bool ProvidesGetGlyph() const MOZ_OVERRIDE {
return !mFontEntry->HasCmapTable();
}
virtual uint32_t GetGlyph(uint32_t aUnicode, uint32_t aVarSelector);
virtual uint32_t GetGlyph(uint32_t aUnicode,
uint32_t aVarSelector) MOZ_OVERRIDE;
virtual bool ProvidesGlyphWidths() const { return true; }
virtual bool ProvidesGlyphWidths() const MOZ_OVERRIDE { return true; }
// get hinted glyph width in pixels as 16.16 fixed-point value
virtual int32_t GetGlyphWidth(DrawTarget& aDrawTarget, uint16_t aGID);
virtual int32_t GetGlyphWidth(DrawTarget& aDrawTarget,
uint16_t aGID) MOZ_OVERRIDE;
virtual void AddSizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf,
FontCacheSizes* aSizes) const;
virtual void AddSizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf,
FontCacheSizes* aSizes) const;
virtual FontType GetType() const { return FONT_TYPE_GDI; }
virtual FontType GetType() const MOZ_OVERRIDE { return FONT_TYPE_GDI; }
protected:
virtual const Metrics& GetHorizontalMetrics();
virtual const Metrics& GetHorizontalMetrics() MOZ_OVERRIDE;
/* override to ensure the cairo font is set up properly */
virtual bool ShapeText(gfxContext *aContext,
@ -79,7 +88,7 @@ protected:
uint32_t aLength,
int32_t aScript,
bool aVertical,
gfxShapedText *aShapedText);
gfxShapedText *aShapedText) MOZ_OVERRIDE;
void Initialize(); // creates metrics and Cairo fonts

View File

@ -24,29 +24,32 @@ public:
CGFontRef GetCGFontRef() const { return mCGFont; }
/* overrides for the pure virtual methods in gfxFont */
virtual uint32_t GetSpaceGlyph() {
virtual uint32_t GetSpaceGlyph() MOZ_OVERRIDE {
return mSpaceGlyph;
}
virtual bool SetupCairoFont(gfxContext *aContext);
virtual bool SetupCairoFont(gfxContext *aContext) MOZ_OVERRIDE;
/* override Measure to add padding for antialiasing */
virtual RunMetrics Measure(gfxTextRun *aTextRun,
uint32_t aStart, uint32_t aEnd,
BoundingBoxType aBoundingBoxType,
gfxContext *aContextForTightBoundingBox,
Spacing *aSpacing, uint16_t aOrientation);
Spacing *aSpacing,
uint16_t aOrientation) MOZ_OVERRIDE;
// We need to provide hinted (non-linear) glyph widths if using a font
// with embedded color bitmaps (Apple Color Emoji), as Core Text renders
// the glyphs with non-linear scaling at small pixel sizes.
virtual bool ProvidesGlyphWidths() const {
virtual bool ProvidesGlyphWidths() const MOZ_OVERRIDE {
return mFontEntry->HasFontTable(TRUETYPE_TAG('s','b','i','x'));
}
virtual int32_t GetGlyphWidth(DrawTarget& aDrawTarget, uint16_t aGID);
virtual int32_t GetGlyphWidth(DrawTarget& aDrawTarget,
uint16_t aGID) MOZ_OVERRIDE;
virtual mozilla::TemporaryRef<mozilla::gfx::ScaledFont> GetScaledFont(mozilla::gfx::DrawTarget *aTarget);
virtual mozilla::TemporaryRef<mozilla::gfx::ScaledFont>
GetScaledFont(mozilla::gfx::DrawTarget *aTarget) MOZ_OVERRIDE;
virtual mozilla::TemporaryRef<mozilla::gfx::GlyphRenderingOptions>
GetGlyphRenderingOptions(const TextRunDrawParams* aRunParams = nullptr) MOZ_OVERRIDE;
@ -56,10 +59,10 @@ public:
virtual void AddSizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf,
FontCacheSizes* aSizes) const;
virtual FontType GetType() const { return FONT_TYPE_MAC; }
virtual FontType GetType() const MOZ_OVERRIDE { return FONT_TYPE_MAC; }
protected:
virtual const Metrics& GetHorizontalMetrics() {
virtual const Metrics& GetHorizontalMetrics() MOZ_OVERRIDE {
return mMetrics;
}
@ -70,7 +73,7 @@ protected:
uint32_t aLength,
int32_t aScript,
bool aVertical,
gfxShapedText *aShapedText);
gfxShapedText *aShapedText) MOZ_OVERRIDE;
void InitMetrics();
void InitMetricsFromPlatform();