OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium 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 #include "ui/gfx/win/direct_write.h" | 5 #include "ui/gfx/win/direct_write.h" |
6 | 6 |
7 #include <dwrite.h> | 7 #include <dwrite.h> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 return group_name != "Disabled"; | 57 return group_name != "Disabled"; |
58 } | 58 } |
59 | 59 |
60 void MaybeInitializeDirectWrite() { | 60 void MaybeInitializeDirectWrite() { |
61 static bool tried_dwrite_initialize = false; | 61 static bool tried_dwrite_initialize = false; |
62 if (tried_dwrite_initialize) | 62 if (tried_dwrite_initialize) |
63 return; | 63 return; |
64 tried_dwrite_initialize = true; | 64 tried_dwrite_initialize = true; |
65 | 65 |
66 if (!ShouldUseDirectWrite() || | 66 if (!ShouldUseDirectWrite() || |
67 CommandLine::ForCurrentProcess()->HasSwitch( | 67 base::CommandLine::ForCurrentProcess()->HasSwitch( |
68 switches::kDisableDirectWriteForUI) || | 68 switches::kDisableDirectWriteForUI) || |
69 CommandLine::ForCurrentProcess()->HasSwitch( | 69 base::CommandLine::ForCurrentProcess()->HasSwitch( |
70 switches::kDisableHarfBuzzRenderText)) { | 70 switches::kDisableHarfBuzzRenderText)) { |
71 return; | 71 return; |
72 } | 72 } |
73 | 73 |
74 using DWriteCreateFactoryProc = decltype(DWriteCreateFactory)*; | 74 using DWriteCreateFactoryProc = decltype(DWriteCreateFactory)*; |
75 HMODULE dwrite_dll = LoadLibraryW(L"dwrite.dll"); | 75 HMODULE dwrite_dll = LoadLibraryW(L"dwrite.dll"); |
76 if (!dwrite_dll) | 76 if (!dwrite_dll) |
77 return; | 77 return; |
78 | 78 |
79 DWriteCreateFactoryProc dwrite_create_factory_proc = | 79 DWriteCreateFactoryProc dwrite_create_factory_proc = |
(...skipping 21 matching lines...) Expand all Loading... |
101 SetDefaultSkiaFactory(direct_write_font_mgr); | 101 SetDefaultSkiaFactory(direct_write_font_mgr); |
102 gfx::PlatformFontWin::SetDirectWriteFactory(factory.get()); | 102 gfx::PlatformFontWin::SetDirectWriteFactory(factory.get()); |
103 } | 103 } |
104 | 104 |
105 bool IsDirectWriteEnabled() { | 105 bool IsDirectWriteEnabled() { |
106 return dwrite_enabled; | 106 return dwrite_enabled; |
107 } | 107 } |
108 | 108 |
109 } // namespace win | 109 } // namespace win |
110 } // namespace gfx | 110 } // namespace gfx |
OLD | NEW |