From fa6ac9184a08c08d54c9409a49db6470622c08e5 Mon Sep 17 00:00:00 2001 From: 0JARVIS0 <709406687@qq.com> Date: Fri, 22 Nov 2019 18:02:47 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0=E6=96=9C=E4=BD=93?= =?UTF-8?q?=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/pen.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/pen.js b/lib/pen.js index 359550a..57e619d 100644 --- a/lib/pen.js +++ b/lib/pen.js @@ -193,8 +193,9 @@ export default class Painter { } } const fontWeight = view.css.fontWeight === 'bold' ? 'bold' : 'normal'; + const textStyle = view.css.textStyle === 'italic' ? 'italic' : 'normal'; view.css.fontSize = view.css.fontSize ? view.css.fontSize : '20rpx'; - this.ctx.font = `normal ${fontWeight} ${view.css.fontSize.toPx()}px ${view.css.fontFamily ? view.css.fontFamily : 'sans-serif'}`; + this.ctx.font = `${textStyle} ${fontWeight} ${view.css.fontSize.toPx()}px ${view.css.fontFamily ? view.css.fontFamily : 'sans-serif'}`; // this.ctx.setFontSize(view.css.fontSize.toPx()); // 计算行数 let lines = 0;