| 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 698 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  772 { |  771 { | 
|  773     buffer.EstimateSize(0, 10240); |  772     buffer.EstimateSize(0, 10240); | 
|  774     CPDF_Page page; |  773     CPDF_Page page; | 
|  775     page.Load(pDoc, pPage); |  774     page.Load(pDoc, pPage); | 
|  776     CPDF_ParseOptions options; |  775     CPDF_ParseOptions options; | 
|  777     options.m_bTextOnly = TRUE; |  776     options.m_bTextOnly = TRUE; | 
|  778     options.m_bSeparateForm = FALSE; |  777     options.m_bSeparateForm = FALSE; | 
|  779     page.ParseContent(&options); |  778     page.ParseContent(&options); | 
|  780     _PDF_GetTextStream_Unicode(buffer, &page, TRUE, NULL); |  779     _PDF_GetTextStream_Unicode(buffer, &page, TRUE, NULL); | 
|  781 } |  780 } | 
| OLD | NEW |