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 "core/fpdfapi/fpdf_render/render_int.h" | 7 #include "core/fpdfapi/fpdf_render/render_int.h" |
8 | 8 |
9 #include "core/fpdfapi/fpdf_font/cpdf_cidfont.h" | 9 #include "core/fpdfapi/fpdf_font/cpdf_cidfont.h" |
10 #include "core/fpdfapi/fpdf_font/cpdf_type3char.h" | 10 #include "core/fpdfapi/fpdf_font/cpdf_type3char.h" |
(...skipping 619 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
630 FX_FLOAT origin_x, | 630 FX_FLOAT origin_x, |
631 FX_FLOAT origin_y, | 631 FX_FLOAT origin_y, |
632 CPDF_Font* pFont, | 632 CPDF_Font* pFont, |
633 FX_FLOAT font_size, | 633 FX_FLOAT font_size, |
634 const CFX_Matrix* pMatrix, | 634 const CFX_Matrix* pMatrix, |
635 const CFX_ByteString& str, | 635 const CFX_ByteString& str, |
636 FX_ARGB fill_argb, | 636 FX_ARGB fill_argb, |
637 FX_ARGB stroke_argb, | 637 FX_ARGB stroke_argb, |
638 const CFX_GraphStateData* pGraphState, | 638 const CFX_GraphStateData* pGraphState, |
639 const CPDF_RenderOptions* pOptions) { | 639 const CPDF_RenderOptions* pOptions) { |
640 int nChars = pFont->CountChar(str, str.GetLength()); | 640 int nChars = pFont->CountChar(str.c_str(), str.GetLength()); |
641 if (nChars == 0) { | 641 if (nChars == 0) { |
642 return; | 642 return; |
643 } | 643 } |
644 uint32_t charcode; | 644 uint32_t charcode; |
645 int offset = 0; | 645 int offset = 0; |
646 uint32_t* pCharCodes; | 646 uint32_t* pCharCodes; |
647 FX_FLOAT* pCharPos; | 647 FX_FLOAT* pCharPos; |
648 if (nChars == 1) { | 648 if (nChars == 1) { |
649 charcode = pFont->GetNextChar(str, str.GetLength(), offset); | 649 charcode = pFont->GetNextChar(str.c_str(), str.GetLength(), offset); |
650 pCharCodes = (uint32_t*)(uintptr_t)charcode; | 650 pCharCodes = (uint32_t*)(uintptr_t)charcode; |
651 pCharPos = NULL; | 651 pCharPos = NULL; |
652 } else { | 652 } else { |
653 pCharCodes = FX_Alloc(uint32_t, nChars); | 653 pCharCodes = FX_Alloc(uint32_t, nChars); |
654 pCharPos = FX_Alloc(FX_FLOAT, nChars - 1); | 654 pCharPos = FX_Alloc(FX_FLOAT, nChars - 1); |
655 FX_FLOAT cur_pos = 0; | 655 FX_FLOAT cur_pos = 0; |
656 for (int i = 0; i < nChars; i++) { | 656 for (int i = 0; i < nChars; i++) { |
657 pCharCodes[i] = pFont->GetNextChar(str, str.GetLength(), offset); | 657 pCharCodes[i] = pFont->GetNextChar(str.c_str(), str.GetLength(), offset); |
658 if (i) { | 658 if (i) { |
659 pCharPos[i - 1] = cur_pos; | 659 pCharPos[i - 1] = cur_pos; |
660 } | 660 } |
661 cur_pos += pFont->GetCharWidthF(pCharCodes[i]) * font_size / 1000; | 661 cur_pos += pFont->GetCharWidthF(pCharCodes[i]) * font_size / 1000; |
662 } | 662 } |
663 } | 663 } |
664 CFX_Matrix matrix; | 664 CFX_Matrix matrix; |
665 if (pMatrix) | 665 if (pMatrix) |
666 matrix = *pMatrix; | 666 matrix = *pMatrix; |
667 | 667 |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
779 matrix.Concat(font_size, 0, 0, font_size, charpos.m_OriginX, | 779 matrix.Concat(font_size, 0, 0, font_size, charpos.m_OriginX, |
780 charpos.m_OriginY); | 780 charpos.m_OriginY); |
781 path.m_Path.New()->Append(pPath, &matrix); | 781 path.m_Path.New()->Append(pPath, &matrix); |
782 path.m_Matrix = *pTextMatrix; | 782 path.m_Matrix = *pTextMatrix; |
783 path.m_bStroke = bStroke; | 783 path.m_bStroke = bStroke; |
784 path.m_FillType = bFill ? FXFILL_WINDING : 0; | 784 path.m_FillType = bFill ? FXFILL_WINDING : 0; |
785 path.CalcBoundingBox(); | 785 path.CalcBoundingBox(); |
786 ProcessPath(&path, pObj2Device); | 786 ProcessPath(&path, pObj2Device); |
787 } | 787 } |
788 } | 788 } |
OLD | NEW |