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 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 CFX_AffineMatrix text_matrix; | 249 CFX_AffineMatrix text_matrix; |
250 textobj->GetTextMatrix(&text_matrix); | 250 textobj->GetTextMatrix(&text_matrix); |
251 if(IsAvailableMatrix(text_matrix) == FALSE) { | 251 if(IsAvailableMatrix(text_matrix) == FALSE) { |
252 return TRUE; | 252 return TRUE; |
253 } | 253 } |
254 FX_FLOAT font_size = textobj->m_TextState.GetFontSize(); | 254 FX_FLOAT font_size = textobj->m_TextState.GetFontSize(); |
255 if (bPattern) { | 255 if (bPattern) { |
256 DrawTextPathWithPattern(textobj, pObj2Device, pFont, font_size, &text_ma
trix, bFill, bStroke); | 256 DrawTextPathWithPattern(textobj, pObj2Device, pFont, font_size, &text_ma
trix, bFill, bStroke); |
257 return TRUE; | 257 return TRUE; |
258 } | 258 } |
259 #if defined(_FPDFAPI_MINI_) | |
260 if (bFill) { | |
261 bStroke = FALSE; | |
262 } | |
263 if (bStroke) { | |
264 if (font_size * text_matrix.GetXUnit() * pObj2Device->GetXUnit() < 6) { | |
265 bStroke = FALSE; | |
266 } | |
267 } | |
268 #endif | |
269 if (bClip || bStroke) { | 259 if (bClip || bStroke) { |
270 const CFX_AffineMatrix* pDeviceMatrix = pObj2Device; | 260 const CFX_AffineMatrix* pDeviceMatrix = pObj2Device; |
271 CFX_AffineMatrix device_matrix; | 261 CFX_AffineMatrix device_matrix; |
272 if (bStroke) { | 262 if (bStroke) { |
273 const FX_FLOAT* pCTM = textobj->m_TextState.GetObject()->m_CTM; | 263 const FX_FLOAT* pCTM = textobj->m_TextState.GetObject()->m_CTM; |
274 if (pCTM[0] != 1.0f || pCTM[3] != 1.0f) { | 264 if (pCTM[0] != 1.0f || pCTM[3] != 1.0f) { |
275 CFX_AffineMatrix ctm(pCTM[0], pCTM[1], pCTM[2], pCTM[3], 0, 0); | 265 CFX_AffineMatrix ctm(pCTM[0], pCTM[1], pCTM[2], pCTM[3], 0, 0); |
276 text_matrix.ConcatInverse(ctm); | 266 text_matrix.ConcatInverse(ctm); |
277 device_matrix.Copy(ctm); | 267 device_matrix.Copy(ctm); |
278 device_matrix.Concat(*pObj2Device); | 268 device_matrix.Concat(*pObj2Device); |
279 pDeviceMatrix = &device_matrix; | 269 pDeviceMatrix = &device_matrix; |
280 } | 270 } |
281 } | 271 } |
282 int flag = 0; | 272 int flag = 0; |
283 if (bStroke && bFill) { | 273 if (bStroke && bFill) { |
284 flag |= FX_FILL_STROKE; | 274 flag |= FX_FILL_STROKE; |
285 flag |= FX_STROKE_TEXT_MODE; | 275 flag |= FX_STROKE_TEXT_MODE; |
286 } | 276 } |
287 #if !defined(_FPDFAPI_MINI_) || defined(_FXCORE_FEATURE_ALL_) | |
288 const CPDF_GeneralStateData* pGeneralData = ((CPDF_PageObject*)textobj)-
>m_GeneralState; | 277 const CPDF_GeneralStateData* pGeneralData = ((CPDF_PageObject*)textobj)-
>m_GeneralState; |
289 if (pGeneralData && pGeneralData->m_StrokeAdjust) { | 278 if (pGeneralData && pGeneralData->m_StrokeAdjust) { |
290 flag |= FX_STROKE_ADJUST; | 279 flag |= FX_STROKE_ADJUST; |
291 } | 280 } |
292 #endif | |
293 if (m_Options.m_Flags & RENDER_NOTEXTSMOOTH) { | 281 if (m_Options.m_Flags & RENDER_NOTEXTSMOOTH) { |
294 flag |= FXFILL_NOPATHSMOOTH; | 282 flag |= FXFILL_NOPATHSMOOTH; |
295 } | 283 } |
296 return CPDF_TextRenderer::DrawTextPath(m_pDevice, textobj->m_nChars, tex
tobj->m_pCharCodes, textobj->m_pCharPos, pFont, font_size, | 284 return CPDF_TextRenderer::DrawTextPath(m_pDevice, textobj->m_nChars, tex
tobj->m_pCharCodes, textobj->m_pCharPos, pFont, font_size, |
297 &text_matrix, pDeviceMatrix, text
obj->m_GraphState, fill_argb, stroke_argb, pClippingPath, flag); | 285 &text_matrix, pDeviceMatrix, text
obj->m_GraphState, fill_argb, stroke_argb, pClippingPath, flag); |
298 } | 286 } |
299 text_matrix.Concat(*pObj2Device); | 287 text_matrix.Concat(*pObj2Device); |
300 return CPDF_TextRenderer::DrawNormalText(m_pDevice, textobj->m_nChars, texto
bj->m_pCharCodes, textobj->m_pCharPos, pFont, font_size, | 288 return CPDF_TextRenderer::DrawNormalText(m_pDevice, textobj->m_nChars, texto
bj->m_pCharCodes, textobj->m_pCharPos, pFont, font_size, |
301 &text_matrix, fill_argb, &m_Options); | 289 &text_matrix, fill_argb, &m_Options); |
302 } | 290 } |
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
749 } | 737 } |
750 } | 738 } |
751 CFX_PathData* CPDF_Font::LoadGlyphPath(FX_DWORD charcode, int dest_width) | 739 CFX_PathData* CPDF_Font::LoadGlyphPath(FX_DWORD charcode, int dest_width) |
752 { | 740 { |
753 int glyph_index = GlyphFromCharCode(charcode); | 741 int glyph_index = GlyphFromCharCode(charcode); |
754 if (m_Font.m_Face == NULL) { | 742 if (m_Font.m_Face == NULL) { |
755 return NULL; | 743 return NULL; |
756 } | 744 } |
757 return m_Font.LoadGlyphPath(glyph_index, dest_width); | 745 return m_Font.LoadGlyphPath(glyph_index, dest_width); |
758 } | 746 } |
OLD | NEW |