diff --git a/src/CanvasRenderingContext2d.cc b/src/CanvasRenderingContext2d.cc index deb1e15..54b77aa 100644 --- a/src/CanvasRenderingContext2d.cc +++ b/src/CanvasRenderingContext2d.cc @@ -982,8 +982,7 @@ Context2d::FillText(const Arguments &args) { context->savePath(); context->setTextPath(*str, x, y); - SET_SOURCE(context->state->fill); - cairo_fill(ctx); + context->fill(); context->restorePath(); return Undefined(); @@ -1010,8 +1009,7 @@ Context2d::StrokeText(const Arguments &args) { context->savePath(); context->setTextPath(*str, x, y); - SET_SOURCE(context->state->stroke); - cairo_stroke(ctx); + context->stroke(); context->restorePath(); return Undefined(); diff --git a/test/public/tests.js b/test/public/tests.js index fa65290..9193dbb 100644 --- a/test/public/tests.js +++ b/test/public/tests.js @@ -1186,12 +1186,22 @@ tests['shadow globalAlpha'] = function(ctx){ ctx.stroke(); }; -tests['shadow text'] = function(ctx){ +tests['shadow fillText()'] = function(ctx){ ctx.shadowColor = '#00c'; ctx.shadowBlur = 2; ctx.shadowOffsetX = 8; ctx.shadowOffsetY = 8; ctx.textAlign = 'center'; - ctx.font = '20px Arial'; + ctx.font = '35px Arial'; ctx.fillText("Shadow", 100, 100); }; + +tests['shadow strokeText()'] = function(ctx){ + ctx.shadowColor = '#00c'; + ctx.shadowBlur = 2; + ctx.shadowOffsetX = 8; + ctx.shadowOffsetY = 8; + ctx.textAlign = 'center'; + ctx.font = '35px Arial'; + ctx.strokeText("Shadow", 100, 100); +};