| 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/fxge/fx_ge.h" | 7 #include "../../../include/fxge/fx_ge.h" |
| 8 #if _FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN64_ | 8 #if _FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN64_ |
| 9 #include "../../../include/fxge/fx_ge_win32.h" | 9 #include "../../../include/fxge/fx_ge_win32.h" |
| 10 #include <crtdbg.h> | 10 #include <crtdbg.h> |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 return CFX_ByteString(); | 197 return CFX_ByteString(); |
| 198 } | 198 } |
| 199 struct _FontNameMap { | 199 struct _FontNameMap { |
| 200 FX_LPCSTR m_pSubFontName; | 200 FX_LPCSTR m_pSubFontName; |
| 201 FX_LPCSTR m_pSrcFontName; | 201 FX_LPCSTR m_pSrcFontName; |
| 202 }; | 202 }; |
| 203 const _FontNameMap g_JpFontNameMap[] = { | 203 const _FontNameMap g_JpFontNameMap[] = { |
| 204 {"MS Mincho", "Heiseimin-W3"}, | 204 {"MS Mincho", "Heiseimin-W3"}, |
| 205 {"MS Gothic", "Jun101-Light"}, | 205 {"MS Gothic", "Jun101-Light"}, |
| 206 }; | 206 }; |
| 207 const _FontNameMap g_GbFontNameMap[1]; | |
| 208 extern "C" { | 207 extern "C" { |
| 209 static int compareString(const void* key, const void* element) | 208 static int compareString(const void* key, const void* element) |
| 210 { | 209 { |
| 211 return FXSYS_stricmp((FX_LPCSTR)key, ((_FontNameMap*)element)->m_pSrcFon
tName); | 210 return FXSYS_stricmp((FX_LPCSTR)key, ((_FontNameMap*)element)->m_pSrcFon
tName); |
| 212 } | 211 } |
| 213 } | 212 } |
| 214 FX_BOOL _GetSubFontName(CFX_ByteString& name, int lang) | 213 FX_BOOL _GetSubFontName(CFX_ByteString& name) |
| 215 { | 214 { |
| 216 int size = sizeof g_JpFontNameMap; | 215 int size = sizeof g_JpFontNameMap; |
| 217 void* pFontnameMap = (void*)g_JpFontNameMap; | 216 void* pFontnameMap = (void*)g_JpFontNameMap; |
| 218 if (lang == 1) { | |
| 219 size = sizeof g_GbFontNameMap; | |
| 220 pFontnameMap = (void*)g_GbFontNameMap; | |
| 221 } else if (lang == 2) { | |
| 222 size = 0; | |
| 223 } | |
| 224 _FontNameMap* found = (_FontNameMap*)FXSYS_bsearch((FX_LPCSTR)name, pFontnam
eMap, | 217 _FontNameMap* found = (_FontNameMap*)FXSYS_bsearch((FX_LPCSTR)name, pFontnam
eMap, |
| 225 size / sizeof (_FontNameMap), sizeof (_FontNameMap), c
ompareString); | 218 size / sizeof (_FontNameMap), sizeof (_FontNameMap), c
ompareString); |
| 226 if (found == NULL) { | 219 if (found == NULL) { |
| 227 return FALSE; | 220 return FALSE; |
| 228 } | 221 } |
| 229 name = found->m_pSubFontName; | 222 name = found->m_pSubFontName; |
| 230 return TRUE; | 223 return TRUE; |
| 231 } | 224 } |
| 232 void CWin32FontInfo::GetGBPreference(CFX_ByteString& face, int weight, int picth
_family) | 225 void CWin32FontInfo::GetGBPreference(CFX_ByteString& face, int weight, int picth
_family) |
| 233 { | 226 { |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 } | 266 } |
| 274 return; | 267 return; |
| 275 } else if (face.Find("Mincho") >= 0 || face.Find("\x96\xbe\x92\xa9") >= 0) { | 268 } else if (face.Find("Mincho") >= 0 || face.Find("\x96\xbe\x92\xa9") >= 0) { |
| 276 if (face.Find("PMincho") >= 0 || face.Find("\x82\x6f\x96\xbe\x92\xa9") >
= 0) { | 269 if (face.Find("PMincho") >= 0 || face.Find("\x82\x6f\x96\xbe\x92\xa9") >
= 0) { |
| 277 face = "MS PMincho"; | 270 face = "MS PMincho"; |
| 278 } else { | 271 } else { |
| 279 face = "MS Mincho"; | 272 face = "MS Mincho"; |
| 280 } | 273 } |
| 281 return; | 274 return; |
| 282 } | 275 } |
| 283 if (_GetSubFontName(face, 0)) { | 276 if (_GetSubFontName(face)) { |
| 284 return; | 277 return; |
| 285 } | 278 } |
| 286 if (!(picth_family & FF_ROMAN) && weight > 400) { | 279 if (!(picth_family & FF_ROMAN) && weight > 400) { |
| 287 face = "MS PGothic"; | 280 face = "MS PGothic"; |
| 288 } else { | 281 } else { |
| 289 face = "MS PMincho"; | 282 face = "MS PMincho"; |
| 290 } | 283 } |
| 291 } | 284 } |
| 292 void* CWin32FontInfo::MapFont(int weight, FX_BOOL bItalic, int charset, int pitc
h_family, FX_LPCSTR cstr_face, FX_BOOL& bExact) | 285 void* CWin32FontInfo::MapFont(int weight, FX_BOOL bItalic, int charset, int pitc
h_family, FX_LPCSTR cstr_face, FX_BOOL& bExact) |
| 293 { | 286 { |
| (...skipping 902 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1196 if (m_hDC) { | 1189 if (m_hDC) { |
| 1197 SelectObject(m_hDC, m_hOldBitmap); | 1190 SelectObject(m_hDC, m_hOldBitmap); |
| 1198 DeleteDC(m_hDC); | 1191 DeleteDC(m_hDC); |
| 1199 } | 1192 } |
| 1200 if (m_hBitmap) { | 1193 if (m_hBitmap) { |
| 1201 DeleteObject(m_hBitmap); | 1194 DeleteObject(m_hBitmap); |
| 1202 } | 1195 } |
| 1203 delete GetBitmap(); | 1196 delete GetBitmap(); |
| 1204 } | 1197 } |
| 1205 #endif | 1198 #endif |
| OLD | NEW |