| 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 FX_WORD Word, |
| 15 FX_WORD SubWord) { | 15 FX_WORD 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 = -1; | 21 FX_DWORD dwCharCode = |
| 22 | 22 pPDFFont->IsUnicodeCompatible() |
| 23 if (pPDFFont->IsUnicodeCompatible()) | 23 ? pPDFFont->CharCodeFromUnicode(Word) |
| 24 dwCharCode = pPDFFont->CharCodeFromUnicode(Word); | 24 : pFontMap->CharCodeFromUnicode(nFontIndex, Word); |
| 25 else | |
| 26 dwCharCode = pFontMap->CharCodeFromUnicode(nFontIndex, Word); | |
| 27 | 25 |
| 28 if (dwCharCode > 0) { | 26 if (dwCharCode > 0) { |
| 29 pPDFFont->AppendChar(sWord, dwCharCode); | 27 pPDFFont->AppendChar(sWord, dwCharCode); |
| 30 return sWord; | 28 return sWord; |
| 31 } | 29 } |
| 32 } | 30 } |
| 33 | 31 |
| 34 pPDFFont->AppendChar(sWord, Word); | 32 pPDFFont->AppendChar(sWord, Word); |
| 35 } | 33 } |
| 36 | 34 |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 sRet << word.ptWord.x + ptOffset.x << " " | 195 sRet << word.ptWord.x + ptOffset.x << " " |
| 198 << line.ptLine.y + line.fLineDescent << " " << word.fWidth << " " | 196 << line.ptLine.y + line.fLineDescent << " " << word.fWidth << " " |
| 199 << line.fLineAscent - line.fLineDescent << " re\nf\n"; | 197 << line.fLineAscent - line.fLineDescent << " re\nf\n"; |
| 200 } | 198 } |
| 201 } | 199 } |
| 202 } | 200 } |
| 203 } | 201 } |
| 204 | 202 |
| 205 return sRet.GetByteString(); | 203 return sRet.GetByteString(); |
| 206 } | 204 } |
| OLD | NEW |