| 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 <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 746 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 757 RenderSingleObject(&path, pObj2Device); | 757 RenderSingleObject(&path, pObj2Device); |
| 758 return; | 758 return; |
| 759 } | 759 } |
| 760 CFX_FontCache* pCache; | 760 CFX_FontCache* pCache; |
| 761 if (pFont->m_pDocument) { | 761 if (pFont->m_pDocument) { |
| 762 pCache = pFont->m_pDocument->GetRenderData()->GetFontCache(); | 762 pCache = pFont->m_pDocument->GetRenderData()->GetFontCache(); |
| 763 } else { | 763 } else { |
| 764 pCache = CFX_GEModule::Get()->GetFontCache(); | 764 pCache = CFX_GEModule::Get()->GetFontCache(); |
| 765 } | 765 } |
| 766 CFX_FaceCache* pFaceCache = pCache->GetCachedFace(&pFont->m_Font); | 766 CFX_FaceCache* pFaceCache = pCache->GetCachedFace(&pFont->m_Font); |
| 767 FX_FONTCACHE_DEFINE(pCache, &pFont->m_Font); | 767 CFX_AutoFontCache autoFontCache(pCache, &pFont->m_Font); |
| 768 CPDF_CharPosList CharPosList; | 768 CPDF_CharPosList CharPosList; |
| 769 CharPosList.Load(textobj->m_nChars, textobj->m_pCharCodes, | 769 CharPosList.Load(textobj->m_nChars, textobj->m_pCharCodes, |
| 770 textobj->m_pCharPos, pFont, font_size); | 770 textobj->m_pCharPos, pFont, font_size); |
| 771 for (uint32_t i = 0; i < CharPosList.m_nChars; i++) { | 771 for (uint32_t i = 0; i < CharPosList.m_nChars; i++) { |
| 772 FXTEXT_CHARPOS& charpos = CharPosList.m_pCharPos[i]; | 772 FXTEXT_CHARPOS& charpos = CharPosList.m_pCharPos[i]; |
| 773 const CFX_PathData* pPath = pFaceCache->LoadGlyphPath( | 773 const CFX_PathData* pPath = pFaceCache->LoadGlyphPath( |
| 774 &pFont->m_Font, charpos.m_GlyphIndex, charpos.m_FontCharWidth); | 774 &pFont->m_Font, charpos.m_GlyphIndex, charpos.m_FontCharWidth); |
| 775 if (!pPath) { | 775 if (!pPath) { |
| 776 continue; | 776 continue; |
| 777 } | 777 } |
| 778 CPDF_PathObject path; | 778 CPDF_PathObject path; |
| 779 path.m_GraphState = textobj->m_GraphState; | 779 path.m_GraphState = textobj->m_GraphState; |
| 780 path.m_ColorState = textobj->m_ColorState; | 780 path.m_ColorState = textobj->m_ColorState; |
| 781 CFX_Matrix matrix; | 781 CFX_Matrix matrix; |
| 782 if (charpos.m_bGlyphAdjust) | 782 if (charpos.m_bGlyphAdjust) |
| 783 matrix.Set(charpos.m_AdjustMatrix[0], charpos.m_AdjustMatrix[1], | 783 matrix.Set(charpos.m_AdjustMatrix[0], charpos.m_AdjustMatrix[1], |
| 784 charpos.m_AdjustMatrix[2], charpos.m_AdjustMatrix[3], 0, 0); | 784 charpos.m_AdjustMatrix[2], charpos.m_AdjustMatrix[3], 0, 0); |
| 785 matrix.Concat(font_size, 0, 0, font_size, charpos.m_OriginX, | 785 matrix.Concat(font_size, 0, 0, font_size, charpos.m_OriginX, |
| 786 charpos.m_OriginY); | 786 charpos.m_OriginY); |
| 787 path.m_Path.New()->Append(pPath, &matrix); | 787 path.m_Path.New()->Append(pPath, &matrix); |
| 788 path.m_Matrix = *pTextMatrix; | 788 path.m_Matrix = *pTextMatrix; |
| 789 path.m_bStroke = bStroke; | 789 path.m_bStroke = bStroke; |
| 790 path.m_FillType = bFill ? FXFILL_WINDING : 0; | 790 path.m_FillType = bFill ? FXFILL_WINDING : 0; |
| 791 path.CalcBoundingBox(); | 791 path.CalcBoundingBox(); |
| 792 ProcessPath(&path, pObj2Device); | 792 ProcessPath(&path, pObj2Device); |
| 793 } | 793 } |
| 794 } | 794 } |
| OLD | NEW |