提交 4422f4dd 编写于 作者: B Behdad Esfahbod

Don't pass invalid Unicode codepoint to Skia

Bug: 15849380
Change-Id: Ib5285e57c5806bd399600fadd56e8bc809da323f
上级 a8e7eb63
......@@ -258,6 +258,12 @@ static hb_bool_t harfbuzzGetGlyph(hb_font_t* hbFont, void* fontData, hb_codepoin
MinikinPaint* paint = reinterpret_cast<MinikinPaint*>(fontData);
MinikinFont* font = paint->font;
uint32_t glyph_id;
/* HarfBuzz replaces broken input codepoints with (unsigned int) -1.
* Skia expects valid Unicode.
* Replace invalid codepoints with U+FFFD REPLACEMENT CHARACTER.
*/
if (unicode > 0x10FFFF)
unicode = 0xFFFD;
bool ok = font->GetGlyph(unicode, &glyph_id);
if (ok) {
*glyph = glyph_id;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册