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_system.h" | 7 #include "../../../include/fxcrt/fx_system.h" |
8 #include "../../../include/fxge/fx_ge.h" | 8 #include "../../../include/fxge/fx_ge.h" |
9 | 9 |
10 #if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ | 10 #if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 if (bNegSize) { | 57 if (bNegSize) { |
58 font_size = -font_size; | 58 font_size = -font_size; |
59 } | 59 } |
60 FX_FLOAT ori_x = pCharPos[0].m_OriginX, ori_y = pCharPos[0].m_OriginY; | 60 FX_FLOAT ori_x = pCharPos[0].m_OriginX, ori_y = pCharPos[0].m_OriginY; |
61 new_matrix.Transform(ori_x, ori_y); | 61 new_matrix.Transform(ori_x, ori_y); |
62 if (pObject2Device) { | 62 if (pObject2Device) { |
63 new_matrix.Concat(*pObject2Device); | 63 new_matrix.Concat(*pObject2Device); |
64 } | 64 } |
65 CQuartz2D& quartz2d = | 65 CQuartz2D& quartz2d = |
66 ((CApplePlatform*)CFX_GEModule::Get()->GetPlatformData())->_quartz2d; | 66 ((CApplePlatform*)CFX_GEModule::Get()->GetPlatformData())->_quartz2d; |
67 if (!pFont->m_pPlatformFont) { | 67 if (!pFont->GetPlatformFont()) { |
68 if (pFont->GetPsName() == CFX_WideString::FromLocal("DFHeiStd-W5")) { | 68 if (pFont->GetPsName() == CFX_WideString::FromLocal("DFHeiStd-W5")) { |
69 return FALSE; | 69 return FALSE; |
70 } | 70 } |
71 pFont->m_pPlatformFont = | 71 pFont->SetPlatformFont( |
72 quartz2d.CreateFont(pFont->m_pFontData, pFont->m_dwSize); | 72 quartz2d.CreateFont(pFont->GetFontData(), pFont->GetSize())); |
73 if (NULL == pFont->m_pPlatformFont) { | 73 if (!pFont->GetPlatformFont()) { |
74 return FALSE; | 74 return FALSE; |
75 } | 75 } |
76 } | 76 } |
77 CFX_FixedBufGrow<FX_WORD, 32> glyph_indices(nChars); | 77 CFX_FixedBufGrow<FX_WORD, 32> glyph_indices(nChars); |
78 CFX_FixedBufGrow<CGPoint, 32> glyph_positions(nChars); | 78 CFX_FixedBufGrow<CGPoint, 32> glyph_positions(nChars); |
79 for (int i = 0; i < nChars; i++) { | 79 for (int i = 0; i < nChars; i++) { |
80 glyph_indices[i] = pCharPos[i].m_ExtGID; | 80 glyph_indices[i] = pCharPos[i].m_ExtGID; |
81 if (bNegSize) { | 81 if (bNegSize) { |
82 glyph_positions[i].x = -pCharPos[i].m_OriginX; | 82 glyph_positions[i].x = -pCharPos[i].m_OriginX; |
83 } else { | 83 } else { |
84 glyph_positions[i].x = pCharPos[i].m_OriginX; | 84 glyph_positions[i].x = pCharPos[i].m_OriginX; |
85 } | 85 } |
86 glyph_positions[i].y = pCharPos[i].m_OriginY; | 86 glyph_positions[i].y = pCharPos[i].m_OriginY; |
87 } | 87 } |
88 if (bNegSize) { | 88 if (bNegSize) { |
89 new_matrix.a = -new_matrix.a; | 89 new_matrix.a = -new_matrix.a; |
90 } else { | 90 } else { |
91 new_matrix.b = -new_matrix.b; | 91 new_matrix.b = -new_matrix.b; |
92 new_matrix.d = -new_matrix.d; | 92 new_matrix.d = -new_matrix.d; |
93 } | 93 } |
94 quartz2d.setGraphicsTextMatrix(pContext, &new_matrix); | 94 quartz2d.setGraphicsTextMatrix(pContext, &new_matrix); |
95 return quartz2d.drawGraphicsString(pContext, pFont->m_pPlatformFont, | 95 return quartz2d.drawGraphicsString(pContext, pFont->GetPlatformFont(), |
96 font_size, glyph_indices, glyph_positions, | 96 font_size, glyph_indices, glyph_positions, |
97 nChars, argb, NULL); | 97 nChars, argb, NULL); |
98 } | 98 } |
99 static void _DoNothing(void* info, const void* data, size_t size) {} | 99 static void _DoNothing(void* info, const void* data, size_t size) {} |
100 FX_BOOL CFX_AggDeviceDriver::DrawDeviceText( | 100 FX_BOOL CFX_AggDeviceDriver::DrawDeviceText( |
101 int nChars, | 101 int nChars, |
102 const FXTEXT_CHARPOS* pCharPos, | 102 const FXTEXT_CHARPOS* pCharPos, |
103 CFX_Font* pFont, | 103 CFX_Font* pFont, |
104 CFX_FontCache* pCache, | 104 CFX_FontCache* pCache, |
105 const CFX_AffineMatrix* pObject2Device, | 105 const CFX_AffineMatrix* pObject2Device, |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 void CFX_Font::ReleasePlatformResource() { | 165 void CFX_Font::ReleasePlatformResource() { |
166 if (m_pPlatformFont) { | 166 if (m_pPlatformFont) { |
167 CQuartz2D& quartz2d = | 167 CQuartz2D& quartz2d = |
168 ((CApplePlatform*)CFX_GEModule::Get()->GetPlatformData())->_quartz2d; | 168 ((CApplePlatform*)CFX_GEModule::Get()->GetPlatformData())->_quartz2d; |
169 quartz2d.DestroyFont(m_pPlatformFont); | 169 quartz2d.DestroyFont(m_pPlatformFont); |
170 m_pPlatformFont = NULL; | 170 m_pPlatformFont = NULL; |
171 } | 171 } |
172 } | 172 } |
173 | 173 |
174 #endif // _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ | 174 #endif // _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ |
OLD | NEW |