Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(219)

Side by Side Diff: core/fxge/win32/fx_win32_device.cpp

Issue 2612243005: Add postscript path (Closed)
Patch Set: Small fixes, add comments Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <crtdbg.h> 7 #include <crtdbg.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <memory> 10 #include <memory>
11 #include <vector> 11 #include <vector>
12 12
13 #include "core/fxcodec/fx_codec.h" 13 #include "core/fxcodec/fx_codec.h"
14 #include "core/fxcrt/cfx_maybe_owned.h" 14 #include "core/fxcrt/cfx_maybe_owned.h"
15 #include "core/fxcrt/fx_memory.h" 15 #include "core/fxcrt/fx_memory.h"
16 #include "core/fxcrt/fx_system.h" 16 #include "core/fxcrt/fx_system.h"
17 #include "core/fxge/cfx_fontmapper.h"
18 #include "core/fxge/cfx_gemodule.h"
19 #include "core/fxge/cfx_graphstatedata.h"
20 #include "core/fxge/cfx_pathdata.h"
21 #include "core/fxge/cfx_windowsdevice.h" 17 #include "core/fxge/cfx_windowsdevice.h"
22 #include "core/fxge/dib/dib_int.h" 18 #include "core/fxge/dib/dib_int.h"
23 #include "core/fxge/fx_font.h" 19 #include "core/fxge/fx_font.h"
24 #include "core/fxge/fx_freetype.h" 20 #include "core/fxge/fx_freetype.h"
25 #include "core/fxge/ge/cfx_folderfontinfo.h" 21 #include "core/fxge/ge/cfx_folderfontinfo.h"
26 #include "core/fxge/ge/fx_text_int.h" 22 #include "core/fxge/ge/fx_text_int.h"
27 #include "core/fxge/ifx_systemfontinfo.h" 23 #include "core/fxge/ifx_systemfontinfo.h"
28 #include "core/fxge/win32/cfx_windowsdib.h" 24 #include "core/fxge/win32/cfx_windowsdib.h"
29 #include "core/fxge/win32/dwrite_int.h" 25 #include "core/fxge/win32/dwrite_int.h"
30 #include "core/fxge/win32/win32_int.h" 26 #include "core/fxge/win32/win32_int.h"
(...skipping 659 matching lines...) Expand 10 before | Expand all | Expand 10 after
690 TEXTMETRIC tm; 686 TEXTMETRIC tm;
691 HFONT hOldFont = (HFONT)::SelectObject(m_hDC, (HFONT)hFont); 687 HFONT hOldFont = (HFONT)::SelectObject(m_hDC, (HFONT)hFont);
692 ::GetTextMetrics(m_hDC, &tm); 688 ::GetTextMetrics(m_hDC, &tm);
693 ::SelectObject(m_hDC, hOldFont); 689 ::SelectObject(m_hDC, hOldFont);
694 charset = tm.tmCharSet; 690 charset = tm.tmCharSet;
695 return true; 691 return true;
696 } 692 }
697 693
698 } // namespace 694 } // namespace
699 695
696 int g_pdfium_print_postscript_level = 0;
697
700 std::unique_ptr<IFX_SystemFontInfo> IFX_SystemFontInfo::CreateDefault( 698 std::unique_ptr<IFX_SystemFontInfo> IFX_SystemFontInfo::CreateDefault(
701 const char** pUnused) { 699 const char** pUnused) {
702 if (IsGDIEnabled()) 700 if (IsGDIEnabled())
703 return std::unique_ptr<IFX_SystemFontInfo>(new CFX_Win32FontInfo); 701 return std::unique_ptr<IFX_SystemFontInfo>(new CFX_Win32FontInfo);
704 702
705 // Select the fallback font information class if GDI is disabled. 703 // Select the fallback font information class if GDI is disabled.
706 CFX_Win32FallbackFontInfo* pInfoFallback = new CFX_Win32FallbackFontInfo; 704 CFX_Win32FallbackFontInfo* pInfoFallback = new CFX_Win32FallbackFontInfo;
707 // Construct the font path manually, SHGetKnownFolderPath won't work under 705 // Construct the font path manually, SHGetKnownFolderPath won't work under
708 // a restrictive sandbox. 706 // a restrictive sandbox.
709 CHAR windows_path[MAX_PATH] = {}; 707 CHAR windows_path[MAX_PATH] = {};
(...skipping 670 matching lines...) Expand 10 before | Expand all | Expand 10 after
1380 IFX_RenderDeviceDriver* pRDD = GetDeviceDriver(); 1378 IFX_RenderDeviceDriver* pRDD = GetDeviceDriver();
1381 return pRDD ? reinterpret_cast<HDC>(pRDD->GetPlatformSurface()) : nullptr; 1379 return pRDD ? reinterpret_cast<HDC>(pRDD->GetPlatformSurface()) : nullptr;
1382 } 1380 }
1383 1381
1384 // static 1382 // static
1385 IFX_RenderDeviceDriver* CFX_WindowsDevice::CreateDriver(HDC hDC) { 1383 IFX_RenderDeviceDriver* CFX_WindowsDevice::CreateDriver(HDC hDC) {
1386 int device_type = ::GetDeviceCaps(hDC, TECHNOLOGY); 1384 int device_type = ::GetDeviceCaps(hDC, TECHNOLOGY);
1387 int obj_type = ::GetObjectType(hDC); 1385 int obj_type = ::GetObjectType(hDC);
1388 bool use_printer = device_type == DT_RASPRINTER || 1386 bool use_printer = device_type == DT_RASPRINTER ||
1389 device_type == DT_PLOTTER || obj_type == OBJ_ENHMETADC; 1387 device_type == DT_PLOTTER || obj_type == OBJ_ENHMETADC;
1390 if (use_printer) 1388
1389 if (!use_printer)
1390 return new CGdiDisplayDriver(hDC);
1391
1392 if (g_pdfium_print_postscript_level == 2 ||
1393 g_pdfium_print_postscript_level == 3) {
1394 return new CPSPrinterDriver(hDC, g_pdfium_print_postscript_level, false);
1395 } else {
Tom Sepez 2017/01/09 20:18:20 nit: else after return not needed.
rbpotter 2017/01/10 20:28:24 Done.
1391 return new CGdiPrinterDriver(hDC); 1396 return new CGdiPrinterDriver(hDC);
1392 return new CGdiDisplayDriver(hDC); 1397 }
1393 } 1398 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698