Index: src/pdf/SkPDFMakeToUnicodeCmap.cpp |
diff --git a/src/pdf/SkPDFMakeToUnicodeCmap.cpp b/src/pdf/SkPDFMakeToUnicodeCmap.cpp |
index afe773207db38d63b2fca55e02dbcaa9820135c1..b610934bccacebbbe765f2c9aa6657e3fb37ab74 100644 |
--- a/src/pdf/SkPDFMakeToUnicodeCmap.cpp |
+++ b/src/pdf/SkPDFMakeToUnicodeCmap.cpp |
@@ -68,6 +68,16 @@ |
SkUnichar fUnicode; |
}; |
} // namespace |
+ |
+static void write_utf16be(SkDynamicMemoryWStream* wStream, SkUnichar utf32) { |
+ SkGlyphID utf16[2] = {0, 0}; |
+ size_t len = SkUTF16_FromUnichar(utf32, utf16); |
+ SkASSERT(len == 1 || len == 2); |
+ SkPDFUtils::WriteUInt16BE(wStream, utf16[0]); |
+ if (len == 2) { |
+ SkPDFUtils::WriteUInt16BE(wStream, utf16[1]); |
+ } |
+} |
static void write_glyph(SkDynamicMemoryWStream* cmap, |
bool multiByte, |
@@ -92,7 +102,7 @@ |
cmap->writeText("<"); |
write_glyph(cmap, multiByte, bfchar[i + j].fGlyphId); |
cmap->writeText("> <"); |
- SkPDFUtils::WriteUTF16beHex(cmap, bfchar[i + j].fUnicode); |
+ write_utf16be(cmap, bfchar[i + j].fUnicode); |
cmap->writeText(">\n"); |
} |
cmap->writeText("endbfchar\n"); |
@@ -114,7 +124,7 @@ |
cmap->writeText("> <"); |
write_glyph(cmap, multiByte, bfrange[i + j].fEnd); |
cmap->writeText("> <"); |
- SkPDFUtils::WriteUTF16beHex(cmap, bfrange[i + j].fUnicode); |
+ write_utf16be(cmap, bfrange[i + j].fUnicode); |
cmap->writeText(">\n"); |
} |
cmap->writeText("endbfrange\n"); |