| 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_font/include/cpdf_font.h" | 7 #include "core/fpdfapi/fpdf_font/include/cpdf_font.h" |
| 8 #include "core/fpdfapi/fpdf_parser/include/fpdf_parser_decode.h" | 8 #include "core/fpdfapi/fpdf_parser/include/fpdf_parser_decode.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 uint16_t Word, | 14 uint16_t Word, |
| 15 uint16_t 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 uint32_t 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 |
| 26 if (dwCharCode > 0) { | 26 if (dwCharCode > 0) { |
| 27 pPDFFont->AppendChar(sWord, dwCharCode); | 27 pPDFFont->AppendChar(sWord, dwCharCode); |
| 28 return sWord; | 28 return sWord; |
| 29 } | 29 } |
| 30 } | 30 } |
| 31 | 31 |
| (...skipping 163 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 |