Chromium Code Reviews| 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 = 0; |
|
Tom Sepez
2016/03/16 18:35:00
Init shouldn't be required given lines 23-26
Wei Li
2016/03/17 02:24:06
Acknowledged.
| |
| 22 | 22 |
|
Tom Sepez
2016/03/16 18:35:00
nit: no blank line here.
Wei Li
2016/03/17 02:24:06
Acknowledged.
| |
| 23 if (pPDFFont->IsUnicodeCompatible()) | 23 if (pPDFFont->IsUnicodeCompatible()) |
| 24 dwCharCode = pPDFFont->CharCodeFromUnicode(Word); | 24 dwCharCode = pPDFFont->CharCodeFromUnicode(Word); |
| 25 else | 25 else |
| 26 dwCharCode = pFontMap->CharCodeFromUnicode(nFontIndex, Word); | 26 dwCharCode = pFontMap->CharCodeFromUnicode(nFontIndex, Word); |
| 27 | 27 |
| 28 if (dwCharCode > 0) { | 28 if (dwCharCode > 0) { |
| 29 pPDFFont->AppendChar(sWord, dwCharCode); | 29 pPDFFont->AppendChar(sWord, dwCharCode); |
| 30 return sWord; | 30 return sWord; |
| 31 } | 31 } |
| 32 } | 32 } |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 197 sRet << word.ptWord.x + ptOffset.x << " " | 197 sRet << word.ptWord.x + ptOffset.x << " " |
| 198 << line.ptLine.y + line.fLineDescent << " " << word.fWidth << " " | 198 << line.ptLine.y + line.fLineDescent << " " << word.fWidth << " " |
| 199 << line.fLineAscent - line.fLineDescent << " re\nf\n"; | 199 << line.fLineAscent - line.fLineDescent << " re\nf\n"; |
| 200 } | 200 } |
| 201 } | 201 } |
| 202 } | 202 } |
| 203 } | 203 } |
| 204 | 204 |
| 205 return sRet.GetByteString(); | 205 return sRet.GetByteString(); |
| 206 } | 206 } |
| OLD | NEW |