| 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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 base::CommandLine::ForCurrentProcess()->HasSwitch( | 67 base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 68 switches::kDisableDirectWriteForUI) || | 68 switches::kDisableDirectWriteForUI)) { |
| 69 base::CommandLine::ForCurrentProcess()->HasSwitch( | |
| 70 switches::kDisableHarfBuzzRenderText)) { | |
| 71 return; | 69 return; |
| 72 } | 70 } |
| 73 | 71 |
| 74 using DWriteCreateFactoryProc = decltype(DWriteCreateFactory)*; | 72 using DWriteCreateFactoryProc = decltype(DWriteCreateFactory)*; |
| 75 HMODULE dwrite_dll = LoadLibraryW(L"dwrite.dll"); | 73 HMODULE dwrite_dll = LoadLibraryW(L"dwrite.dll"); |
| 76 if (!dwrite_dll) | 74 if (!dwrite_dll) |
| 77 return; | 75 return; |
| 78 | 76 |
| 79 DWriteCreateFactoryProc dwrite_create_factory_proc = | 77 DWriteCreateFactoryProc dwrite_create_factory_proc = |
| 80 reinterpret_cast<DWriteCreateFactoryProc>( | 78 reinterpret_cast<DWriteCreateFactoryProc>( |
| (...skipping 23 matching lines...) Expand all Loading... |
| 104 SetDefaultSkiaFactory(direct_write_font_mgr); | 102 SetDefaultSkiaFactory(direct_write_font_mgr); |
| 105 gfx::PlatformFontWin::SetDirectWriteFactory(factory.get()); | 103 gfx::PlatformFontWin::SetDirectWriteFactory(factory.get()); |
| 106 } | 104 } |
| 107 | 105 |
| 108 bool IsDirectWriteEnabled() { | 106 bool IsDirectWriteEnabled() { |
| 109 return dwrite_enabled; | 107 return dwrite_enabled; |
| 110 } | 108 } |
| 111 | 109 |
| 112 } // namespace win | 110 } // namespace win |
| 113 } // namespace gfx | 111 } // namespace gfx |
| OLD | NEW |