From f107a2fd014cd39c489060f2cd1b99cd49c7d0be Mon Sep 17 00:00:00 2001 From: Hal Canary Date: Wed, 25 Jul 2018 16:52:48 -0400 Subject: SkUTF Create new header and namespace, `SkUTF` where we are putting all of our robust, well documented UTF-8, UTF-16, and UTF-32 functions: `SkUTF::{Count,Next,To}UTF{8,16,32}()`. SkUTF.h and SkUTF.cpp do not depend on the rest of Skia and are suitable for re-use in other modules. Some of the old UTF-{8,16} functions still live in SkUtils.h; their use will be phased out in future CLs. Also added more unit testing and cleaned up old tests. Removed functions that were unused outside of tests or used only once. Change-Id: Iaa59b8705abccf9c4ba082f855da368a0bad8380 Reviewed-on: https://skia-review.googlesource.com/143306 Reviewed-by: Ben Wagner Commit-Queue: Hal Canary --- src/ports/SkFontHost_mac.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/ports/SkFontHost_mac.cpp') diff --git a/src/ports/SkFontHost_mac.cpp b/src/ports/SkFontHost_mac.cpp index 18d09b4ec0..8fa8c636d6 100644 --- a/src/ports/SkFontHost_mac.cpp +++ b/src/ports/SkFontHost_mac.cpp @@ -1146,7 +1146,7 @@ uint16_t SkScalerContext_Mac::generateCharToGlyph(SkUnichar uni) { UniChar theChar[2]; // UniChar is a UTF-16 16-bit code unit. // Get the glyph - size_t numUniChar = SkUTF16_FromUnichar(uni, theChar); + size_t numUniChar = SkUTF::ToUTF16(uni, theChar); SkASSERT(sizeof(CGGlyph) <= sizeof(uint16_t)); // Undocumented behavior of CTFontGetGlyphsForCharacters with non-bmp code points: @@ -2366,7 +2366,7 @@ int SkTypeface_Mac::onCharsToGlyphs(const void* chars, Encoding encoding, src = utf16; for (int i = 0; i < glyphCount; ++i) { SkUnichar uni = SkUTF8_NextUnichar(&utf8); - utf16 += SkUTF16_FromUnichar(uni, utf16); + utf16 += SkUTF::ToUTF16(uni, utf16); } srcCount = SkToInt(utf16 - src); break; @@ -2387,7 +2387,7 @@ int SkTypeface_Mac::onCharsToGlyphs(const void* chars, Encoding encoding, UniChar* utf16 = charStorage.reset(2 * glyphCount); src = utf16; for (int i = 0; i < glyphCount; ++i) { - utf16 += SkUTF16_FromUnichar(utf32[i], utf16); + utf16 += SkUTF::ToUTF16(utf32[i], utf16); } srcCount = SkToInt(utf16 - src); break; -- cgit v1.2.3