From 53284484f0f87ccd511bf99a6a372a94b27cfc81 Mon Sep 17 00:00:00 2001 From: CPPAlien Date: Thu, 19 Jul 2018 19:10:29 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8A=A0=E5=85=A5textStyle:stroke=20=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/pen.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/pen.js b/lib/pen.js index a355889..9d25292 100644 --- a/lib/pen.js +++ b/lib/pen.js @@ -225,7 +225,11 @@ export default class Painter { } const x = -(width / 2); const y = -(height / 2) + (i === 0 ? view.css.fontSize.toPx() : (view.css.fontSize.toPx() + i * lineHeight)); - this.ctx.fillText(text, x, y); + if (view.css.textStyle === 'stroke') { + this.ctx.strokeText(text, x, y, measuredWith); + } else { + this.ctx.fillText(text, x, y, measuredWith); + } const fontSize = view.css.fontSize.toPx(); if (view.css.textDecoration) { this.ctx.beginPath();