Add check that Dwrite glyph fits in unicode table.
BUG=470146 Review URL: https://codereview.chromium.org/1218043004
This commit is contained in:
parent
eeff8bb8ff
commit
f7b54cda0d
@ -286,15 +286,17 @@ using namespace skia_advanced_typeface_metrics_utils;
|
|||||||
static void populate_glyph_to_unicode(IDWriteFontFace* fontFace,
|
static void populate_glyph_to_unicode(IDWriteFontFace* fontFace,
|
||||||
const unsigned glyphCount,
|
const unsigned glyphCount,
|
||||||
SkTDArray<SkUnichar>* glyphToUnicode) {
|
SkTDArray<SkUnichar>* glyphToUnicode) {
|
||||||
HRESULT hr = S_OK;
|
|
||||||
|
|
||||||
//Do this like free type instead
|
//Do this like free type instead
|
||||||
SkAutoTMalloc<SkUnichar> glyphToUni(glyphCount);
|
SkAutoTMalloc<SkUnichar> glyphToUni(glyphCount);
|
||||||
int maxGlyph = -1;
|
int maxGlyph = -1;
|
||||||
for (UINT32 c = 0; c < 0x10FFFF; ++c) {
|
for (UINT32 c = 0; c < 0x10FFFF; ++c) {
|
||||||
UINT16 glyph;
|
UINT16 glyph = 0;
|
||||||
hr = fontFace->GetGlyphIndices(&c, 1, &glyph);
|
HRVM(fontFace->GetGlyphIndices(&c, 1, &glyph),
|
||||||
SkASSERT(glyph < glyphCount);
|
"Failed to get glyph index.");
|
||||||
|
// Intermittent DW bug on Windows 10. See crbug.com/470146.
|
||||||
|
if (glyph >= glyphCount) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (0 < glyph) {
|
if (0 < glyph) {
|
||||||
maxGlyph = SkTMax(static_cast<int>(glyph), maxGlyph);
|
maxGlyph = SkTMax(static_cast<int>(glyph), maxGlyph);
|
||||||
glyphToUni[glyph] = c;
|
glyphToUni[glyph] = c;
|
||||||
|
Loading…
Reference in New Issue
Block a user