mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1232822 (part 1) - Moz2Dify SetupCairoFont(). r=jfkthame.
This is now trivial.
This commit is contained in:
parent
d3fbd6b72e
commit
9979226ab1
@ -454,7 +454,7 @@ gfxDWriteFont::GetSpaceGlyph()
|
||||
}
|
||||
|
||||
bool
|
||||
gfxDWriteFont::SetupCairoFont(gfxContext *aContext)
|
||||
gfxDWriteFont::SetupCairoFont(DrawTarget* aDrawTarget)
|
||||
{
|
||||
cairo_scaled_font_t *scaledFont = GetCairoScaledFont();
|
||||
if (cairo_scaled_font_status(scaledFont) != CAIRO_STATUS_SUCCESS) {
|
||||
@ -462,8 +462,7 @@ gfxDWriteFont::SetupCairoFont(gfxContext *aContext)
|
||||
// the cairo_t, precluding any further drawing.
|
||||
return false;
|
||||
}
|
||||
cairo_set_scaled_font(gfxContext::RefCairo(aContext->GetDrawTarget()),
|
||||
scaledFont);
|
||||
cairo_set_scaled_font(gfxContext::RefCairo(aDrawTarget), scaledFont);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -33,7 +33,7 @@ public:
|
||||
|
||||
virtual uint32_t GetSpaceGlyph() override;
|
||||
|
||||
virtual bool SetupCairoFont(gfxContext *aContext) override;
|
||||
virtual bool SetupCairoFont(DrawTarget* aDrawTarget) override;
|
||||
|
||||
virtual bool AllowSubpixelAA() override
|
||||
{ return mAllowManualShowGlyphs; }
|
||||
|
@ -176,7 +176,7 @@ gfxFT2FontBase::GetGlyphWidth(DrawTarget& aDrawTarget, uint16_t aGID)
|
||||
}
|
||||
|
||||
bool
|
||||
gfxFT2FontBase::SetupCairoFont(gfxContext *aContext)
|
||||
gfxFT2FontBase::SetupCairoFont(DrawTarget* aDrawTarget)
|
||||
{
|
||||
// The scaled font ctm is not relevant right here because
|
||||
// cairo_set_scaled_font does not record the scaled font itself, but
|
||||
@ -210,7 +210,6 @@ gfxFT2FontBase::SetupCairoFont(gfxContext *aContext)
|
||||
// what is set here. It's too late to change things here as measuring has
|
||||
// already taken place. We should really be measuring with a different
|
||||
// font for pdf and ps surfaces (bug 403513).
|
||||
cairo_set_scaled_font(gfxContext::RefCairo(aContext->GetDrawTarget()),
|
||||
cairoFont);
|
||||
cairo_set_scaled_font(gfxContext::RefCairo(aDrawTarget), cairoFont);
|
||||
return true;
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ public:
|
||||
uint16_t aGID) override;
|
||||
|
||||
cairo_scaled_font_t *CairoScaledFont() { return mScaledFont; };
|
||||
virtual bool SetupCairoFont(gfxContext *aContext) override;
|
||||
virtual bool SetupCairoFont(DrawTarget* aDrawTarget) override;
|
||||
|
||||
virtual FontType GetType() const override { return FONT_TYPE_FT2; }
|
||||
|
||||
|
@ -781,7 +781,7 @@ gfxFont::~gfxFont()
|
||||
gfxFloat
|
||||
gfxFont::GetGlyphHAdvance(gfxContext *aCtx, uint16_t aGID)
|
||||
{
|
||||
if (!SetupCairoFont(aCtx)) {
|
||||
if (!SetupCairoFont(aCtx->GetDrawTarget())) {
|
||||
return 0;
|
||||
}
|
||||
if (ProvidesGlyphWidths()) {
|
||||
|
@ -1660,7 +1660,7 @@ public:
|
||||
bool aNeedTight, gfxGlyphExtents *aExtents);
|
||||
|
||||
// This is called by the default Draw() implementation above.
|
||||
virtual bool SetupCairoFont(gfxContext *aContext) = 0;
|
||||
virtual bool SetupCairoFont(DrawTarget* aDrawTarget) = 0;
|
||||
|
||||
virtual bool AllowSubpixelAA() { return true; }
|
||||
|
||||
|
@ -98,7 +98,7 @@ gfxGDIFont::ShapeText(gfxContext *aContext,
|
||||
// creating a "toy" font internally (see bug 544617).
|
||||
// We must check that this succeeded, otherwise we risk cairo creating the
|
||||
// wrong kind of font internally as a fallback (bug 744480).
|
||||
if (!SetupCairoFont(aContext)) {
|
||||
if (!SetupCairoFont(aContext->GetDrawTarget())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -125,7 +125,7 @@ gfxGDIFont::GetSpaceGlyph()
|
||||
}
|
||||
|
||||
bool
|
||||
gfxGDIFont::SetupCairoFont(gfxContext *aContext)
|
||||
gfxGDIFont::SetupCairoFont(DrawTarget* aDrawTarget)
|
||||
{
|
||||
if (!mMetrics) {
|
||||
Initialize();
|
||||
@ -136,8 +136,7 @@ gfxGDIFont::SetupCairoFont(gfxContext *aContext)
|
||||
// the cairo_t, precluding any further drawing.
|
||||
return false;
|
||||
}
|
||||
cairo_set_scaled_font(gfxContext::RefCairo(aContext->GetDrawTarget()),
|
||||
mScaledFont);
|
||||
cairo_set_scaled_font(gfxContext::RefCairo(aDrawTarget), mScaledFont);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -42,7 +42,7 @@ public:
|
||||
/* overrides for the pure virtual methods in gfxFont */
|
||||
virtual uint32_t GetSpaceGlyph() override;
|
||||
|
||||
virtual bool SetupCairoFont(gfxContext *aContext) override;
|
||||
virtual bool SetupCairoFont(DrawTarget* aDrawTarget) override;
|
||||
|
||||
/* override Measure to add padding for antialiasing */
|
||||
virtual RunMetrics Measure(gfxTextRun *aTextRun,
|
||||
|
@ -45,7 +45,7 @@ gfxGlyphExtents::GetTightGlyphExtentsAppUnits(gfxFont *aFont,
|
||||
return false;
|
||||
}
|
||||
|
||||
if (aFont->SetupCairoFont(aContext)) {
|
||||
if (aFont->SetupCairoFont(aContext->GetDrawTarget())) {
|
||||
#ifdef DEBUG_TEXT_RUN_STORAGE_METRICS
|
||||
++gGlyphExtentsSetupLazyTight;
|
||||
#endif
|
||||
|
@ -91,7 +91,7 @@ gfxGraphiteShaper::ShapeText(gfxContext *aContext,
|
||||
gfxShapedText *aShapedText)
|
||||
{
|
||||
// some font back-ends require this in order to get proper hinted metrics
|
||||
if (!mFont->SetupCairoFont(aContext)) {
|
||||
if (!mFont->SetupCairoFont(aContext->GetDrawTarget())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1471,7 +1471,7 @@ gfxHarfBuzzShaper::ShapeText(gfxContext *aContext,
|
||||
gfxShapedText *aShapedText)
|
||||
{
|
||||
// some font back-ends require this in order to get proper hinted metrics
|
||||
if (!mFont->SetupCairoFont(aContext)) {
|
||||
if (!mFont->SetupCairoFont(aContext->GetDrawTarget())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -153,15 +153,14 @@ gfxMacFont::ShapeText(gfxContext *aContext,
|
||||
}
|
||||
|
||||
bool
|
||||
gfxMacFont::SetupCairoFont(gfxContext *aContext)
|
||||
gfxMacFont::SetupCairoFont(DrawTarget* aDrawTarget)
|
||||
{
|
||||
if (cairo_scaled_font_status(mScaledFont) != CAIRO_STATUS_SUCCESS) {
|
||||
// Don't cairo_set_scaled_font as that would propagate the error to
|
||||
// the cairo_t, precluding any further drawing.
|
||||
return false;
|
||||
}
|
||||
cairo_set_scaled_font(gfxContext::RefCairo(aContext->GetDrawTarget()),
|
||||
mScaledFont);
|
||||
cairo_set_scaled_font(gfxContext::RefCairo(aDrawTarget), mScaledFont);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -28,7 +28,7 @@ public:
|
||||
return mSpaceGlyph;
|
||||
}
|
||||
|
||||
virtual bool SetupCairoFont(gfxContext *aContext) override;
|
||||
virtual bool SetupCairoFont(DrawTarget* aDrawTarget) override;
|
||||
|
||||
/* override Measure to add padding for antialiasing */
|
||||
virtual RunMetrics Measure(gfxTextRun *aTextRun,
|
||||
|
@ -1411,7 +1411,7 @@ gfxTextRun::FetchGlyphExtents(gfxContext *aRefContext)
|
||||
uint32_t glyphIndex = glyphData->GetSimpleGlyph();
|
||||
if (!extents->IsGlyphKnown(glyphIndex)) {
|
||||
if (!fontIsSetup) {
|
||||
if (!font->SetupCairoFont(aRefContext)) {
|
||||
if (!font->SetupCairoFont(aRefContext->GetDrawTarget())) {
|
||||
NS_WARNING("failed to set up font for glyph extents");
|
||||
break;
|
||||
}
|
||||
@ -1437,7 +1437,7 @@ gfxTextRun::FetchGlyphExtents(gfxContext *aRefContext)
|
||||
uint32_t glyphIndex = details->mGlyphID;
|
||||
if (!extents->IsGlyphKnownWithTightExtents(glyphIndex)) {
|
||||
if (!fontIsSetup) {
|
||||
if (!font->SetupCairoFont(aRefContext)) {
|
||||
if (!font->SetupCairoFont(aRefContext->GetDrawTarget())) {
|
||||
NS_WARNING("failed to set up font for glyph extents");
|
||||
break;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user