b=385263 a PangoFcFont using tree cairo r=roc

This commit is contained in:
Karl Tomlinson 2008-09-27 12:21:55 +12:00
parent a5d88b8c31
commit bd1cf53da5
4 changed files with 1054 additions and 534 deletions

View File

@ -70,50 +70,6 @@ public:
};
class gfxPangoFont : public gfxFont {
public:
gfxPangoFont (gfxPangoFontEntry *aFontEntry,
const gfxFontStyle *aFontStyle);
virtual ~gfxPangoFont ();
static already_AddRefed<gfxPangoFont> GetOrMakeFont(PangoFont *aPangoFont);
static void Shutdown();
virtual const gfxFont::Metrics& GetMetrics();
PangoFont *GetPangoFont() { if (!mPangoFont) RealizePangoFont(); return mPangoFont; }
// Check GetStyle()->sizeAdjust != 0.0 before calling this
gfxFloat GetAdjustedSize() { if (!mPangoFont) RealizePangoFont(); return mAdjustedSize; }
virtual nsString GetUniqueName();
// Get the glyphID of a space
virtual PRUint32 GetSpaceGlyph() {
NS_ASSERTION(GetStyle()->size != 0,
"forgot to short-circuit a text run with zero-sized font?");
GetMetrics();
return mSpaceGlyph;
}
protected:
PangoFont *mPangoFont;
cairo_scaled_font_t *mCairoFont;
PRBool mHasMetrics;
PRUint32 mSpaceGlyph;
Metrics mMetrics;
gfxFloat mAdjustedSize;
gfxPangoFont(PangoFont *aPangoFont, gfxPangoFontEntry *aFontEntry,
const gfxFontStyle *aFontStyle);
void RealizePangoFont();
void GetCharSize(const char aChar, gfxSize& aInkSize, gfxSize& aLogSize,
PRUint32 *aGlyphID = nsnull);
virtual PRBool SetupCairoFont(gfxContext *aContext);
};
class THEBES_API gfxPangoFontGroup : public gfxFontGroup {
public:
gfxPangoFontGroup (const nsAString& families,
@ -128,9 +84,14 @@ public:
virtual gfxTextRun *MakeTextRun(const PRUint8 *aString, PRUint32 aLength,
const Parameters *aParams, PRUint32 aFlags);
virtual gfxPangoFont *GetFontAt(PRInt32 i);
virtual gfxFont *GetFontAt(PRInt32 i);
static void Shutdown();
protected:
PangoFont *mBasePangoFont;
gfxFloat mAdjustedSize;
// ****** Textrun glyph conversion helpers ******
/**
@ -162,6 +123,15 @@ protected:
#endif
void GetFcFamilies(nsAString &aFcFamilies);
PangoFont *GetBasePangoFont();
// Check GetStyle()->sizeAdjust != 0.0 before calling this
gfxFloat GetAdjustedSize()
{
if (!mBasePangoFont)
GetBasePangoFont();
return mAdjustedSize;
}
};
class gfxPangoFontWrapper {

View File

@ -55,7 +55,7 @@ gfxBeOSPlatform::~gfxBeOSPlatform()
gfxFontconfigUtils::Shutdown();
sFontconfigUtils = nsnull;
gfxPangoFont::Shutdown();
gfxPangoFontGroup::Shutdown();
#if 0
// It would be nice to do this (although it might need to be after

File diff suppressed because it is too large Load Diff

View File

@ -133,7 +133,7 @@ gfxPlatformGtk::~gfxPlatformGtk()
sFontconfigUtils = nsnull;
#ifdef MOZ_PANGO
gfxPangoFont::Shutdown();
gfxPangoFontGroup::Shutdown();
#else
delete gPlatformFonts;
gPlatformFonts = NULL;