[SkiaPaths] Fix missing texts in 5.5_simple_font.pdf.
The SkiaPaths rendering result for corpus test file 5.5_simple_font.pdf
is missing two lines of texts. These two lines are printed one character
a time in CFX_SkiaDeviceDriver::DrawDeviceText(), and each character's
glyph size is 2 byte. However SkTextBlob::MakeFromText() is converting
each character into a 1-byte glyph, which is invalid to build a
SkTextBlob. This CL changes the |byteLength| in
SkTextBlob::MakeFromText() to match each character's glyph size
(2 bytes) to build SkTextBlob successfully.
Bug: pdfium:1356
Change-Id: Iebae964e909f35c40d2c175906fa993e191f7c6f
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/59590
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
diff --git a/core/fxge/skia/fx_skia_device.cpp b/core/fxge/skia/fx_skia_device.cpp
index d98802e..4dea726 100644
--- a/core/fxge/skia/fx_skia_device.cpp
+++ b/core/fxge/skia/fx_skia_device.cpp
@@ -1676,8 +1676,9 @@
if (0 == cp.m_AdjustMatrix[1] && 0 == cp.m_AdjustMatrix[2] &&
1 == cp.m_AdjustMatrix[3]) {
font.setScaleX(cp.m_AdjustMatrix[0]);
- auto blob = SkTextBlob::MakeFromText(&glyphs[index], 1, font,
- SkTextEncoding::kGlyphID);
+ auto blob =
+ SkTextBlob::MakeFromText(&glyphs[index], sizeof(glyphs[index]),
+ font, SkTextEncoding::kGlyphID);
m_pCanvas->drawTextBlob(blob, positions[index].fX,
positions[index].fY, paint);
font.setScaleX(1);
@@ -1691,13 +1692,15 @@
adjust.setScaleY(cp.m_AdjustMatrix[3]);
adjust.preTranslate(positions[index].fX, positions[index].fY);
m_pCanvas->concat(adjust);
- auto blob = SkTextBlob::MakeFromText(&glyphs[index], 1, font,
- SkTextEncoding::kGlyphID);
+ auto blob =
+ SkTextBlob::MakeFromText(&glyphs[index], sizeof(glyphs[index]),
+ font, SkTextEncoding::kGlyphID);
m_pCanvas->drawTextBlob(blob, 0, 0, paint);
}
} else {
- auto blob = SkTextBlob::MakeFromText(&glyphs[index], 1, font,
- SkTextEncoding::kGlyphID);
+ auto blob =
+ SkTextBlob::MakeFromText(&glyphs[index], sizeof(glyphs[index]),
+ font, SkTextEncoding::kGlyphID);
m_pCanvas->drawTextBlob(blob, positions[index].fX, positions[index].fY,
paint);
}