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 | 8 |
9 #if _FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN64_DESKTOP_ | 9 #if _FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN64_DESKTOP_ |
10 #include <crtdbg.h> | 10 #include <crtdbg.h> |
11 | 11 |
12 #include "../../../include/fxcodec/fx_codec.h" | 12 #include "../../../include/fxcodec/fx_codec.h" |
13 #include "../../../include/fxge/fx_freetype.h" | 13 #include "../../../include/fxge/fx_freetype.h" |
14 #include "../../../include/fxge/fx_ge_win32.h" | 14 #include "../../../include/fxge/fx_ge_win32.h" |
15 #include "../agg/include/fx_agg_driver.h" | 15 #include "../agg/include/fx_agg_driver.h" |
16 #include "../dib/dib_int.h" | 16 #include "../dib/dib_int.h" |
17 #include "../ge/text_int.h" | 17 #include "../ge/text_int.h" |
18 #include "dwrite_int.h" | 18 #include "dwrite_int.h" |
19 #include "win32_int.h" | 19 #include "win32_int.h" |
20 | 20 |
21 class CWin32FontInfo final : public IFX_SystemFontInfo | 21 class CWin32FontInfo final : public IFX_SystemFontInfo |
22 { | 22 { |
23 public: | 23 public: |
24 CWin32FontInfo(); | 24 CWin32FontInfo(); |
25 ~CWin32FontInfo(); | 25 ~CWin32FontInfo(); |
26 virtual void Release(); | 26 virtual void Release(); |
27 virtual FX_BOOL EnumFontList(CFX_FontMapper* pMapper); | 27 virtual FX_BOOL EnumFontList(CFX_FontMapper* pMapper); |
28 virtual void*» » MapFont(int weight, FX_BOOL bItalic, int charset
, int pitch_family, const FX_CHAR* face, FX_BOOL& bExact); | 28 virtual void*» » MapFont(int weight, FX_BOOL bItalic, int charset
, int pitch_family, const FX_CHAR* face, int& iExact); |
29 virtual void* GetFont(const FX_CHAR* face) | 29 virtual void* GetFont(const FX_CHAR* face) |
30 { | 30 { |
31 return NULL; | 31 return NULL; |
32 } | 32 } |
33 virtual FX_DWORD GetFontData(void* hFont, FX_DWORD table, uint8_t* buffer
, FX_DWORD size); | 33 virtual FX_DWORD GetFontData(void* hFont, FX_DWORD table, uint8_t* buffer
, FX_DWORD size); |
34 virtual void DeleteFont(void* hFont); | 34 virtual void DeleteFont(void* hFont); |
35 virtual FX_BOOL GetFaceName(void* hFont, CFX_ByteString& name); | 35 virtual FX_BOOL GetFaceName(void* hFont, CFX_ByteString& name); |
36 virtual FX_BOOL GetFontCharset(void* hFont, int& charset); | 36 virtual FX_BOOL GetFontCharset(void* hFont, int& charset); |
37 FX_BOOL IsOpenTypeFromDiv(const LOGFONTA *plf); | 37 FX_BOOL IsOpenTypeFromDiv(const LOGFONTA *plf); |
38 FX_BOOL IsSupportFontFormDiv(const LOGFONTA* plf
); | 38 FX_BOOL IsSupportFontFormDiv(const LOGFONTA* plf
); |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
278 } | 278 } |
279 if (_GetSubFontName(face)) { | 279 if (_GetSubFontName(face)) { |
280 return; | 280 return; |
281 } | 281 } |
282 if (!(picth_family & FF_ROMAN) && weight > 400) { | 282 if (!(picth_family & FF_ROMAN) && weight > 400) { |
283 face = "MS PGothic"; | 283 face = "MS PGothic"; |
284 } else { | 284 } else { |
285 face = "MS PMincho"; | 285 face = "MS PMincho"; |
286 } | 286 } |
287 } | 287 } |
288 void* CWin32FontInfo::MapFont(int weight, FX_BOOL bItalic, int charset, int pitc
h_family, const FX_CHAR* cstr_face, FX_BOOL& bExact) | 288 void* CWin32FontInfo::MapFont(int weight, FX_BOOL bItalic, int charset, int pitc
h_family, const FX_CHAR* cstr_face, int& iExact) |
289 { | 289 { |
290 CFX_ByteString face = cstr_face; | 290 CFX_ByteString face = cstr_face; |
291 int iBaseFont; | 291 int iBaseFont; |
292 for (iBaseFont = 0; iBaseFont < 12; iBaseFont ++) | 292 for (iBaseFont = 0; iBaseFont < 12; iBaseFont ++) |
293 if (face == CFX_ByteStringC(Base14Substs[iBaseFont].m_pName)) { | 293 if (face == CFX_ByteStringC(Base14Substs[iBaseFont].m_pName)) { |
294 face = Base14Substs[iBaseFont].m_pWinName; | 294 face = Base14Substs[iBaseFont].m_pWinName; |
295 weight = Base14Substs[iBaseFont].m_bBold ? FW_BOLD : FW_NORMAL; | 295 weight = Base14Substs[iBaseFont].m_bBold ? FW_BOLD : FW_NORMAL; |
296 bItalic = Base14Substs[iBaseFont].m_bItalic; | 296 bItalic = Base14Substs[iBaseFont].m_bItalic; |
297 bExact = TRUE; | 297 iExact = TRUE; |
298 break; | 298 break; |
299 } | 299 } |
300 if (charset == ANSI_CHARSET || charset == SYMBOL_CHARSET) { | 300 if (charset == ANSI_CHARSET || charset == SYMBOL_CHARSET) { |
301 charset = DEFAULT_CHARSET; | 301 charset = DEFAULT_CHARSET; |
302 } | 302 } |
303 int subst_pitch_family = pitch_family; | 303 int subst_pitch_family = pitch_family; |
304 switch (charset) { | 304 switch (charset) { |
305 case SHIFTJIS_CHARSET: | 305 case SHIFTJIS_CHARSET: |
306 subst_pitch_family = FF_ROMAN; | 306 subst_pitch_family = FF_ROMAN; |
307 break; | 307 break; |
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
587 // The boolen codes is B8. Based on http://msdn.microsoft.com/en-us/library/
aa932106.aspx, the ROP3 code is 0xB8074A | 587 // The boolen codes is B8. Based on http://msdn.microsoft.com/en-us/library/
aa932106.aspx, the ROP3 code is 0xB8074A |
588 | 588 |
589 ::StretchDIBits(m_hDC, dest_left, dest_top, dest_width, dest_height, | 589 ::StretchDIBits(m_hDC, dest_left, dest_top, dest_width, dest_height, |
590 0, 0, width, height, pBitmap->GetBuffer(), (BITMAPINFO*)&bmi
, DIB_RGB_COLORS, 0xB8074A); | 590 0, 0, width, height, pBitmap->GetBuffer(), (BITMAPINFO*)&bmi
, DIB_RGB_COLORS, 0xB8074A); |
591 | 591 |
592 SelectObject(m_hDC, hOld); | 592 SelectObject(m_hDC, hOld); |
593 DeleteObject(hPattern); | 593 DeleteObject(hPattern); |
594 | 594 |
595 return TRUE; | 595 return TRUE; |
596 } | 596 } |
597 BOOL CGdiDeviceDriver::GetClipBox(FX_RECT* pRect) | 597 FX_BOOL CGdiDeviceDriver::GetClipBox(FX_RECT* pRect) |
598 { | 598 { |
599 return ::GetClipBox(m_hDC, (RECT*)pRect); | 599 return ::GetClipBox(m_hDC, (RECT*)pRect); |
600 } | 600 } |
601 FX_BOOL CGdiDeviceDriver::SetClipRgn(void* hRgn) | 601 FX_BOOL CGdiDeviceDriver::SetClipRgn(void* hRgn) |
602 { | 602 { |
603 ::SelectClipRgn(m_hDC, (HRGN)hRgn); | 603 ::SelectClipRgn(m_hDC, (HRGN)hRgn); |
604 return TRUE; | 604 return TRUE; |
605 } | 605 } |
606 static HPEN _CreatePen(const CFX_GraphStateData* pGraphState, const CFX_AffineMa
trix* pMatrix, FX_DWORD argb) | 606 static HPEN _CreatePen(const CFX_GraphStateData* pGraphState, const CFX_AffineMa
trix* pMatrix, FX_DWORD argb) |
607 { | 607 { |
(...skipping 589 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1197 SelectObject(m_hDC, m_hOldBitmap); | 1197 SelectObject(m_hDC, m_hOldBitmap); |
1198 DeleteDC(m_hDC); | 1198 DeleteDC(m_hDC); |
1199 } | 1199 } |
1200 if (m_hBitmap) { | 1200 if (m_hBitmap) { |
1201 DeleteObject(m_hBitmap); | 1201 DeleteObject(m_hBitmap); |
1202 } | 1202 } |
1203 delete GetBitmap(); | 1203 delete GetBitmap(); |
1204 } | 1204 } |
1205 | 1205 |
1206 #endif // _FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN64_ | 1206 #endif // _FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN64_ |
OLD | NEW |