mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-28 15:23:51 +00:00
Bug 1296742 - Initialize gfxGDIFont's metrics at construction time, like other platform font subclasses, and remove its no-longer-needed support for init-on-first-use pattern. r=jrmuizel
This commit is contained in:
parent
ac04ca7f48
commit
993ba1a742
@ -41,10 +41,6 @@ public:
|
||||
|
||||
bool IsValid() const;
|
||||
|
||||
virtual gfxFloat GetAdjustedSize() const override {
|
||||
return mAdjustedSize;
|
||||
}
|
||||
|
||||
IDWriteFontFace *GetFontFace();
|
||||
|
||||
/* override Measure to add padding for antialiasing */
|
||||
|
@ -1433,7 +1433,7 @@ public:
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
virtual gfxFloat GetAdjustedSize() const {
|
||||
gfxFloat GetAdjustedSize() const {
|
||||
return mAdjustedSize > 0.0
|
||||
? mAdjustedSize
|
||||
: (mStyle.sizeAdjust == 0.0 ? 0.0 : mStyle.size);
|
||||
|
@ -52,6 +52,7 @@ gfxGDIFont::gfxGDIFont(GDIFontEntry *aFontEntry,
|
||||
mNeedsBold(aNeedsBold),
|
||||
mScriptCache(nullptr)
|
||||
{
|
||||
Initialize();
|
||||
}
|
||||
|
||||
gfxGDIFont::~gfxGDIFont()
|
||||
@ -87,9 +88,6 @@ gfxGDIFont::ShapeText(DrawTarget *aDrawTarget,
|
||||
bool aVertical,
|
||||
gfxShapedText *aShapedText)
|
||||
{
|
||||
if (!mMetrics) {
|
||||
Initialize();
|
||||
}
|
||||
if (!mIsValid) {
|
||||
NS_WARNING("invalid font! expect incorrect text rendering");
|
||||
return false;
|
||||
@ -110,27 +108,18 @@ gfxGDIFont::ShapeText(DrawTarget *aDrawTarget,
|
||||
const gfxFont::Metrics&
|
||||
gfxGDIFont::GetHorizontalMetrics()
|
||||
{
|
||||
if (!mMetrics) {
|
||||
Initialize();
|
||||
}
|
||||
return *mMetrics;
|
||||
}
|
||||
|
||||
uint32_t
|
||||
gfxGDIFont::GetSpaceGlyph()
|
||||
{
|
||||
if (!mMetrics) {
|
||||
Initialize();
|
||||
}
|
||||
return mSpaceGlyph;
|
||||
}
|
||||
|
||||
bool
|
||||
gfxGDIFont::SetupCairoFont(DrawTarget* aDrawTarget)
|
||||
{
|
||||
if (!mMetrics) {
|
||||
Initialize();
|
||||
}
|
||||
if (!mScaledFont ||
|
||||
cairo_scaled_font_status(mScaledFont) != CAIRO_STATUS_SUCCESS) {
|
||||
// Don't cairo_set_scaled_font as that would propagate the error to
|
||||
|
@ -26,15 +26,7 @@ public:
|
||||
|
||||
virtual ~gfxGDIFont();
|
||||
|
||||
HFONT GetHFONT() { if (!mMetrics) Initialize(); return mFont; }
|
||||
|
||||
virtual gfxFloat GetAdjustedSize()
|
||||
{
|
||||
if (!mMetrics) {
|
||||
Initialize();
|
||||
}
|
||||
return mAdjustedSize;
|
||||
}
|
||||
HFONT GetHFONT() { return mFont; }
|
||||
|
||||
cairo_font_face_t *CairoFontFace() { return mFontFace; }
|
||||
cairo_scaled_font_t *CairoScaledFont() { return mScaledFont; }
|
||||
|
Loading…
Reference in New Issue
Block a user