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/fpdfapi/fpdf_page.h" | 7 #include "../../../include/fpdfapi/fpdf_page.h" |
8 #include "../../../include/fpdfapi/fpdf_module.h" | 8 #include "../../../include/fpdfapi/fpdf_module.h" |
9 #include "../fpdf_page/pageint.h" | 9 #include "../fpdf_page/pageint.h" |
10 #include <limits.h> | 10 #include <limits.h> |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 FX_Free(widths); | 216 FX_Free(widths); |
217 } | 217 } |
218 CPDF_Font* CPDF_Document::AddWindowsFont(LOGFONTW* pLogFont, FX_BOOL bVert, FX_B
OOL bTranslateName) | 218 CPDF_Font* CPDF_Document::AddWindowsFont(LOGFONTW* pLogFont, FX_BOOL bVert, FX_B
OOL bTranslateName) |
219 { | 219 { |
220 LOGFONTA lfa; | 220 LOGFONTA lfa; |
221 FXSYS_memcpy32(&lfa, pLogFont, (char*)lfa.lfFaceName - (char*)&lfa); | 221 FXSYS_memcpy32(&lfa, pLogFont, (char*)lfa.lfFaceName - (char*)&lfa); |
222 CFX_ByteString face = CFX_ByteString::FromUnicode(pLogFont->lfFaceName); | 222 CFX_ByteString face = CFX_ByteString::FromUnicode(pLogFont->lfFaceName); |
223 if (face.GetLength() >= LF_FACESIZE) { | 223 if (face.GetLength() >= LF_FACESIZE) { |
224 return NULL; | 224 return NULL; |
225 } | 225 } |
226 FXSYS_strcpy(lfa.lfFaceName, (FX_LPCSTR)face); | 226 FXSYS_strcpy(lfa.lfFaceName, face.c_str()); |
227 return AddWindowsFont(&lfa, bVert, bTranslateName); | 227 return AddWindowsFont(&lfa, bVert, bTranslateName); |
228 } | 228 } |
229 extern CFX_ByteString _FPDF_GetNameFromTT(FX_LPCBYTE name_table, FX_DWORD name); | 229 extern CFX_ByteString _FPDF_GetNameFromTT(FX_LPCBYTE name_table, FX_DWORD name); |
230 CFX_ByteString _FPDF_GetPSNameFromTT(HDC hDC) | 230 CFX_ByteString _FPDF_GetPSNameFromTT(HDC hDC) |
231 { | 231 { |
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); |
(...skipping 938 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1175 void FPDFAPI_FlatPageAttr(CPDF_Dictionary* pPageDict, FX_BSTR name) | 1175 void FPDFAPI_FlatPageAttr(CPDF_Dictionary* pPageDict, FX_BSTR name) |
1176 { | 1176 { |
1177 if (pPageDict->KeyExist(name)) { | 1177 if (pPageDict->KeyExist(name)) { |
1178 return; | 1178 return; |
1179 } | 1179 } |
1180 CPDF_Object* pObj = FPDFAPI_GetPageAttr(pPageDict, name); | 1180 CPDF_Object* pObj = FPDFAPI_GetPageAttr(pPageDict, name); |
1181 if (pObj) { | 1181 if (pObj) { |
1182 pPageDict->SetAt(name, pObj->Clone()); | 1182 pPageDict->SetAt(name, pObj->Clone()); |
1183 } | 1183 } |
1184 } | 1184 } |
OLD | NEW |