| 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/src/fpdfapi/fpdf_render/render_int.h" | 7 #include "core/src/fpdfapi/fpdf_render/render_int.h" |
| 8 | 8 |
| 9 #include "core/include/fpdfapi/fpdf_pageobj.h" | 9 #include "core/include/fpdfapi/fpdf_pageobj.h" |
| 10 #include "core/include/fpdfapi/fpdf_render.h" | 10 #include "core/include/fpdfapi/fpdf_render.h" |
| (...skipping 641 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 652 FX_FLOAT cur_pos = 0; | 652 FX_FLOAT cur_pos = 0; |
| 653 for (int i = 0; i < nChars; i++) { | 653 for (int i = 0; i < nChars; i++) { |
| 654 pCharCodes[i] = pFont->GetNextChar(str, str.GetLength(), offset); | 654 pCharCodes[i] = pFont->GetNextChar(str, str.GetLength(), offset); |
| 655 if (i) { | 655 if (i) { |
| 656 pCharPos[i - 1] = cur_pos; | 656 pCharPos[i - 1] = cur_pos; |
| 657 } | 657 } |
| 658 cur_pos += pFont->GetCharWidthF(pCharCodes[i]) * font_size / 1000; | 658 cur_pos += pFont->GetCharWidthF(pCharCodes[i]) * font_size / 1000; |
| 659 } | 659 } |
| 660 } | 660 } |
| 661 CFX_Matrix matrix; | 661 CFX_Matrix matrix; |
| 662 if (pMatrix) { | 662 if (pMatrix) |
| 663 matrix = *pMatrix; | 663 matrix = *pMatrix; |
| 664 } | 664 |
| 665 matrix.e = origin_x; | 665 matrix.e = origin_x; |
| 666 matrix.f = origin_y; | 666 matrix.f = origin_y; |
| 667 if (pFont->GetFontType() == PDFFONT_TYPE3) | 667 |
| 668 ; | 668 if (pFont->GetFontType() != PDFFONT_TYPE3) { |
| 669 else if (stroke_argb == 0) { | 669 if (stroke_argb == 0) { |
| 670 DrawNormalText(pDevice, nChars, pCharCodes, pCharPos, pFont, font_size, | 670 DrawNormalText(pDevice, nChars, pCharCodes, pCharPos, pFont, font_size, |
| 671 &matrix, fill_argb, pOptions); | 671 &matrix, fill_argb, pOptions); |
| 672 } else | 672 } else { |
| 673 DrawTextPath(pDevice, nChars, pCharCodes, pCharPos, pFont, font_size, | 673 DrawTextPath(pDevice, nChars, pCharCodes, pCharPos, pFont, font_size, |
| 674 &matrix, NULL, pGraphState, fill_argb, stroke_argb, NULL); | 674 &matrix, NULL, pGraphState, fill_argb, stroke_argb, NULL); |
| 675 } |
| 676 } |
| 677 |
| 675 if (nChars > 1) { | 678 if (nChars > 1) { |
| 676 FX_Free(pCharCodes); | 679 FX_Free(pCharCodes); |
| 677 FX_Free(pCharPos); | 680 FX_Free(pCharPos); |
| 678 } | 681 } |
| 679 } | 682 } |
| 680 FX_BOOL CPDF_TextRenderer::DrawNormalText(CFX_RenderDevice* pDevice, | 683 FX_BOOL CPDF_TextRenderer::DrawNormalText(CFX_RenderDevice* pDevice, |
| 681 int nChars, | 684 int nChars, |
| 682 FX_DWORD* pCharCodes, | 685 FX_DWORD* pCharCodes, |
| 683 FX_FLOAT* pCharPos, | 686 FX_FLOAT* pCharPos, |
| 684 CPDF_Font* pFont, | 687 CPDF_Font* pFont, |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 780 ProcessPath(&path, pObj2Device); | 783 ProcessPath(&path, pObj2Device); |
| 781 } | 784 } |
| 782 } | 785 } |
| 783 | 786 |
| 784 CFX_PathData* CPDF_Font::LoadGlyphPath(FX_DWORD charcode, int dest_width) { | 787 CFX_PathData* CPDF_Font::LoadGlyphPath(FX_DWORD charcode, int dest_width) { |
| 785 int glyph_index = GlyphFromCharCode(charcode); | 788 int glyph_index = GlyphFromCharCode(charcode); |
| 786 if (!m_Font.GetFace()) | 789 if (!m_Font.GetFace()) |
| 787 return nullptr; | 790 return nullptr; |
| 788 return m_Font.LoadGlyphPath(glyph_index, dest_width); | 791 return m_Font.LoadGlyphPath(glyph_index, dest_width); |
| 789 } | 792 } |
| OLD | NEW |