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 "fx_fpf.h" | 7 #include "fx_fpf.h" |
8 #if _FX_OS_ == _FX_ANDROID_ | 8 #if _FX_OS_ == _FX_ANDROID_ |
9 #include "fpf_skiafont.h" | 9 #include "fpf_skiafont.h" |
10 #include "fpf_skiafontmgr.h" | 10 #include "fpf_skiafontmgr.h" |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 { | 149 { |
150 if (!m_Face) { | 150 if (!m_Face) { |
151 return 0; | 151 return 0; |
152 } | 152 } |
153 TT_Postscript *ttInfo = (TT_Postscript*)FT_Get_Sfnt_Table(m_Face, ft_sfnt_po
st); | 153 TT_Postscript *ttInfo = (TT_Postscript*)FT_Get_Sfnt_Table(m_Face, ft_sfnt_po
st); |
154 if (ttInfo) { | 154 if (ttInfo) { |
155 return ttInfo->italicAngle; | 155 return ttInfo->italicAngle; |
156 } | 156 } |
157 return 0; | 157 return 0; |
158 } | 158 } |
159 FX_DWORD CFPF_SkiaFont::GetFontData(FX_DWORD dwTable, FX_LPBYTE pBuffer, FX_DWOR
D dwSize) | 159 FX_DWORD CFPF_SkiaFont::GetFontData(FX_DWORD dwTable, uint8_t* pBuffer, FX_DWORD
dwSize) |
160 { | 160 { |
161 if (!m_Face) { | 161 if (!m_Face) { |
162 return FALSE; | 162 return FALSE; |
163 } | 163 } |
164 if (FXFT_Load_Sfnt_Table(m_Face, dwTable, 0, pBuffer, (unsigned long*)&dwSiz
e)) { | 164 if (FXFT_Load_Sfnt_Table(m_Face, dwTable, 0, pBuffer, (unsigned long*)&dwSiz
e)) { |
165 return 0; | 165 return 0; |
166 } | 166 } |
167 return dwSize; | 167 return dwSize; |
168 } | 168 } |
169 FX_BOOL CFPF_SkiaFont::InitFont(CFPF_SkiaFontMgr *pFontMgr, CFPF_SkiaFontDescrip
tor *pFontDes, FX_BSTR bsFamily, FX_DWORD dwStyle, uint8_t uCharset) | 169 FX_BOOL CFPF_SkiaFont::InitFont(CFPF_SkiaFontMgr *pFontMgr, CFPF_SkiaFontDescrip
tor *pFontDes, FX_BSTR bsFamily, FX_DWORD dwStyle, uint8_t uCharset) |
170 { | 170 { |
171 if (!pFontMgr || !pFontDes) { | 171 if (!pFontMgr || !pFontDes) { |
172 return FALSE; | 172 return FALSE; |
173 } | 173 } |
174 switch (pFontDes->GetType()) { | 174 switch (pFontDes->GetType()) { |
175 case FPF_SKIAFONTTYPE_Path: { | 175 case FPF_SKIAFONTTYPE_Path: { |
176 CFPF_SkiaPathFont *pFont = (CFPF_SkiaPathFont*)pFontDes; | 176 CFPF_SkiaPathFont *pFont = (CFPF_SkiaPathFont*)pFontDes; |
177 m_Face = pFontMgr->GetFontFace(pFont->m_pPath, pFont->m_iFaceInd
ex); | 177 m_Face = pFontMgr->GetFontFace(pFont->m_pPath, pFont->m_iFaceInd
ex); |
178 } | 178 } |
179 break; | 179 break; |
180 case FPF_SKIAFONTTYPE_File: { | 180 case FPF_SKIAFONTTYPE_File: { |
181 CFPF_SkiaFileFont *pFont = (CFPF_SkiaFileFont*)pFontDes; | 181 CFPF_SkiaFileFont *pFont = (CFPF_SkiaFileFont*)pFontDes; |
182 m_Face = pFontMgr->GetFontFace(pFont->m_pFile, pFont->m_iFaceInd
ex); | 182 m_Face = pFontMgr->GetFontFace(pFont->m_pFile, pFont->m_iFaceInd
ex); |
183 } | 183 } |
184 break; | 184 break; |
185 case FPF_SKIAFONTTYPE_Buffer: { | 185 case FPF_SKIAFONTTYPE_Buffer: { |
186 CFPF_SkiaBufferFont *pFont = (CFPF_SkiaBufferFont*)pFontDes; | 186 CFPF_SkiaBufferFont *pFont = (CFPF_SkiaBufferFont*)pFontDes; |
187 m_Face = pFontMgr->GetFontFace((FX_LPCBYTE)pFont->m_pBuffer, pFo
nt->m_szBuffer, pFont->m_iFaceIndex); | 187 m_Face = pFontMgr->GetFontFace((const uint8_t*)pFont->m_pBuffer,
pFont->m_szBuffer, pFont->m_iFaceIndex); |
188 } | 188 } |
189 break; | 189 break; |
190 default: | 190 default: |
191 return FALSE; | 191 return FALSE; |
192 } | 192 } |
193 if (!m_Face) { | 193 if (!m_Face) { |
194 return FALSE; | 194 return FALSE; |
195 } | 195 } |
196 m_dwStyle = dwStyle; | 196 m_dwStyle = dwStyle; |
197 m_uCharset = uCharset; | 197 m_uCharset = uCharset; |
198 m_pFontMgr = pFontMgr; | 198 m_pFontMgr = pFontMgr; |
199 m_pFontDes = pFontDes; | 199 m_pFontDes = pFontDes; |
200 m_dwRefCount = 1; | 200 m_dwRefCount = 1; |
201 return TRUE; | 201 return TRUE; |
202 } | 202 } |
203 #endif | 203 #endif |
OLD | NEW |