diff options
author | bungeman <bungeman@google.com> | 2014-09-24 11:04:41 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-09-24 11:04:41 -0700 |
commit | 7b09aab7130c174c6a2dd4becedbddaa6cf7945d (patch) | |
tree | 9c618e8db4d27b6a871e290491b912de55778192 /tests/FontHostTest.cpp | |
parent | 2456b7681aea8d91072186b17f8209955846f2f7 (diff) | |
download | platform_external_skqp-7b09aab7130c174c6a2dd4becedbddaa6cf7945d.tar.gz platform_external_skqp-7b09aab7130c174c6a2dd4becedbddaa6cf7945d.tar.bz2 platform_external_skqp-7b09aab7130c174c6a2dd4becedbddaa6cf7945d.zip |
Correct glyph with non-bmp from typeface on Mac.
CTFontGetGlyphsForChars puts the glyph id at the index of the lead
surrogate as is documented in comments, but the code is looking at
the index of the trail surrogate.
BUG=skia:2960
R=mtklein@google.com
Author: bungeman@google.com
Review URL: https://codereview.chromium.org/596413002
Diffstat (limited to 'tests/FontHostTest.cpp')
-rw-r--r-- | tests/FontHostTest.cpp | 20 |
1 files changed, 12 insertions, 8 deletions
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) { |