| 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/fxcrt/fx_ext.h" | 7 #include "../../../include/fxcrt/fx_ext.h" |
| 8 #include "../../../include/fxge/fx_freetype.h" | 8 #include "../../../include/fxge/fx_freetype.h" |
| 9 #include "../../../include/fxge/fx_ge.h" | 9 #include "../../../include/fxge/fx_ge.h" |
| 10 #include "../agg/include/fx_agg_driver.h" | 10 #include "../agg/include/fx_agg_driver.h" |
| (...skipping 733 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 744 const CFX_AffineMatrix* pObject2Device, | 744 const CFX_AffineMatrix* pObject2Device, |
| 745 FX_FLOAT font_size, | 745 FX_FLOAT font_size, |
| 746 FX_DWORD argb, | 746 FX_DWORD argb, |
| 747 int alpha_flag, | 747 int alpha_flag, |
| 748 void* pIccTransform) { | 748 void* pIccTransform) { |
| 749 if (nChars == 0) { | 749 if (nChars == 0) { |
| 750 return TRUE; | 750 return TRUE; |
| 751 } | 751 } |
| 752 CQuartz2D& quartz2d = | 752 CQuartz2D& quartz2d = |
| 753 ((CApplePlatform*)CFX_GEModule::Get()->GetPlatformData())->_quartz2d; | 753 ((CApplePlatform*)CFX_GEModule::Get()->GetPlatformData())->_quartz2d; |
| 754 if (!pFont->m_pPlatformFont) { | 754 if (!pFont->GetPlatformFont()) { |
| 755 if (pFont->GetPsName() == CFX_WideString::FromLocal("DFHeiStd-W5")) { | 755 if (pFont->GetPsName() == CFX_WideString::FromLocal("DFHeiStd-W5")) { |
| 756 return FALSE; | 756 return FALSE; |
| 757 } | 757 } |
| 758 pFont->m_pPlatformFont = | 758 pFont->SetPlatformFont( |
| 759 quartz2d.CreateFont(pFont->m_pFontData, pFont->m_dwSize); | 759 quartz2d.CreateFont(pFont->GetFontData(), pFont->GetSize())); |
| 760 if (NULL == pFont->m_pPlatformFont) { | 760 if (!pFont->GetPlatformFont()) { |
| 761 return FALSE; | 761 return FALSE; |
| 762 } | 762 } |
| 763 } | 763 } |
| 764 CFX_FixedBufGrow<FX_WORD, 32> glyph_indices(nChars); | 764 CFX_FixedBufGrow<FX_WORD, 32> glyph_indices(nChars); |
| 765 CFX_FixedBufGrow<CGPoint, 32> glyph_positions(nChars); | 765 CFX_FixedBufGrow<CGPoint, 32> glyph_positions(nChars); |
| 766 for (int i = 0; i < nChars; i++) { | 766 for (int i = 0; i < nChars; i++) { |
| 767 glyph_indices[i] = pCharPos[i].m_ExtGID; | 767 glyph_indices[i] = pCharPos[i].m_ExtGID; |
| 768 glyph_positions[i].x = pCharPos[i].m_OriginX; | 768 glyph_positions[i].x = pCharPos[i].m_OriginX; |
| 769 glyph_positions[i].y = pCharPos[i].m_OriginY; | 769 glyph_positions[i].y = pCharPos[i].m_OriginY; |
| 770 } | 770 } |
| 771 CFX_AffineMatrix text_matrix; | 771 CFX_AffineMatrix text_matrix; |
| 772 if (pObject2Device) { | 772 if (pObject2Device) { |
| 773 text_matrix.Concat(*pObject2Device); | 773 text_matrix.Concat(*pObject2Device); |
| 774 } | 774 } |
| 775 CGAffineTransform matrix_cg = | 775 CGAffineTransform matrix_cg = |
| 776 CGAffineTransformMake(text_matrix.a, text_matrix.b, text_matrix.c, | 776 CGAffineTransformMake(text_matrix.a, text_matrix.b, text_matrix.c, |
| 777 text_matrix.d, text_matrix.e, text_matrix.f); | 777 text_matrix.d, text_matrix.e, text_matrix.f); |
| 778 matrix_cg = CGAffineTransformConcat(matrix_cg, _foxitDevice2User); | 778 matrix_cg = CGAffineTransformConcat(matrix_cg, _foxitDevice2User); |
| 779 CGContextSetTextMatrix(_context, matrix_cg); | 779 CGContextSetTextMatrix(_context, matrix_cg); |
| 780 CGContextSetFont(_context, (CGFontRef)pFont->m_pPlatformFont); | 780 CGContextSetFont(_context, (CGFontRef)pFont->GetPlatformFont()); |
| 781 CGContextSetFontSize(_context, FXSYS_fabs(font_size)); | 781 CGContextSetFontSize(_context, FXSYS_fabs(font_size)); |
| 782 int32_t a, r, g, b; | 782 int32_t a, r, g, b; |
| 783 ArgbDecode(argb, a, r, g, b); | 783 ArgbDecode(argb, a, r, g, b); |
| 784 CGContextSetRGBFillColor(_context, r / 255.f, g / 255.f, b / 255.f, | 784 CGContextSetRGBFillColor(_context, r / 255.f, g / 255.f, b / 255.f, |
| 785 a / 255.f); | 785 a / 255.f); |
| 786 SaveState(); | 786 SaveState(); |
| 787 if (pGlyphMatrix) { | 787 if (pGlyphMatrix) { |
| 788 CGPoint origin = CGPointMake(glyph_positions[0].x, glyph_positions[0].y); | 788 CGPoint origin = CGPointMake(glyph_positions[0].x, glyph_positions[0].y); |
| 789 origin = CGPointApplyAffineTransform(origin, matrix_cg); | 789 origin = CGPointApplyAffineTransform(origin, matrix_cg); |
| 790 CGContextTranslateCTM(_context, origin.x, origin.y); | 790 CGContextTranslateCTM(_context, origin.x, origin.y); |
| (...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1041 } | 1041 } |
| 1042 CFX_DIBitmap* pBitmap = new CFX_DIBitmap; | 1042 CFX_DIBitmap* pBitmap = new CFX_DIBitmap; |
| 1043 if (!pBitmap->Create(width, height, format)) { | 1043 if (!pBitmap->Create(width, height, format)) { |
| 1044 delete pBitmap; | 1044 delete pBitmap; |
| 1045 return FALSE; | 1045 return FALSE; |
| 1046 } | 1046 } |
| 1047 m_bOwnedBitmap = TRUE; | 1047 m_bOwnedBitmap = TRUE; |
| 1048 return Attach(pBitmap); | 1048 return Attach(pBitmap); |
| 1049 } | 1049 } |
| 1050 #endif // _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ | 1050 #endif // _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ |
| OLD | NEW |