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 <limits.h> | 7 #include <limits.h> |
8 | 8 |
9 #include "core/fpdfapi/fpdf_font/include/cpdf_font.h" | 9 #include "core/fpdfapi/fpdf_font/include/cpdf_font.h" |
10 #include "core/fpdfapi/fpdf_font/include/cpdf_fontencoding.h" | 10 #include "core/fpdfapi/fpdf_font/include/cpdf_fontencoding.h" |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 } | 227 } |
228 FXSYS_strcpy(lfa.lfFaceName, face.c_str()); | 228 FXSYS_strcpy(lfa.lfFaceName, face.c_str()); |
229 return AddWindowsFont(&lfa, bVert, bTranslateName); | 229 return AddWindowsFont(&lfa, bVert, bTranslateName); |
230 } | 230 } |
231 CFX_ByteString _FPDF_GetPSNameFromTT(HDC hDC) { | 231 CFX_ByteString _FPDF_GetPSNameFromTT(HDC hDC) { |
232 CFX_ByteString result; | 232 CFX_ByteString result; |
233 DWORD size = ::GetFontData(hDC, 'eman', 0, NULL, 0); | 233 DWORD size = ::GetFontData(hDC, 'eman', 0, NULL, 0); |
234 if (size != GDI_ERROR) { | 234 if (size != GDI_ERROR) { |
235 LPBYTE buffer = FX_Alloc(BYTE, size); | 235 LPBYTE buffer = FX_Alloc(BYTE, size); |
236 ::GetFontData(hDC, 'eman', 0, buffer, size); | 236 ::GetFontData(hDC, 'eman', 0, buffer, size); |
237 result = GetNameFromTT(buffer, 6); | 237 result = GetNameFromTT(buffer, size, 6); |
238 FX_Free(buffer); | 238 FX_Free(buffer); |
239 } | 239 } |
240 return result; | 240 return result; |
241 } | 241 } |
242 CPDF_Font* CPDF_Document::AddWindowsFont(LOGFONTA* pLogFont, | 242 CPDF_Font* CPDF_Document::AddWindowsFont(LOGFONTA* pLogFont, |
243 FX_BOOL bVert, | 243 FX_BOOL bVert, |
244 FX_BOOL bTranslateName) { | 244 FX_BOOL bTranslateName) { |
245 pLogFont->lfHeight = -1000; | 245 pLogFont->lfHeight = -1000; |
246 pLogFont->lfWidth = 0; | 246 pLogFont->lfWidth = 0; |
247 HGDIOBJ hFont = CreateFontIndirectA(pLogFont); | 247 HGDIOBJ hFont = CreateFontIndirectA(pLogFont); |
(...skipping 902 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1150 void FPDFAPI_FlatPageAttr(CPDF_Dictionary* pPageDict, | 1150 void FPDFAPI_FlatPageAttr(CPDF_Dictionary* pPageDict, |
1151 const CFX_ByteStringC& name) { | 1151 const CFX_ByteStringC& name) { |
1152 if (pPageDict->KeyExist(name)) { | 1152 if (pPageDict->KeyExist(name)) { |
1153 return; | 1153 return; |
1154 } | 1154 } |
1155 CPDF_Object* pObj = FPDFAPI_GetPageAttr(pPageDict, name); | 1155 CPDF_Object* pObj = FPDFAPI_GetPageAttr(pPageDict, name); |
1156 if (pObj) { | 1156 if (pObj) { |
1157 pPageDict->SetAt(name, pObj->Clone()); | 1157 pPageDict->SetAt(name, pObj->Clone()); |
1158 } | 1158 } |
1159 } | 1159 } |
OLD | NEW |