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/fxge/fx_ge.h" | 7 #include "../../../include/fxge/fx_ge.h" |
8 #include "../../../include/fpdfapi/fpdf_render.h" | 8 #include "../../../include/fpdfapi/fpdf_render.h" |
9 #include "../../../include/fpdfapi/fpdf_pageobj.h" | 9 #include "../../../include/fpdfapi/fpdf_pageobj.h" |
10 #include "../fpdf_page/pageint.h" | 10 #include "../fpdf_page/pageint.h" |
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
383 textobj->GetTextMatrix(&text_matrix); | 383 textobj->GetTextMatrix(&text_matrix); |
384 CFX_AffineMatrix char_matrix = pType3Font->GetFontMatrix(); | 384 CFX_AffineMatrix char_matrix = pType3Font->GetFontMatrix(); |
385 FX_FLOAT font_size = textobj->m_TextState.GetFontSize(); | 385 FX_FLOAT font_size = textobj->m_TextState.GetFontSize(); |
386 char_matrix.Scale(font_size, font_size); | 386 char_matrix.Scale(font_size, font_size); |
387 FX_ARGB fill_argb = GetFillArgb(textobj, TRUE); | 387 FX_ARGB fill_argb = GetFillArgb(textobj, TRUE); |
388 int fill_alpha = FXARGB_A(fill_argb); | 388 int fill_alpha = FXARGB_A(fill_argb); |
389 int device_class = m_pDevice->GetDeviceClass(); | 389 int device_class = m_pDevice->GetDeviceClass(); |
390 FXTEXT_GLYPHPOS* pGlyphAndPos = NULL; | 390 FXTEXT_GLYPHPOS* pGlyphAndPos = NULL; |
391 if (device_class == FXDC_DISPLAY) { | 391 if (device_class == FXDC_DISPLAY) { |
392 pGlyphAndPos = FX_Alloc(FXTEXT_GLYPHPOS, textobj->m_nChars); | 392 pGlyphAndPos = FX_Alloc(FXTEXT_GLYPHPOS, textobj->m_nChars); |
393 FXSYS_memset32(pGlyphAndPos, 0, sizeof(FXTEXT_GLYPHPOS) * textobj->m_nCh
ars); | |
394 } else if (fill_alpha < 255) { | 393 } else if (fill_alpha < 255) { |
395 return FALSE; | 394 return FALSE; |
396 } | 395 } |
397 CPDF_RefType3Cache refTypeCache(pType3Font); | 396 CPDF_RefType3Cache refTypeCache(pType3Font); |
398 FX_DWORD *pChars = textobj->m_pCharCodes; | 397 FX_DWORD *pChars = textobj->m_pCharCodes; |
399 if (textobj->m_nChars == 1) { | 398 if (textobj->m_nChars == 1) { |
400 pChars = (FX_DWORD*)(&textobj->m_pCharCodes); | 399 pChars = (FX_DWORD*)(&textobj->m_pCharCodes); |
401 } | 400 } |
402 for (int iChar = 0; iChar < textobj->m_nChars; iChar ++) { | 401 for (int iChar = 0; iChar < textobj->m_nChars; iChar ++) { |
403 FX_DWORD charcode = pChars[iChar]; | 402 FX_DWORD charcode = pChars[iChar]; |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
533 CPDF_CharPosList::~CPDF_CharPosList() | 532 CPDF_CharPosList::~CPDF_CharPosList() |
534 { | 533 { |
535 if (m_pCharPos) { | 534 if (m_pCharPos) { |
536 FX_Free(m_pCharPos); | 535 FX_Free(m_pCharPos); |
537 } | 536 } |
538 } | 537 } |
539 void CPDF_CharPosList::Load(int nChars, FX_DWORD* pCharCodes, FX_FLOAT* pCharPos
, CPDF_Font* pFont, | 538 void CPDF_CharPosList::Load(int nChars, FX_DWORD* pCharCodes, FX_FLOAT* pCharPos
, CPDF_Font* pFont, |
540 FX_FLOAT FontSize) | 539 FX_FLOAT FontSize) |
541 { | 540 { |
542 m_pCharPos = FX_Alloc(FXTEXT_CHARPOS, nChars); | 541 m_pCharPos = FX_Alloc(FXTEXT_CHARPOS, nChars); |
543 FXSYS_memset32(m_pCharPos, 0, sizeof(FXTEXT_CHARPOS) * nChars); | |
544 m_nChars = 0; | 542 m_nChars = 0; |
545 CPDF_CIDFont* pCIDFont = pFont->GetCIDFont(); | 543 CPDF_CIDFont* pCIDFont = pFont->GetCIDFont(); |
546 FX_BOOL bVertWriting = pCIDFont && pCIDFont->IsVertWriting(); | 544 FX_BOOL bVertWriting = pCIDFont && pCIDFont->IsVertWriting(); |
547 for (int iChar = 0; iChar < nChars; iChar ++) { | 545 for (int iChar = 0; iChar < nChars; iChar ++) { |
548 FX_DWORD CharCode = nChars == 1 ? (FX_DWORD)(FX_UINTPTR)pCharCodes : pCh
arCodes[iChar]; | 546 FX_DWORD CharCode = nChars == 1 ? (FX_DWORD)(FX_UINTPTR)pCharCodes : pCh
arCodes[iChar]; |
549 if (CharCode == (FX_DWORD) - 1) { | 547 if (CharCode == (FX_DWORD) - 1) { |
550 continue; | 548 continue; |
551 } | 549 } |
552 FX_BOOL bVert = FALSE; | 550 FX_BOOL bVert = FALSE; |
553 FXTEXT_CHARPOS& charpos = m_pCharPos[m_nChars++]; | 551 FXTEXT_CHARPOS& charpos = m_pCharPos[m_nChars++]; |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
751 } | 749 } |
752 } | 750 } |
753 CFX_PathData* CPDF_Font::LoadGlyphPath(FX_DWORD charcode, int dest_width) | 751 CFX_PathData* CPDF_Font::LoadGlyphPath(FX_DWORD charcode, int dest_width) |
754 { | 752 { |
755 int glyph_index = GlyphFromCharCode(charcode); | 753 int glyph_index = GlyphFromCharCode(charcode); |
756 if (m_Font.m_Face == NULL) { | 754 if (m_Font.m_Face == NULL) { |
757 return NULL; | 755 return NULL; |
758 } | 756 } |
759 return m_Font.LoadGlyphPath(glyph_index, dest_width); | 757 return m_Font.LoadGlyphPath(glyph_index, dest_width); |
760 } | 758 } |
OLD | NEW |