| 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 "core/fpdfdoc/include/cpvt_word.h" |
| 10 #include "core/fpdfdoc/include/ipvt_fontmap.h" |
| 9 #include "fpdfsdk/include/fxedit/fx_edit.h" | 11 #include "fpdfsdk/include/fxedit/fx_edit.h" |
| 10 #include "fpdfsdk/include/fxedit/fxet_edit.h" | 12 #include "fpdfsdk/include/fxedit/fxet_edit.h" |
| 11 | 13 |
| 12 CFX_ByteString GetPDFWordString(IFX_Edit_FontMap* pFontMap, | 14 CFX_ByteString GetPDFWordString(IPVT_FontMap* pFontMap, |
| 13 int32_t nFontIndex, | 15 int32_t nFontIndex, |
| 14 uint16_t Word, | 16 uint16_t Word, |
| 15 uint16_t SubWord) { | 17 uint16_t SubWord) { |
| 16 CFX_ByteString sWord; | 18 CFX_ByteString sWord; |
| 17 if (CPDF_Font* pPDFFont = pFontMap->GetPDFFont(nFontIndex)) { | 19 if (CPDF_Font* pPDFFont = pFontMap->GetPDFFont(nFontIndex)) { |
| 18 if (SubWord > 0) { | 20 if (SubWord > 0) { |
| 19 Word = SubWord; | 21 Word = SubWord; |
| 20 } else { | 22 } else { |
| 21 uint32_t dwCharCode = | 23 uint32_t dwCharCode = |
| 22 pPDFFont->IsUnicodeCompatible() | 24 pPDFFont->IsUnicodeCompatible() |
| (...skipping 12 matching lines...) Expand all Loading... |
| 35 return sWord; | 37 return sWord; |
| 36 } | 38 } |
| 37 | 39 |
| 38 static CFX_ByteString GetWordRenderString(const CFX_ByteString& strWords) { | 40 static CFX_ByteString GetWordRenderString(const CFX_ByteString& strWords) { |
| 39 if (strWords.GetLength() > 0) | 41 if (strWords.GetLength() > 0) |
| 40 return PDF_EncodeString(strWords) + " Tj\n"; | 42 return PDF_EncodeString(strWords) + " Tj\n"; |
| 41 | 43 |
| 42 return ""; | 44 return ""; |
| 43 } | 45 } |
| 44 | 46 |
| 45 static CFX_ByteString GetFontSetString(IFX_Edit_FontMap* pFontMap, | 47 static CFX_ByteString GetFontSetString(IPVT_FontMap* pFontMap, |
| 46 int32_t nFontIndex, | 48 int32_t nFontIndex, |
| 47 FX_FLOAT fFontSize) { | 49 FX_FLOAT fFontSize) { |
| 48 CFX_ByteTextBuf sRet; | 50 CFX_ByteTextBuf sRet; |
| 49 | 51 |
| 50 if (pFontMap) { | 52 if (pFontMap) { |
| 51 CFX_ByteString sFontAlias = pFontMap->GetPDFFontAlias(nFontIndex); | 53 CFX_ByteString sFontAlias = pFontMap->GetPDFFontAlias(nFontIndex); |
| 52 | 54 |
| 53 if (sFontAlias.GetLength() > 0 && fFontSize > 0) | 55 if (sFontAlias.GetLength() > 0 && fFontSize > 0) |
| 54 sRet << "/" << sFontAlias << " " << fFontSize << " Tf\n"; | 56 sRet << "/" << sFontAlias << " " << fFontSize << " Tf\n"; |
| 55 } | 57 } |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 sRet << word.ptWord.x + ptOffset.x << " " | 197 sRet << word.ptWord.x + ptOffset.x << " " |
| 196 << line.ptLine.y + line.fLineDescent << " " << word.fWidth << " " | 198 << line.ptLine.y + line.fLineDescent << " " << word.fWidth << " " |
| 197 << line.fLineAscent - line.fLineDescent << " re\nf\n"; | 199 << line.fLineAscent - line.fLineDescent << " re\nf\n"; |
| 198 } | 200 } |
| 199 } | 201 } |
| 200 } | 202 } |
| 201 } | 203 } |
| 202 | 204 |
| 203 return sRet.GetByteString(); | 205 return sRet.GetByteString(); |
| 204 } | 206 } |
| OLD | NEW |