Chromium Code Reviews| 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 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 321 HFONT hOldFont = (HFONT)::SelectObject(m_hDC, hFont); | 321 HFONT hOldFont = (HFONT)::SelectObject(m_hDC, hFont); |
| 322 int ret = ::GetTextFaceA(m_hDC, 100, facebuf); | 322 int ret = ::GetTextFaceA(m_hDC, 100, facebuf); |
| 323 ::SelectObject(m_hDC, hOldFont); | 323 ::SelectObject(m_hDC, hOldFont); |
| 324 if (face.EqualNoCase(facebuf)) { | 324 if (face.EqualNoCase(facebuf)) { |
| 325 return hFont; | 325 return hFont; |
| 326 } | 326 } |
| 327 int iCount = sizeof(VariantNames) / sizeof(VariantNames[0]); | 327 int iCount = sizeof(VariantNames) / sizeof(VariantNames[0]); |
| 328 for (int i = 0; i < iCount; ++i) { | 328 for (int i = 0; i < iCount; ++i) { |
| 329 if (face == VariantNames[i].m_pFaceName) { | 329 if (face == VariantNames[i].m_pFaceName) { |
| 330 CFX_WideString wsFace = CFX_WideString::FromLocal(facebuf); | 330 CFX_WideString wsFace = CFX_WideString::FromLocal(facebuf); |
| 331 CFX_WideString wsName = CFX_WideString::FromUTF16LE((const unsigned short*)VariantNames[i].m_pVariantName); | 331 const unsigned short* pName = (const unsigned short*)VariantNames[i] .m_pVariantName; |
| 332 FX_STRSIZE len = 0; | |
| 333 while (pName[len]) len++; | |
|
palmer
2014/07/12 00:54:39
Use wcslen?
Bo Xu
2014/07/12 05:18:04
Done.
| |
| 334 CFX_WideString wsName = CFX_WideString::FromUTF16LE(pName, len); | |
| 335 | |
| 332 if (wsFace == wsName) { | 336 if (wsFace == wsName) { |
| 333 return hFont; | 337 return hFont; |
| 334 } | 338 } |
| 335 } | 339 } |
| 336 } | 340 } |
| 337 ::DeleteObject(hFont); | 341 ::DeleteObject(hFont); |
| 338 if (charset == DEFAULT_CHARSET) { | 342 if (charset == DEFAULT_CHARSET) { |
| 339 return NULL; | 343 return NULL; |
| 340 } | 344 } |
| 341 switch (charset) { | 345 switch (charset) { |
| (...skipping 854 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1196 if (m_hDC) { | 1200 if (m_hDC) { |
| 1197 SelectObject(m_hDC, m_hOldBitmap); | 1201 SelectObject(m_hDC, m_hOldBitmap); |
| 1198 DeleteDC(m_hDC); | 1202 DeleteDC(m_hDC); |
| 1199 } | 1203 } |
| 1200 if (m_hBitmap) { | 1204 if (m_hBitmap) { |
| 1201 DeleteObject(m_hBitmap); | 1205 DeleteObject(m_hBitmap); |
| 1202 } | 1206 } |
| 1203 delete GetBitmap(); | 1207 delete GetBitmap(); |
| 1204 } | 1208 } |
| 1205 #endif | 1209 #endif |
| OLD | NEW |