Bug 1093813 - Remove the gfxContext argument from gfxHarfBuzzShaper's GetGlyphHAdvance, GetGlyphVAdvance and GetGlyphVOrigin methods. r=jfkthame

This commit is contained in:
Jonathan Watt 2014-11-10 21:41:41 +00:00
parent 6b10bf2102
commit c29761b789
3 changed files with 11 additions and 17 deletions

View File

@ -806,7 +806,7 @@ gfxFont::GetGlyphHAdvance(gfxContext *aCtx, uint16_t aGID)
if (!shaper->Initialize()) {
return 0;
}
return shaper->GetGlyphHAdvance(aCtx, aGID) / 65536.0;
return shaper->GetGlyphHAdvance(aGID) / 65536.0;
}
/*static*/

View File

@ -184,8 +184,7 @@ struct GlyphMetrics {
};
hb_position_t
gfxHarfBuzzShaper::GetGlyphHAdvance(gfxContext *aContext,
hb_codepoint_t glyph) const
gfxHarfBuzzShaper::GetGlyphHAdvance(hb_codepoint_t glyph) const
{
// font did not implement GetGlyphWidth, so get an unhinted value
// directly from the font tables
@ -208,8 +207,7 @@ gfxHarfBuzzShaper::GetGlyphHAdvance(gfxContext *aContext,
}
hb_position_t
gfxHarfBuzzShaper::GetGlyphVAdvance(gfxContext *aContext,
hb_codepoint_t glyph) const
gfxHarfBuzzShaper::GetGlyphVAdvance(hb_codepoint_t glyph) const
{
if (!mVmtxTable) {
// Must be a "vertical" font that doesn't actually have vertical metrics;
@ -244,9 +242,8 @@ gfxHarfBuzzShaper::HBGetGlyphHAdvance(hb_font_t *font, void *font_data,
gfxFont *gfxfont = fcd->mShaper->GetFont();
if (gfxfont->ProvidesGlyphWidths()) {
return gfxfont->GetGlyphWidth(fcd->mContext, glyph);
} else {
return fcd->mShaper->GetGlyphHAdvance(fcd->mContext, glyph);
}
return fcd->mShaper->GetGlyphHAdvance(glyph);
}
/* static */
@ -259,9 +256,8 @@ gfxHarfBuzzShaper::HBGetGlyphVAdvance(hb_font_t *font, void *font_data,
gfxFont *gfxfont = fcd->mShaper->GetFont();
if (gfxfont->ProvidesGlyphWidths()) {
return gfxfont->GetGlyphWidth(fcd->mContext, glyph);
} else {
return fcd->mShaper->GetGlyphVAdvance(fcd->mContext, glyph);
}
return fcd->mShaper->GetGlyphVAdvance(glyph);
}
/* static */
@ -296,15 +292,15 @@ gfxHarfBuzzShaper::HBGetGlyphVOrigin(hb_font_t *font, void *font_data,
{
const gfxHarfBuzzShaper::FontCallbackData *fcd =
static_cast<const gfxHarfBuzzShaper::FontCallbackData*>(font_data);
fcd->mShaper->GetGlyphVOrigin(fcd->mContext, glyph, x, y);
fcd->mShaper->GetGlyphVOrigin(glyph, x, y);
return true;
}
void
gfxHarfBuzzShaper::GetGlyphVOrigin(gfxContext *aContext, hb_codepoint_t aGlyph,
gfxHarfBuzzShaper::GetGlyphVOrigin(hb_codepoint_t aGlyph,
hb_position_t *aX, hb_position_t *aY) const
{
*aX = -0.5 * GetGlyphHAdvance(aContext, aGlyph);
*aX = -0.5 * GetGlyphHAdvance(aGlyph);
if (mVORGTable) {
// We checked in Initialize() that the VORG table is safely readable,

View File

@ -42,13 +42,11 @@ public:
hb_codepoint_t variation_selector) const;
// get harfbuzz glyph advance, in font design units
hb_position_t GetGlyphHAdvance(gfxContext *aContext,
hb_codepoint_t glyph) const;
hb_position_t GetGlyphHAdvance(hb_codepoint_t glyph) const;
hb_position_t GetGlyphVAdvance(gfxContext *aContext,
hb_codepoint_t glyph) const;
hb_position_t GetGlyphVAdvance(hb_codepoint_t glyph) const;
void GetGlyphVOrigin(gfxContext *aContext, hb_codepoint_t aGlyph,
void GetGlyphVOrigin(hb_codepoint_t aGlyph,
hb_position_t *aX, hb_position_t *aY) const;
// get harfbuzz horizontal advance in 16.16 fixed point format.