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/include/fxcrt/fx_system.h" | 7 #include "core/include/fxcrt/fx_system.h" |
8 #include "core/include/fxge/fx_ge.h" | 8 #include "core/include/fxge/fx_ge.h" |
9 | 9 |
10 #if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ | 10 #if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ |
(...skipping 16 matching lines...) Expand all Loading... |
27 if (m_pPlatformGraphics) { | 27 if (m_pPlatformGraphics) { |
28 quartz2d.destroyGraphics(m_pPlatformGraphics); | 28 quartz2d.destroyGraphics(m_pPlatformGraphics); |
29 m_pPlatformGraphics = NULL; | 29 m_pPlatformGraphics = NULL; |
30 } | 30 } |
31 } | 31 } |
32 void CFX_FaceCache::InitPlatform() {} | 32 void CFX_FaceCache::InitPlatform() {} |
33 void CFX_FaceCache::DestroyPlatform() {} | 33 void CFX_FaceCache::DestroyPlatform() {} |
34 CFX_GlyphBitmap* CFX_FaceCache::RenderGlyph_Nativetext( | 34 CFX_GlyphBitmap* CFX_FaceCache::RenderGlyph_Nativetext( |
35 CFX_Font* pFont, | 35 CFX_Font* pFont, |
36 FX_DWORD glyph_index, | 36 FX_DWORD glyph_index, |
37 const CFX_AffineMatrix* pMatrix, | 37 const CFX_Matrix* pMatrix, |
38 int dest_width, | 38 int dest_width, |
39 int anti_alias) { | 39 int anti_alias) { |
40 return NULL; | 40 return NULL; |
41 } | 41 } |
42 static FX_BOOL _CGDrawGlyphRun(CGContextRef pContext, | 42 static FX_BOOL _CGDrawGlyphRun(CGContextRef pContext, |
43 int nChars, | 43 int nChars, |
44 const FXTEXT_CHARPOS* pCharPos, | 44 const FXTEXT_CHARPOS* pCharPos, |
45 CFX_Font* pFont, | 45 CFX_Font* pFont, |
46 CFX_FontCache* pCache, | 46 CFX_FontCache* pCache, |
47 const CFX_AffineMatrix* pObject2Device, | 47 const CFX_Matrix* pObject2Device, |
48 FX_FLOAT font_size, | 48 FX_FLOAT font_size, |
49 FX_DWORD argb, | 49 FX_DWORD argb, |
50 int alpha_flag, | 50 int alpha_flag, |
51 void* pIccTransform) { | 51 void* pIccTransform) { |
52 if (nChars == 0) { | 52 if (nChars == 0) { |
53 return TRUE; | 53 return TRUE; |
54 } | 54 } |
55 CFX_AffineMatrix new_matrix; | 55 CFX_Matrix new_matrix; |
56 FX_BOOL bNegSize = font_size < 0; | 56 FX_BOOL bNegSize = font_size < 0; |
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 = |
(...skipping 24 matching lines...) Expand all Loading... |
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->GetPlatformFont(), | 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(int nChars, |
101 int nChars, | 101 const FXTEXT_CHARPOS* pCharPos, |
102 const FXTEXT_CHARPOS* pCharPos, | 102 CFX_Font* pFont, |
103 CFX_Font* pFont, | 103 CFX_FontCache* pCache, |
104 CFX_FontCache* pCache, | 104 const CFX_Matrix* pObject2Device, |
105 const CFX_AffineMatrix* pObject2Device, | 105 FX_FLOAT font_size, |
106 FX_FLOAT font_size, | 106 FX_DWORD argb, |
107 FX_DWORD argb, | 107 int alpha_flag, |
108 int alpha_flag, | 108 void* pIccTransform) { |
109 void* pIccTransform) { | |
110 if (!pFont) { | 109 if (!pFont) { |
111 return FALSE; | 110 return FALSE; |
112 } | 111 } |
113 FX_BOOL bBold = pFont->IsBold(); | 112 FX_BOOL bBold = pFont->IsBold(); |
114 if (!bBold && pFont->GetSubstFont() && | 113 if (!bBold && pFont->GetSubstFont() && |
115 pFont->GetSubstFont()->m_Weight >= 500 && | 114 pFont->GetSubstFont()->m_Weight >= 500 && |
116 pFont->GetSubstFont()->m_Weight <= 600) { | 115 pFont->GetSubstFont()->m_Weight <= 600) { |
117 return FALSE; | 116 return FALSE; |
118 } | 117 } |
119 for (int i = 0; i < nChars; i++) { | 118 for (int i = 0; i < nChars; i++) { |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 void CFX_Font::ReleasePlatformResource() { | 164 void CFX_Font::ReleasePlatformResource() { |
166 if (m_pPlatformFont) { | 165 if (m_pPlatformFont) { |
167 CQuartz2D& quartz2d = | 166 CQuartz2D& quartz2d = |
168 ((CApplePlatform*)CFX_GEModule::Get()->GetPlatformData())->_quartz2d; | 167 ((CApplePlatform*)CFX_GEModule::Get()->GetPlatformData())->_quartz2d; |
169 quartz2d.DestroyFont(m_pPlatformFont); | 168 quartz2d.DestroyFont(m_pPlatformFont); |
170 m_pPlatformFont = NULL; | 169 m_pPlatformFont = NULL; |
171 } | 170 } |
172 } | 171 } |
173 | 172 |
174 #endif // _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ | 173 #endif // _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ |
OLD | NEW |