OLD | NEW |
1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 | 6 |
7 #include "core/fpdfapi/fpdf_parser/include/fpdf_parser_decode.h" | 7 #include "core/fpdfapi/fpdf_parser/include/fpdf_parser_decode.h" |
8 #include "core/include/fpdfapi/fpdf_resource.h" | 8 #include "core/include/fpdfapi/fpdf_resource.h" |
9 #include "fpdfsdk/include/fxedit/fx_edit.h" | 9 #include "fpdfsdk/include/fxedit/fx_edit.h" |
10 #include "fpdfsdk/include/fxedit/fxet_edit.h" | 10 #include "fpdfsdk/include/fxedit/fxet_edit.h" |
11 | 11 |
12 CFX_ByteString GetPDFWordString(IFX_Edit_FontMap* pFontMap, | 12 CFX_ByteString GetPDFWordString(IFX_Edit_FontMap* pFontMap, |
13 int32_t nFontIndex, | 13 int32_t nFontIndex, |
14 FX_WORD Word, | 14 uint16_t Word, |
15 FX_WORD SubWord) { | 15 uint16_t SubWord) { |
16 CFX_ByteString sWord; | 16 CFX_ByteString sWord; |
17 if (CPDF_Font* pPDFFont = pFontMap->GetPDFFont(nFontIndex)) { | 17 if (CPDF_Font* pPDFFont = pFontMap->GetPDFFont(nFontIndex)) { |
18 if (SubWord > 0) { | 18 if (SubWord > 0) { |
19 Word = SubWord; | 19 Word = SubWord; |
20 } else { | 20 } else { |
21 FX_DWORD dwCharCode = | 21 FX_DWORD dwCharCode = |
22 pPDFFont->IsUnicodeCompatible() | 22 pPDFFont->IsUnicodeCompatible() |
23 ? pPDFFont->CharCodeFromUnicode(Word) | 23 ? pPDFFont->CharCodeFromUnicode(Word) |
24 : pFontMap->CharCodeFromUnicode(nFontIndex, Word); | 24 : pFontMap->CharCodeFromUnicode(nFontIndex, Word); |
25 | 25 |
(...skipping 29 matching lines...) Expand all Loading... |
55 } | 55 } |
56 | 56 |
57 return sRet.GetByteString(); | 57 return sRet.GetByteString(); |
58 } | 58 } |
59 | 59 |
60 CFX_ByteString IFX_Edit::GetEditAppearanceStream( | 60 CFX_ByteString IFX_Edit::GetEditAppearanceStream( |
61 IFX_Edit* pEdit, | 61 IFX_Edit* pEdit, |
62 const CFX_FloatPoint& ptOffset, | 62 const CFX_FloatPoint& ptOffset, |
63 const CPVT_WordRange* pRange /* = NULL*/, | 63 const CPVT_WordRange* pRange /* = NULL*/, |
64 FX_BOOL bContinuous /* = TRUE*/, | 64 FX_BOOL bContinuous /* = TRUE*/, |
65 FX_WORD SubWord /* = 0*/) { | 65 uint16_t SubWord /* = 0*/) { |
66 CFX_ByteTextBuf sEditStream, sWords; | 66 CFX_ByteTextBuf sEditStream, sWords; |
67 | 67 |
68 CFX_FloatPoint ptOld(0.0f, 0.0f), ptNew(0.0f, 0.0f); | 68 CFX_FloatPoint ptOld(0.0f, 0.0f), ptNew(0.0f, 0.0f); |
69 int32_t nCurFontIndex = -1; | 69 int32_t nCurFontIndex = -1; |
70 | 70 |
71 if (IFX_Edit_Iterator* pIterator = pEdit->GetIterator()) { | 71 if (IFX_Edit_Iterator* pIterator = pEdit->GetIterator()) { |
72 if (pRange) | 72 if (pRange) |
73 pIterator->SetAt(pRange->BeginPos); | 73 pIterator->SetAt(pRange->BeginPos); |
74 else | 74 else |
75 pIterator->SetAt(0); | 75 pIterator->SetAt(0); |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 sRet << word.ptWord.x + ptOffset.x << " " | 195 sRet << word.ptWord.x + ptOffset.x << " " |
196 << line.ptLine.y + line.fLineDescent << " " << word.fWidth << " " | 196 << line.ptLine.y + line.fLineDescent << " " << word.fWidth << " " |
197 << line.fLineAscent - line.fLineDescent << " re\nf\n"; | 197 << line.fLineAscent - line.fLineDescent << " re\nf\n"; |
198 } | 198 } |
199 } | 199 } |
200 } | 200 } |
201 } | 201 } |
202 | 202 |
203 return sRet.GetByteString(); | 203 return sRet.GetByteString(); |
204 } | 204 } |
OLD | NEW |