aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xsrc/ports/SkFontHost_mac.cpp2
-rw-r--r--tests/FontHostTest.cpp20
2 files changed, 13 insertions, 9 deletions
diff --git a/src/ports/SkFontHost_mac.cpp b/src/ports/SkFontHost_mac.cpp
index 5386ac3f3e..aae7464e25 100755
--- a/src/ports/SkFontHost_mac.cpp
+++ b/src/ports/SkFontHost_mac.cpp
@@ -1981,10 +1981,10 @@ int SkTypeface_Mac::onCharsToGlyphs(const void* chars, Encoding encoding,
if (srcCount > glyphCount) {
int extra = 0;
for (int i = 0; i < glyphCount; ++i) {
+ compactedGlyphs[i] = macGlyphs[i + extra];
if (SkUTF16_IsHighSurrogate(src[i + extra])) {
++extra;
}
- compactedGlyphs[i] = macGlyphs[i + extra];
}
}
diff --git a/tests/FontHostTest.cpp b/tests/FontHostTest.cpp
index 0bb426afa8..249fe7b1fb 100644
--- a/tests/FontHostTest.cpp
+++ b/tests/FontHostTest.cpp
@@ -68,9 +68,10 @@ static void test_countGlyphs(skiatest::Reporter* reporter, SkTypeface* face) {
}
// The following three are all the same code points in various encodings.
-static uint8_t utf8Chars[] = { 0x61, 0xE4, 0xB8, 0xAD, 0xD0, 0xAF, 0xD7, 0x99, 0xD7, 0x95, 0xF0, 0x9D, 0x84, 0x9E, 0x61 };
-static uint16_t utf16Chars[] = { 0x0061, 0x4E2D, 0x042F, 0x05D9, 0x05D5, 0xD834, 0xDD1E, 0x0061 };
-static uint32_t utf32Chars[] = { 0x00000061, 0x00004E2D, 0x0000042F, 0x000005D9, 0x000005D5, 0x0001D11E, 0x00000061 };
+// a中Яיו𝄞a𠮟
+static uint8_t utf8Chars[] = { 0x61, 0xE4,0xB8,0xAD, 0xD0,0xAF, 0xD7,0x99, 0xD7,0x95, 0xF0,0x9D,0x84,0x9E, 0x61, 0xF0,0xA0,0xAE,0x9F };
+static uint16_t utf16Chars[] = { 0x0061, 0x4E2D, 0x042F, 0x05D9, 0x05D5, 0xD834,0xDD1E, 0x0061, 0xD842,0xDF9F };
+static uint32_t utf32Chars[] = { 0x00000061, 0x00004E2D, 0x0000042F, 0x000005D9, 0x000005D5, 0x0001D11E, 0x00000061, 0x00020B9F };
struct CharsToGlyphs_TestData {
const void* chars;
@@ -79,9 +80,9 @@ struct CharsToGlyphs_TestData {
SkTypeface::Encoding typefaceEncoding;
const char* name;
} static charsToGlyphs_TestData[] = {
- { utf8Chars, 7, sizeof(utf8Chars), SkTypeface::kUTF8_Encoding, "Simple UTF-8" },
- { utf16Chars, 7, sizeof(utf16Chars), SkTypeface::kUTF16_Encoding, "Simple UTF-16" },
- { utf32Chars, 7, sizeof(utf32Chars), SkTypeface::kUTF32_Encoding, "Simple UTF-32" },
+ { utf8Chars, 8, sizeof(utf8Chars), SkTypeface::kUTF8_Encoding, "Simple UTF-8" },
+ { utf16Chars, 8, sizeof(utf16Chars), SkTypeface::kUTF16_Encoding, "Simple UTF-16" },
+ { utf32Chars, 8, sizeof(utf32Chars), SkTypeface::kUTF32_Encoding, "Simple UTF-32" },
};
// Test that SkPaint::textToGlyphs agrees with SkTypeface::charsToGlyphs.
@@ -210,8 +211,11 @@ static void test_tables(skiatest::Reporter* reporter, SkTypeface* face) {
static void test_tables(skiatest::Reporter* reporter) {
static const char* const gNames[] = {
NULL, // default font
- "Arial", "Times", "Times New Roman", "Helvetica", "Courier",
- "Courier New", "Terminal", "MS Sans Serif",
+ "Helvetica", "Arial",
+ "Times", "Times New Roman",
+ "Courier", "Courier New",
+ "Terminal", "MS Sans Serif",
+ "Hiragino Mincho ProN", "MS PGothic",
};
for (size_t i = 0; i < SK_ARRAY_COUNT(gNames); ++i) {