| 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 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 FX_BOOL bTranslateName) { | 212 FX_BOOL bTranslateName) { |
| 213 LOGFONTA lfa; | 213 LOGFONTA lfa; |
| 214 FXSYS_memcpy(&lfa, pLogFont, (char*)lfa.lfFaceName - (char*)&lfa); | 214 FXSYS_memcpy(&lfa, pLogFont, (char*)lfa.lfFaceName - (char*)&lfa); |
| 215 CFX_ByteString face = CFX_ByteString::FromUnicode(pLogFont->lfFaceName); | 215 CFX_ByteString face = CFX_ByteString::FromUnicode(pLogFont->lfFaceName); |
| 216 if (face.GetLength() >= LF_FACESIZE) { | 216 if (face.GetLength() >= LF_FACESIZE) { |
| 217 return NULL; | 217 return NULL; |
| 218 } | 218 } |
| 219 FXSYS_strcpy(lfa.lfFaceName, face.c_str()); | 219 FXSYS_strcpy(lfa.lfFaceName, face.c_str()); |
| 220 return AddWindowsFont(&lfa, bVert, bTranslateName); | 220 return AddWindowsFont(&lfa, bVert, bTranslateName); |
| 221 } | 221 } |
| 222 extern CFX_ByteString _FPDF_GetNameFromTT(const uint8_t* name_table, | |
| 223 FX_DWORD name); | |
| 224 CFX_ByteString _FPDF_GetPSNameFromTT(HDC hDC) { | 222 CFX_ByteString _FPDF_GetPSNameFromTT(HDC hDC) { |
| 225 CFX_ByteString result; | 223 CFX_ByteString result; |
| 226 DWORD size = ::GetFontData(hDC, 'eman', 0, NULL, 0); | 224 DWORD size = ::GetFontData(hDC, 'eman', 0, NULL, 0); |
| 227 if (size != GDI_ERROR) { | 225 if (size != GDI_ERROR) { |
| 228 LPBYTE buffer = FX_Alloc(BYTE, size); | 226 LPBYTE buffer = FX_Alloc(BYTE, size); |
| 229 ::GetFontData(hDC, 'eman', 0, buffer, size); | 227 ::GetFontData(hDC, 'eman', 0, buffer, size); |
| 230 result = _FPDF_GetNameFromTT(buffer, 6); | 228 result = GetNameFromTT(buffer, 6); |
| 231 FX_Free(buffer); | 229 FX_Free(buffer); |
| 232 } | 230 } |
| 233 return result; | 231 return result; |
| 234 } | 232 } |
| 235 CPDF_Font* CPDF_Document::AddWindowsFont(LOGFONTA* pLogFont, | 233 CPDF_Font* CPDF_Document::AddWindowsFont(LOGFONTA* pLogFont, |
| 236 FX_BOOL bVert, | 234 FX_BOOL bVert, |
| 237 FX_BOOL bTranslateName) { | 235 FX_BOOL bTranslateName) { |
| 238 pLogFont->lfHeight = -1000; | 236 pLogFont->lfHeight = -1000; |
| 239 pLogFont->lfWidth = 0; | 237 pLogFont->lfWidth = 0; |
| 240 HGDIOBJ hFont = CreateFontIndirectA(pLogFont); | 238 HGDIOBJ hFont = CreateFontIndirectA(pLogFont); |
| (...skipping 900 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1141 void FPDFAPI_FlatPageAttr(CPDF_Dictionary* pPageDict, | 1139 void FPDFAPI_FlatPageAttr(CPDF_Dictionary* pPageDict, |
| 1142 const CFX_ByteStringC& name) { | 1140 const CFX_ByteStringC& name) { |
| 1143 if (pPageDict->KeyExist(name)) { | 1141 if (pPageDict->KeyExist(name)) { |
| 1144 return; | 1142 return; |
| 1145 } | 1143 } |
| 1146 CPDF_Object* pObj = FPDFAPI_GetPageAttr(pPageDict, name); | 1144 CPDF_Object* pObj = FPDFAPI_GetPageAttr(pPageDict, name); |
| 1147 if (pObj) { | 1145 if (pObj) { |
| 1148 pPageDict->SetAt(name, pObj->Clone()); | 1146 pPageDict->SetAt(name, pObj->Clone()); |
| 1149 } | 1147 } |
| 1150 } | 1148 } |
| OLD | NEW |