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_module.h" | 8 #include "../../../include/fpdfapi/fpdf_module.h" |
9 #include "pageint.h" | 9 #include "pageint.h" |
10 void CPDF_PageObject::Release() | 10 void CPDF_PageObject::Release() |
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 int index = 0; | 306 int index = 0; |
307 for (int i = 0; i < nChars; i ++) { | 307 for (int i = 0; i < nChars; i ++) { |
308 m_pCharCodes[index++] = pCharCodes[i]; | 308 m_pCharCodes[index++] = pCharCodes[i]; |
309 if (pKernings[i] != 0 && i != nChars - 1) { | 309 if (pKernings[i] != 0 && i != nChars - 1) { |
310 m_pCharCodes[index] = (FX_DWORD) - 1; | 310 m_pCharCodes[index] = (FX_DWORD) - 1; |
311 m_pCharPos[index - 1] = pKernings[i]; | 311 m_pCharPos[index - 1] = pKernings[i]; |
312 index ++; | 312 index ++; |
313 } | 313 } |
314 } | 314 } |
315 } else { | 315 } else { |
316 int offset = 0; | |
317 m_pCharCodes = (FX_DWORD*)(FX_UINTPTR)pCharCodes[0]; | 316 m_pCharCodes = (FX_DWORD*)(FX_UINTPTR)pCharCodes[0]; |
318 } | 317 } |
319 RecalcPositionData(); | 318 RecalcPositionData(); |
320 } | 319 } |
321 FX_FLOAT CPDF_TextObject::GetCharWidth(FX_DWORD charcode) const | 320 FX_FLOAT CPDF_TextObject::GetCharWidth(FX_DWORD charcode) const |
322 { | 321 { |
323 FX_FLOAT fontsize = m_TextState.GetFontSize() / 1000; | 322 FX_FLOAT fontsize = m_TextState.GetFontSize() / 1000; |
324 CPDF_Font* pFont = m_TextState.GetFont(); | 323 CPDF_Font* pFont = m_TextState.GetFont(); |
325 FX_BOOL bVertWriting = FALSE; | 324 FX_BOOL bVertWriting = FALSE; |
326 CPDF_CIDFont* pCIDFont = pFont->GetCIDFont(); | 325 CPDF_CIDFont* pCIDFont = pFont->GetCIDFont(); |
(...skipping 20 matching lines...) Expand all Loading... |
347 if (pCIDFont) { | 346 if (pCIDFont) { |
348 bVertWriting = pCIDFont->IsVertWriting(); | 347 bVertWriting = pCIDFont->IsVertWriting(); |
349 } | 348 } |
350 FX_RECT fontRect; | 349 FX_RECT fontRect; |
351 pFont->GetFontBBox(fontRect); | 350 pFont->GetFontBBox(fontRect); |
352 fontSize *= bVertWriting ? (FX_FLOAT)fontRect.Height() : (FX_FLOAT)fontRect.
Width(); | 351 fontSize *= bVertWriting ? (FX_FLOAT)fontRect.Height() : (FX_FLOAT)fontRect.
Width(); |
353 return fontSize; | 352 return fontSize; |
354 } | 353 } |
355 void CPDF_TextObject::GetCharRect(int index, CFX_FloatRect& rect) const | 354 void CPDF_TextObject::GetCharRect(int index, CFX_FloatRect& rect) const |
356 { | 355 { |
357 FX_FLOAT curpos = 0; | |
358 CPDF_Font* pFont = m_TextState.GetFont(); | 356 CPDF_Font* pFont = m_TextState.GetFont(); |
359 FX_BOOL bVertWriting = FALSE; | 357 FX_BOOL bVertWriting = FALSE; |
360 CPDF_CIDFont* pCIDFont = pFont->GetCIDFont(); | 358 CPDF_CIDFont* pCIDFont = pFont->GetCIDFont(); |
361 if (pCIDFont) { | 359 if (pCIDFont) { |
362 bVertWriting = pCIDFont->IsVertWriting(); | 360 bVertWriting = pCIDFont->IsVertWriting(); |
363 } | 361 } |
364 FX_FLOAT fontsize = m_TextState.GetFontSize() / 1000; | 362 FX_FLOAT fontsize = m_TextState.GetFontSize() / 1000; |
365 int count = 0; | 363 int count = 0; |
366 for (int i = 0; i < m_nChars; i ++) { | 364 for (int i = 0; i < m_nChars; i ++) { |
367 FX_DWORD charcode = m_nChars == 1 ? (FX_DWORD)(FX_UINTPTR)m_pCharCodes :
m_pCharCodes[i]; | 365 FX_DWORD charcode = m_nChars == 1 ? (FX_DWORD)(FX_UINTPTR)m_pCharCodes :
m_pCharCodes[i]; |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
519 if (textmode == 1 || textmode == 2 || textmode == 5 || textmode == 6) { | 517 if (textmode == 1 || textmode == 2 || textmode == 5 || textmode == 6) { |
520 FX_FLOAT half_width = m_GraphState.GetObject()->m_LineWidth / 2; | 518 FX_FLOAT half_width = m_GraphState.GetObject()->m_LineWidth / 2; |
521 m_Left -= half_width; | 519 m_Left -= half_width; |
522 m_Right += half_width; | 520 m_Right += half_width; |
523 m_Top += half_width; | 521 m_Top += half_width; |
524 m_Bottom -= half_width; | 522 m_Bottom -= half_width; |
525 } | 523 } |
526 } | 524 } |
527 void CPDF_TextObject::CalcCharPos(FX_FLOAT* pPosArray) const | 525 void CPDF_TextObject::CalcCharPos(FX_FLOAT* pPosArray) const |
528 { | 526 { |
529 FX_FLOAT curpos = 0; | |
530 int count = 0; | |
531 CPDF_Font* pFont = m_TextState.GetFont(); | 527 CPDF_Font* pFont = m_TextState.GetFont(); |
532 FX_BOOL bVertWriting = FALSE; | 528 FX_BOOL bVertWriting = FALSE; |
533 CPDF_CIDFont* pCIDFont = pFont->GetCIDFont(); | 529 CPDF_CIDFont* pCIDFont = pFont->GetCIDFont(); |
534 if (pCIDFont) { | 530 if (pCIDFont) { |
535 bVertWriting = pCIDFont->IsVertWriting(); | 531 bVertWriting = pCIDFont->IsVertWriting(); |
536 } | 532 } |
537 FX_FLOAT fontsize = m_TextState.GetFontSize(); | 533 FX_FLOAT fontsize = m_TextState.GetFontSize(); |
538 int index = 0; | 534 int index = 0; |
539 for (int i = 0; i < m_nChars; i ++) { | 535 for (int i = 0; i < m_nChars; i ++) { |
540 FX_DWORD charcode = m_nChars == 1 ? (FX_DWORD)(FX_UINTPTR)m_pCharCodes :
m_pCharCodes[i]; | 536 FX_DWORD charcode = m_nChars == 1 ? (FX_DWORD)(FX_UINTPTR)m_pCharCodes :
m_pCharCodes[i]; |
(...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1039 matrix = m_PageMatrix; | 1035 matrix = m_PageMatrix; |
1040 matrix.Concat(display_matrix); | 1036 matrix.Concat(display_matrix); |
1041 } | 1037 } |
1042 CPDF_ParseOptions::CPDF_ParseOptions() | 1038 CPDF_ParseOptions::CPDF_ParseOptions() |
1043 { | 1039 { |
1044 m_bTextOnly = FALSE; | 1040 m_bTextOnly = FALSE; |
1045 m_bMarkedContent = TRUE; | 1041 m_bMarkedContent = TRUE; |
1046 m_bSeparateForm = TRUE; | 1042 m_bSeparateForm = TRUE; |
1047 m_bDecodeInlineImage = FALSE; | 1043 m_bDecodeInlineImage = FALSE; |
1048 } | 1044 } |
OLD | NEW |