Skip to content

Commit

Permalink
* 修复三茅简历提出的问题。pdf.js显示一个new FontFace出来的自定义字体有显示错误,
Browse files Browse the repository at this point in the history
看起来好像是字偏上,而且被剪裁了,暂时这里规避一下。可能是ots的库比较老导致。
  • Loading branch information
weolar committed May 25, 2018
1 parent e852ddc commit bf8f25a
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1728,15 +1728,20 @@ 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;

// The style resolution required for rendering text is not available in frame-less documents.
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 <canvas> font into the text style. If the font uses keywords like larger/smaller, these will work
Expand Down

0 comments on commit bf8f25a

Please sign in to comment.