Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(193)

Unified Diff: src/pdf/SkPDFUtils.h

Issue 2322403002: SkPDF: Implement /ActualText to make text extraction correct. (Closed)
Patch Set: asserts, bounds check before read, not after Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/pdf/SkPDFMakeToUnicodeCmap.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/pdf/SkPDFUtils.h
diff --git a/src/pdf/SkPDFUtils.h b/src/pdf/SkPDFUtils.h
index a9194f2e72a61798f98752102cbf25c13476f0ea..964689f4f2771c12bbc48634ebb0b9b2ebe2613e 100644
--- a/src/pdf/SkPDFUtils.h
+++ b/src/pdf/SkPDFUtils.h
@@ -12,6 +12,7 @@
#include "SkPaint.h"
#include "SkPath.h"
#include "SkStream.h"
+#include "SkUtils.h"
class SkMatrix;
class SkPDFArray;
@@ -92,7 +93,15 @@ inline void WriteUInt8(SkDynamicMemoryWStream* wStream, uint8_t value) {
result[1] = gHex[0xF & value];
wStream->write(result, 2);
}
-
+inline void WriteUTF16beHex(SkDynamicMemoryWStream* wStream, SkUnichar utf32) {
+ uint16_t 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]);
+ }
+}
} // namespace SkPDFUtils
#endif
« no previous file with comments | « src/pdf/SkPDFMakeToUnicodeCmap.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698