diff options
author | Hal Canary <halcanary@google.com> | 2018-07-25 16:52:48 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-07-31 20:11:19 +0000 |
commit | f107a2fd014cd39c489060f2cd1b99cd49c7d0be (patch) | |
tree | 5c324821344901869203bbe055be8d3f69f696cb /src/ports/SkFontHost_win.cpp | |
parent | 1935aa3d27cd4ed4aef2dc04360f247a541d4b00 (diff) |
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 <bungeman@google.com>
Commit-Queue: Hal Canary <halcanary@google.com>
Diffstat (limited to 'src/ports/SkFontHost_win.cpp')
-rw-r--r-- | src/ports/SkFontHost_win.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/ports/SkFontHost_win.cpp b/src/ports/SkFontHost_win.cpp index 07d37aedfe..4ee8bb44fd 100644 --- a/src/ports/SkFontHost_win.cpp +++ b/src/ports/SkFontHost_win.cpp @@ -795,7 +795,7 @@ uint16_t SkScalerContext_GDI::generateCharToGlyph(SkUnichar utf32) { uint16_t index = 0; WCHAR utf16[2]; // TODO(ctguil): Support characters that generate more than one glyph. - if (SkUTF16_FromUnichar(utf32, (uint16_t*)utf16) == 1) { + if (SkUTF::ToUTF16(utf32, (uint16_t*)utf16) == 1) { // Type1 fonts fail with uniscribe API. Use GetGlyphIndices for plane 0. /** Real documentation for GetGlyphIndiciesW: @@ -2103,7 +2103,7 @@ int LogFontTypeface::onCharsToGlyphs(const void* chars, Encoding encoding, // Try a run of non-bmp. while (glyphIndex < glyphCount && currentChar > 0xFFFF) { - SkUTF16_FromUnichar(currentChar, reinterpret_cast<uint16_t*>(scratch)); + SkUTF::ToUTF16(currentChar, reinterpret_cast<uint16_t*>(scratch)); glyphs[glyphIndex] = nonBmpCharToGlyph(hdc, &sc, scratch); ++glyphIndex; if (glyphIndex < glyphCount) { @@ -2158,7 +2158,7 @@ int LogFontTypeface::onCharsToGlyphs(const void* chars, Encoding encoding, // Try a run of non-bmp. while (glyphIndex < glyphCount && utf32[glyphIndex] > 0xFFFF) { - SkUTF16_FromUnichar(utf32[glyphIndex], reinterpret_cast<uint16_t*>(scratch)); + SkUTF::ToUTF16(utf32[glyphIndex], reinterpret_cast<uint16_t*>(scratch)); glyphs[glyphIndex] = nonBmpCharToGlyph(hdc, &sc, scratch); ++glyphIndex; } |