| 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 14 matching lines...) Expand all Loading... |
| 25 #include "core/fpdfapi/fpdf_render/include/cpdf_textrenderer.h" | 25 #include "core/fpdfapi/fpdf_render/include/cpdf_textrenderer.h" |
| 26 #include "core/fxge/include/cfx_autofontcache.h" | 26 #include "core/fxge/include/cfx_autofontcache.h" |
| 27 #include "core/fxge/include/cfx_facecache.h" | 27 #include "core/fxge/include/cfx_facecache.h" |
| 28 #include "core/fxge/include/cfx_fontcache.h" | 28 #include "core/fxge/include/cfx_fontcache.h" |
| 29 #include "core/fxge/include/cfx_fxgedevice.h" | 29 #include "core/fxge/include/cfx_fxgedevice.h" |
| 30 #include "core/fxge/include/cfx_gemodule.h" | 30 #include "core/fxge/include/cfx_gemodule.h" |
| 31 #include "core/fxge/include/cfx_graphstatedata.h" | 31 #include "core/fxge/include/cfx_graphstatedata.h" |
| 32 #include "core/fxge/include/cfx_pathdata.h" | 32 #include "core/fxge/include/cfx_pathdata.h" |
| 33 #include "core/fxge/include/cfx_renderdevice.h" | 33 #include "core/fxge/include/cfx_renderdevice.h" |
| 34 | 34 |
| 35 FX_BOOL CPDF_RenderStatus::ProcessText(const CPDF_TextObject* textobj, | 35 FX_BOOL CPDF_RenderStatus::ProcessText(CPDF_TextObject* textobj, |
| 36 const CFX_Matrix* pObj2Device, | 36 const CFX_Matrix* pObj2Device, |
| 37 CFX_PathData* pClippingPath) { | 37 CFX_PathData* pClippingPath) { |
| 38 if (textobj->m_nChars == 0) | 38 if (textobj->m_nChars == 0) |
| 39 return TRUE; | 39 return TRUE; |
| 40 | 40 |
| 41 const TextRenderingMode text_render_mode = textobj->m_TextState.GetTextMode(); | 41 const TextRenderingMode text_render_mode = textobj->m_TextState.GetTextMode(); |
| 42 if (text_render_mode == TextRenderingMode::MODE_INVISIBLE) | 42 if (text_render_mode == TextRenderingMode::MODE_INVISIBLE) |
| 43 return TRUE; | 43 return TRUE; |
| 44 | 44 |
| 45 CPDF_Font* pFont = textobj->m_TextState.GetFont(); | 45 CPDF_Font* pFont = textobj->m_TextState.GetFont(); |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 device_matrix.Copy(ctm); | 121 device_matrix.Copy(ctm); |
| 122 device_matrix.Concat(*pObj2Device); | 122 device_matrix.Concat(*pObj2Device); |
| 123 pDeviceMatrix = &device_matrix; | 123 pDeviceMatrix = &device_matrix; |
| 124 } | 124 } |
| 125 } | 125 } |
| 126 int flag = 0; | 126 int flag = 0; |
| 127 if (bStroke && bFill) { | 127 if (bStroke && bFill) { |
| 128 flag |= FX_FILL_STROKE; | 128 flag |= FX_FILL_STROKE; |
| 129 flag |= FX_STROKE_TEXT_MODE; | 129 flag |= FX_STROKE_TEXT_MODE; |
| 130 } | 130 } |
| 131 const CPDF_GeneralStateData* pGeneralData = | 131 if (textobj->m_GeneralState.GetStrokeAdjust()) |
| 132 static_cast<const CPDF_PageObject*>(textobj) | |
| 133 ->m_GeneralState.GetObject(); | |
| 134 if (pGeneralData && pGeneralData->m_StrokeAdjust) { | |
| 135 flag |= FX_STROKE_ADJUST; | 132 flag |= FX_STROKE_ADJUST; |
| 136 } | 133 if (m_Options.m_Flags & RENDER_NOTEXTSMOOTH) |
| 137 if (m_Options.m_Flags & RENDER_NOTEXTSMOOTH) { | |
| 138 flag |= FXFILL_NOPATHSMOOTH; | 134 flag |= FXFILL_NOPATHSMOOTH; |
| 139 } | |
| 140 return CPDF_TextRenderer::DrawTextPath( | 135 return CPDF_TextRenderer::DrawTextPath( |
| 141 m_pDevice, textobj->m_nChars, textobj->m_pCharCodes, | 136 m_pDevice, textobj->m_nChars, textobj->m_pCharCodes, |
| 142 textobj->m_pCharPos, pFont, font_size, &text_matrix, pDeviceMatrix, | 137 textobj->m_pCharPos, pFont, font_size, &text_matrix, pDeviceMatrix, |
| 143 textobj->m_GraphState.GetObject(), fill_argb, stroke_argb, | 138 textobj->m_GraphState.GetObject(), fill_argb, stroke_argb, |
| 144 pClippingPath, flag); | 139 pClippingPath, flag); |
| 145 } | 140 } |
| 146 text_matrix.Concat(*pObj2Device); | 141 text_matrix.Concat(*pObj2Device); |
| 147 return CPDF_TextRenderer::DrawNormalText( | 142 return CPDF_TextRenderer::DrawNormalText( |
| 148 m_pDevice, textobj->m_nChars, textobj->m_pCharCodes, textobj->m_pCharPos, | 143 m_pDevice, textobj->m_nChars, textobj->m_pCharCodes, textobj->m_pCharPos, |
| 149 pFont, font_size, &text_matrix, fill_argb, &m_Options); | 144 pFont, font_size, &text_matrix, fill_argb, &m_Options); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 171 ~CPDF_RefType3Cache() { | 166 ~CPDF_RefType3Cache() { |
| 172 while (m_dwCount--) { | 167 while (m_dwCount--) { |
| 173 ReleaseCachedType3(m_pType3Font); | 168 ReleaseCachedType3(m_pType3Font); |
| 174 } | 169 } |
| 175 } | 170 } |
| 176 uint32_t m_dwCount; | 171 uint32_t m_dwCount; |
| 177 CPDF_Type3Font* const m_pType3Font; | 172 CPDF_Type3Font* const m_pType3Font; |
| 178 }; | 173 }; |
| 179 | 174 |
| 180 // TODO(npm): Font fallback for type 3 fonts? (Completely separate code!!) | 175 // TODO(npm): Font fallback for type 3 fonts? (Completely separate code!!) |
| 181 FX_BOOL CPDF_RenderStatus::ProcessType3Text(const CPDF_TextObject* textobj, | 176 FX_BOOL CPDF_RenderStatus::ProcessType3Text(CPDF_TextObject* textobj, |
| 182 const CFX_Matrix* pObj2Device) { | 177 const CFX_Matrix* pObj2Device) { |
| 183 CPDF_Type3Font* pType3Font = textobj->m_TextState.GetFont()->AsType3Font(); | 178 CPDF_Type3Font* pType3Font = textobj->m_TextState.GetFont()->AsType3Font(); |
| 184 for (int i = 0; i < m_Type3FontCache.GetSize(); ++i) { | 179 for (int i = 0; i < m_Type3FontCache.GetSize(); ++i) { |
| 185 if (m_Type3FontCache.GetAt(i) == pType3Font) | 180 if (m_Type3FontCache.GetAt(i) == pType3Font) |
| 186 return TRUE; | 181 return TRUE; |
| 187 } | 182 } |
| 188 | 183 |
| 189 CFX_Matrix dCTM = m_pDevice->GetCTM(); | 184 CFX_Matrix dCTM = m_pDevice->GetCTM(); |
| 190 FX_FLOAT sa = FXSYS_fabs(dCTM.a); | 185 FX_FLOAT sa = FXSYS_fabs(dCTM.a); |
| 191 FX_FLOAT sd = FXSYS_fabs(dCTM.d); | 186 FX_FLOAT sd = FXSYS_fabs(dCTM.d); |
| (...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 671 matrix.Concat(font_size, 0, 0, font_size, charpos.m_OriginX, | 666 matrix.Concat(font_size, 0, 0, font_size, charpos.m_OriginX, |
| 672 charpos.m_OriginY); | 667 charpos.m_OriginY); |
| 673 path.m_Path.Emplace()->Append(pPath, &matrix); | 668 path.m_Path.Emplace()->Append(pPath, &matrix); |
| 674 path.m_Matrix = *pTextMatrix; | 669 path.m_Matrix = *pTextMatrix; |
| 675 path.m_bStroke = bStroke; | 670 path.m_bStroke = bStroke; |
| 676 path.m_FillType = bFill ? FXFILL_WINDING : 0; | 671 path.m_FillType = bFill ? FXFILL_WINDING : 0; |
| 677 path.CalcBoundingBox(); | 672 path.CalcBoundingBox(); |
| 678 ProcessPath(&path, pObj2Device); | 673 ProcessPath(&path, pObj2Device); |
| 679 } | 674 } |
| 680 } | 675 } |
| OLD | NEW |