b=569770 part 5: gfxFT2FontBase::GetHintedGlyphWidth implementation r=jfkthame

--HG--
extra : rebase_source : 9770d596e7edf369f08f85a0598d470e07f7bbae
This commit is contained in:
Karl Tomlinson 2010-12-09 20:28:51 +13:00
parent 67bd437165
commit 011c9d94ae
3 changed files with 13 additions and 0 deletions

View File

@ -202,6 +202,15 @@ gfxFT2FontBase::GetFontTable(PRUint32 aTag)
haveTable ? &buffer : nsnull);
}
PRInt32
gfxFT2FontBase::GetHintedGlyphWidth(gfxContext *aCtx, PRUint16 aGID)
{
cairo_text_extents_t extents;
GetGlyphExtents(aGID, &extents);
// convert to 16.16 fixed point
return NS_lround(0x10000 * extents.x_advance);
}
PRBool
gfxFT2FontBase::SetupCairoFont(gfxContext *aContext)
{

View File

@ -61,6 +61,8 @@ public:
virtual nsString GetUniqueName();
virtual PRUint32 GetSpaceGlyph();
virtual hb_blob_t *GetFontTable(PRUint32 aTag);
virtual PRBool ProvidesHintedWidths() const { return PR_TRUE; }
virtual PRInt32 GetHintedGlyphWidth(gfxContext *aCtx, PRUint16 aGID);
cairo_scaled_font_t *CairoScaledFont() { return mScaledFont; };
virtual PRBool SetupCairoFont(gfxContext *aContext);

View File

@ -1007,6 +1007,8 @@ public:
return PR_FALSE;
}
// The return value is interpreted as a horizontal advance in 16.16 fixed
// point format.
virtual PRInt32 GetHintedGlyphWidth(gfxContext *aCtx, PRUint16 aGID) {
return -1;
}