From bf8f25aa344f3922320da5936a3eaff675439340 Mon Sep 17 00:00:00 2001 From: weolar Date: Fri, 25 May 2018 16:44:01 +0800 Subject: [PATCH] =?UTF-8?q?*=20=E4=BF=AE=E5=A4=8D=E4=B8=89=E8=8C=85?= =?UTF-8?q?=E7=AE=80=E5=8E=86=E6=8F=90=E5=87=BA=E7=9A=84=E9=97=AE=E9=A2=98?= =?UTF-8?q?=E3=80=82pdf.js=E6=98=BE=E7=A4=BA=E4=B8=80=E4=B8=AAnew=20FontFa?= =?UTF-8?q?ce=E5=87=BA=E6=9D=A5=E7=9A=84=E8=87=AA=E5=AE=9A=E4=B9=89?= =?UTF-8?q?=E5=AD=97=E4=BD=93=E6=9C=89=E6=98=BE=E7=A4=BA=E9=94=99=E8=AF=AF?= =?UTF-8?q?=EF=BC=8C=20=E7=9C=8B=E8=B5=B7=E6=9D=A5=E5=A5=BD=E5=83=8F?= =?UTF-8?q?=E6=98=AF=E5=AD=97=E5=81=8F=E4=B8=8A=EF=BC=8C=E8=80=8C=E4=B8=94?= =?UTF-8?q?=E8=A2=AB=E5=89=AA=E8=A3=81=E4=BA=86=EF=BC=8C=E6=9A=82=E6=97=B6?= =?UTF-8?q?=E8=BF=99=E9=87=8C=E8=A7=84=E9=81=BF=E4=B8=80=E4=B8=8B=E3=80=82?= =?UTF-8?q?=E5=8F=AF=E8=83=BD=E6=98=AFots=E7=9A=84=E5=BA=93=E6=AF=94?= =?UTF-8?q?=E8=BE=83=E8=80=81=E5=AF=BC=E8=87=B4=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Source/modules/canvas2d/CanvasRenderingContext2D.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2D.cpp b/third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2D.cpp index 8b0c6e5afb..e833492297 100644 --- a/third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2D.cpp +++ b/third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2D.cpp @@ -1728,8 +1728,9 @@ String CanvasRenderingContext2D::font() const return serializedFont.toString(); } -void CanvasRenderingContext2D::setFont(const String& newFont) +void CanvasRenderingContext2D::setFont(const String& newFontOrgi) { + String newFont(newFontOrgi); if (newFont == state().unparsedFont() && state().hasRealizedFont()) return; @@ -1737,6 +1738,10 @@ void CanvasRenderingContext2D::setFont(const String& newFont) if (!canvas()->document().frame()) return; + // pdf.js显示这个new FontFace出来的自定义字体有显示错误,暂时规避一下。可能是ots的库比较老 + if (WTF::kNotFound != newFont.find("g_d0_f1")) + newFont.replace("g_d0_f1", "Arial"); + CanvasFontCache* canvasFontCache = canvas()->document().canvasFontCache(); // Map the font into the text style. If the font uses keywords like larger/smaller, these will work