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 507 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
518 CPDF_CharPosList(); | 518 CPDF_CharPosList(); |
519 ~CPDF_CharPosList(); | 519 ~CPDF_CharPosList(); |
520 void Load(int nChars, | 520 void Load(int nChars, |
521 FX_DWORD* pCharCodes, | 521 FX_DWORD* pCharCodes, |
522 FX_FLOAT* pCharPos, | 522 FX_FLOAT* pCharPos, |
523 CPDF_Font* pFont, | 523 CPDF_Font* pFont, |
524 FX_FLOAT font_size); | 524 FX_FLOAT font_size); |
525 FXTEXT_CHARPOS* m_pCharPos; | 525 FXTEXT_CHARPOS* m_pCharPos; |
526 FX_DWORD m_nChars; | 526 FX_DWORD m_nChars; |
527 }; | 527 }; |
528 FX_FLOAT _CIDTransformToFloat(uint8_t ch); | 528 |
529 CPDF_CharPosList::CPDF_CharPosList() { | 529 CPDF_CharPosList::CPDF_CharPosList() { |
530 m_pCharPos = NULL; | 530 m_pCharPos = NULL; |
531 } | 531 } |
532 CPDF_CharPosList::~CPDF_CharPosList() { | 532 CPDF_CharPosList::~CPDF_CharPosList() { |
533 FX_Free(m_pCharPos); | 533 FX_Free(m_pCharPos); |
534 } | 534 } |
535 void CPDF_CharPosList::Load(int nChars, | 535 void CPDF_CharPosList::Load(int nChars, |
536 FX_DWORD* pCharCodes, | 536 FX_DWORD* pCharCodes, |
537 FX_FLOAT* pCharPos, | 537 FX_FLOAT* pCharPos, |
538 CPDF_Font* pFont, | 538 CPDF_Font* pFont, |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
571 if (bVertWriting) { | 571 if (bVertWriting) { |
572 charpos.m_OriginY = charpos.m_OriginX; | 572 charpos.m_OriginY = charpos.m_OriginX; |
573 charpos.m_OriginX = 0; | 573 charpos.m_OriginX = 0; |
574 short vx, vy; | 574 short vx, vy; |
575 pCIDFont->GetVertOrigin(CID, vx, vy); | 575 pCIDFont->GetVertOrigin(CID, vx, vy); |
576 charpos.m_OriginX -= FontSize * vx / 1000; | 576 charpos.m_OriginX -= FontSize * vx / 1000; |
577 charpos.m_OriginY -= FontSize * vy / 1000; | 577 charpos.m_OriginY -= FontSize * vy / 1000; |
578 } | 578 } |
579 const uint8_t* pTransform = pCIDFont->GetCIDTransform(CID); | 579 const uint8_t* pTransform = pCIDFont->GetCIDTransform(CID); |
580 if (pTransform && !bVert) { | 580 if (pTransform && !bVert) { |
581 charpos.m_AdjustMatrix[0] = _CIDTransformToFloat(pTransform[0]); | 581 charpos.m_AdjustMatrix[0] = pCIDFont->CIDTransformToFloat(pTransform[0]); |
582 charpos.m_AdjustMatrix[2] = _CIDTransformToFloat(pTransform[2]); | 582 charpos.m_AdjustMatrix[2] = pCIDFont->CIDTransformToFloat(pTransform[2]); |
583 charpos.m_AdjustMatrix[1] = _CIDTransformToFloat(pTransform[1]); | 583 charpos.m_AdjustMatrix[1] = pCIDFont->CIDTransformToFloat(pTransform[1]); |
584 charpos.m_AdjustMatrix[3] = _CIDTransformToFloat(pTransform[3]); | 584 charpos.m_AdjustMatrix[3] = pCIDFont->CIDTransformToFloat(pTransform[3]); |
585 charpos.m_OriginX += _CIDTransformToFloat(pTransform[4]) * FontSize; | 585 charpos.m_OriginX += |
586 charpos.m_OriginY += _CIDTransformToFloat(pTransform[5]) * FontSize; | 586 pCIDFont->CIDTransformToFloat(pTransform[4]) * FontSize; |
| 587 charpos.m_OriginY += |
| 588 pCIDFont->CIDTransformToFloat(pTransform[5]) * FontSize; |
587 charpos.m_bGlyphAdjust = TRUE; | 589 charpos.m_bGlyphAdjust = TRUE; |
588 } | 590 } |
589 } | 591 } |
590 } | 592 } |
591 FX_BOOL CPDF_TextRenderer::DrawTextPath(CFX_RenderDevice* pDevice, | 593 FX_BOOL CPDF_TextRenderer::DrawTextPath(CFX_RenderDevice* pDevice, |
592 int nChars, | 594 int nChars, |
593 FX_DWORD* pCharCodes, | 595 FX_DWORD* pCharCodes, |
594 FX_FLOAT* pCharPos, | 596 FX_FLOAT* pCharPos, |
595 CPDF_Font* pFont, | 597 CPDF_Font* pFont, |
596 FX_FLOAT font_size, | 598 FX_FLOAT font_size, |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
788 ProcessPath(&path, pObj2Device); | 790 ProcessPath(&path, pObj2Device); |
789 } | 791 } |
790 } | 792 } |
791 | 793 |
792 CFX_PathData* CPDF_Font::LoadGlyphPath(FX_DWORD charcode, int dest_width) { | 794 CFX_PathData* CPDF_Font::LoadGlyphPath(FX_DWORD charcode, int dest_width) { |
793 int glyph_index = GlyphFromCharCode(charcode); | 795 int glyph_index = GlyphFromCharCode(charcode); |
794 if (!m_Font.GetFace()) | 796 if (!m_Font.GetFace()) |
795 return nullptr; | 797 return nullptr; |
796 return m_Font.LoadGlyphPath(glyph_index, dest_width); | 798 return m_Font.LoadGlyphPath(glyph_index, dest_width); |
797 } | 799 } |
OLD | NEW |