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 571 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
582 charpos.m_AdjustMatrix[1] = pCIDFont->CIDTransformToFloat(pTransform[1]); | 582 charpos.m_AdjustMatrix[1] = pCIDFont->CIDTransformToFloat(pTransform[1]); |
583 charpos.m_AdjustMatrix[3] = pCIDFont->CIDTransformToFloat(pTransform[3]); | 583 charpos.m_AdjustMatrix[3] = pCIDFont->CIDTransformToFloat(pTransform[3]); |
584 charpos.m_OriginX += | 584 charpos.m_OriginX += |
585 pCIDFont->CIDTransformToFloat(pTransform[4]) * FontSize; | 585 pCIDFont->CIDTransformToFloat(pTransform[4]) * FontSize; |
586 charpos.m_OriginY += | 586 charpos.m_OriginY += |
587 pCIDFont->CIDTransformToFloat(pTransform[5]) * FontSize; | 587 pCIDFont->CIDTransformToFloat(pTransform[5]) * FontSize; |
588 charpos.m_bGlyphAdjust = TRUE; | 588 charpos.m_bGlyphAdjust = TRUE; |
589 } | 589 } |
590 } | 590 } |
591 } | 591 } |
| 592 |
592 FX_BOOL CPDF_TextRenderer::DrawTextPath(CFX_RenderDevice* pDevice, | 593 FX_BOOL CPDF_TextRenderer::DrawTextPath(CFX_RenderDevice* pDevice, |
593 int nChars, | 594 int nChars, |
594 uint32_t* pCharCodes, | 595 uint32_t* pCharCodes, |
595 FX_FLOAT* pCharPos, | 596 FX_FLOAT* pCharPos, |
596 CPDF_Font* pFont, | 597 CPDF_Font* pFont, |
597 FX_FLOAT font_size, | 598 FX_FLOAT font_size, |
598 const CFX_Matrix* pText2User, | 599 const CFX_Matrix* pText2User, |
599 const CFX_Matrix* pUser2Device, | 600 const CFX_Matrix* pUser2Device, |
600 const CFX_GraphStateData* pGraphState, | 601 const CFX_GraphStateData* pGraphState, |
601 FX_ARGB fill_argb, | 602 FX_ARGB fill_argb, |
602 FX_ARGB stroke_argb, | 603 FX_ARGB stroke_argb, |
603 CFX_PathData* pClippingPath, | 604 CFX_PathData* pClippingPath, |
604 int nFlag) { | 605 int nFlag) { |
605 CFX_FontCache* pCache = | 606 CFX_FontCache* pCache = |
606 pFont->m_pDocument ? pFont->m_pDocument->GetRenderData()->GetFontCache() | 607 pFont->m_pDocument ? pFont->m_pDocument->GetRenderData()->GetFontCache() |
607 : NULL; | 608 : nullptr; |
608 CPDF_CharPosList CharPosList; | 609 CPDF_CharPosList CharPosList; |
609 CharPosList.Load(nChars, pCharCodes, pCharPos, pFont, font_size); | 610 CharPosList.Load(nChars, pCharCodes, pCharPos, pFont, font_size); |
610 return pDevice->DrawTextPath(CharPosList.m_nChars, CharPosList.m_pCharPos, | 611 return pDevice->DrawTextPathWithFlags( |
611 &pFont->m_Font, pCache, font_size, pText2User, | 612 CharPosList.m_nChars, CharPosList.m_pCharPos, &pFont->m_Font, pCache, |
612 pUser2Device, pGraphState, fill_argb, | 613 font_size, pText2User, pUser2Device, pGraphState, fill_argb, stroke_argb, |
613 stroke_argb, pClippingPath, nFlag); | 614 pClippingPath, nFlag); |
614 } | 615 } |
| 616 |
615 void CPDF_TextRenderer::DrawTextString(CFX_RenderDevice* pDevice, | 617 void CPDF_TextRenderer::DrawTextString(CFX_RenderDevice* pDevice, |
616 int left, | 618 int left, |
617 int top, | 619 int top, |
618 CPDF_Font* pFont, | 620 CPDF_Font* pFont, |
619 int height, | 621 int height, |
620 const CFX_ByteString& str, | 622 const CFX_ByteString& str, |
621 FX_ARGB argb) { | 623 FX_ARGB argb) { |
622 FX_RECT font_bbox; | 624 FX_RECT font_bbox; |
623 pFont->GetFontBBox(font_bbox); | 625 pFont->GetFontBBox(font_bbox); |
624 FX_FLOAT font_size = | 626 FX_FLOAT font_size = |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
784 matrix.Concat(font_size, 0, 0, font_size, charpos.m_OriginX, | 786 matrix.Concat(font_size, 0, 0, font_size, charpos.m_OriginX, |
785 charpos.m_OriginY); | 787 charpos.m_OriginY); |
786 path.m_Path.New()->Append(pPath, &matrix); | 788 path.m_Path.New()->Append(pPath, &matrix); |
787 path.m_Matrix = *pTextMatrix; | 789 path.m_Matrix = *pTextMatrix; |
788 path.m_bStroke = bStroke; | 790 path.m_bStroke = bStroke; |
789 path.m_FillType = bFill ? FXFILL_WINDING : 0; | 791 path.m_FillType = bFill ? FXFILL_WINDING : 0; |
790 path.CalcBoundingBox(); | 792 path.CalcBoundingBox(); |
791 ProcessPath(&path, pObj2Device); | 793 ProcessPath(&path, pObj2Device); |
792 } | 794 } |
793 } | 795 } |
OLD | NEW |