diff options
author | halcanary <halcanary@google.com> | 2016-09-16 12:09:01 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-09-16 12:09:01 -0700 |
commit | dbd16345a5b2b824f2696af791bb0f01304cf549 (patch) | |
tree | 6ba2505fdd725b02da7458e7065f4bf8656dfc13 /src/pdf/SkPDFUtils.h | |
parent | be7e3c0db3caa7a86ae233a6bd26281817b83882 (diff) |
SkPDF: Implement /ActualText to make text extraction correct.
For old API: no change.
For new API: LTR text is perfectly extracted, RTL needs better testing.
BUG=skia:5434
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2322403002
Review-Url: https://codereview.chromium.org/2322403002
Diffstat (limited to 'src/pdf/SkPDFUtils.h')
-rw-r--r-- | src/pdf/SkPDFUtils.h | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/pdf/SkPDFUtils.h b/src/pdf/SkPDFUtils.h index a9194f2e72..964689f4f2 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 |