| 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 "../../include/fpdfapi/fpdf_page.h" | 7 #include "../../include/fpdfapi/fpdf_page.h" |
| 8 #include "../../include/fpdfapi/fpdf_pageobj.h" | 8 #include "../../include/fpdfapi/fpdf_pageobj.h" |
| 9 #include "../../include/fpdftext/fpdf_text.h" | 9 #include "../../include/fpdftext/fpdf_text.h" |
| 10 #include "txtproc.h" | 10 #include "txtproc.h" |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 } | 50 } |
| 51 } | 51 } |
| 52 void CTextPage::ProcessObject(CPDF_PageObject* pObject) | 52 void CTextPage::ProcessObject(CPDF_PageObject* pObject) |
| 53 { | 53 { |
| 54 if (pObject->m_Type != PDFPAGE_TEXT) { | 54 if (pObject->m_Type != PDFPAGE_TEXT) { |
| 55 return; | 55 return; |
| 56 } | 56 } |
| 57 CPDF_TextObject* pText = (CPDF_TextObject*)pObject; | 57 CPDF_TextObject* pText = (CPDF_TextObject*)pObject; |
| 58 CPDF_Font* pFont = pText->m_TextState.GetFont(); | 58 CPDF_Font* pFont = pText->m_TextState.GetFont(); |
| 59 int count = pText->CountItems(); | 59 int count = pText->CountItems(); |
| 60 FX_FLOAT* pPosArray = FX_Alloc(FX_FLOAT, count * 2); | 60 FX_FLOAT* pPosArray = FX_Alloc2D(FX_FLOAT, count, 2); |
| 61 if (pPosArray) { | 61 pText->CalcCharPos(pPosArray); |
| 62 pText->CalcCharPos(pPosArray); | 62 |
| 63 } | |
| 64 FX_FLOAT fontsize_h = pText->m_TextState.GetFontSizeH(); | 63 FX_FLOAT fontsize_h = pText->m_TextState.GetFontSizeH(); |
| 65 FX_FLOAT fontsize_v = pText->m_TextState.GetFontSizeV(); | 64 FX_FLOAT fontsize_v = pText->m_TextState.GetFontSizeV(); |
| 66 FX_DWORD space_charcode = pFont->CharCodeFromUnicode(' '); | 65 FX_DWORD space_charcode = pFont->CharCodeFromUnicode(' '); |
| 67 FX_FLOAT spacew = 0; | 66 FX_FLOAT spacew = 0; |
| 68 if (space_charcode != -1) { | 67 if (space_charcode != -1) { |
| 69 spacew = fontsize_h * pFont->GetCharWidthF(space_charcode) / 1000; | 68 spacew = fontsize_h * pFont->GetCharWidthF(space_charcode) / 1000; |
| 70 } | 69 } |
| 71 if (spacew == 0) { | 70 if (spacew == 0) { |
| 72 spacew = fontsize_h / 4; | 71 spacew = fontsize_h / 4; |
| 73 } | 72 } |
| (...skipping 706 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 780 { | 779 { |
| 781 buffer.EstimateSize(0, 10240); | 780 buffer.EstimateSize(0, 10240); |
| 782 CPDF_Page page; | 781 CPDF_Page page; |
| 783 page.Load(pDoc, pPage); | 782 page.Load(pDoc, pPage); |
| 784 CPDF_ParseOptions options; | 783 CPDF_ParseOptions options; |
| 785 options.m_bTextOnly = TRUE; | 784 options.m_bTextOnly = TRUE; |
| 786 options.m_bSeparateForm = FALSE; | 785 options.m_bSeparateForm = FALSE; |
| 787 page.ParseContent(&options); | 786 page.ParseContent(&options); |
| 788 _PDF_GetTextStream_Unicode(buffer, &page, TRUE, NULL); | 787 _PDF_GetTextStream_Unicode(buffer, &page, TRUE, NULL); |
| 789 } | 788 } |
| OLD | NEW |