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

Side by Side Diff: ui/gfx/win/direct_write.cc

Issue 796643004: Experimental change: Remove DirectWrite 1750 font limit. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Modified data file version in DirectWrite unittest. Created 6 years 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
« no previous file with comments | « content/test/data/font/dwrite_font_cache_corrupt.dat ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 27 matching lines...) Expand all
38 // If forced off, don't use it. 38 // If forced off, don't use it.
39 const base::CommandLine& command_line = 39 const base::CommandLine& command_line =
40 *base::CommandLine::ForCurrentProcess(); 40 *base::CommandLine::ForCurrentProcess();
41 if (command_line.HasSwitch(switches::kDisableDirectWrite)) 41 if (command_line.HasSwitch(switches::kDisableDirectWrite))
42 return false; 42 return false;
43 43
44 // Can't use GDI on HiDPI. 44 // Can't use GDI on HiDPI.
45 if (gfx::GetDPIScale() > 1.0f) 45 if (gfx::GetDPIScale() > 1.0f)
46 return true; 46 return true;
47 47
48 // We have logic in renderer_font_platform_win.cc for falling back to safe
49 // font list if machine has more than 1750 fonts installed. Users have
50 // complained about this as safe font list is usually not sufficient.
51 // We now disable direct write (gdi) if we encounter more number
52 // of fonts than a threshold (currently 1750).
53 // Refer: crbug.com/421305
54 const wchar_t kWindowsFontsRegistryKey[] =
55 L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Fonts";
56 base::win::RegistryValueIterator reg_iterator(HKEY_LOCAL_MACHINE,
57 kWindowsFontsRegistryKey);
58 const DWORD kMaxAllowedFontsBeforeFallbackToGDI = 1750;
59 if (reg_iterator.ValueCount() >= kMaxAllowedFontsBeforeFallbackToGDI)
60 return false;
61
62 // Otherwise, check the field trial. 48 // Otherwise, check the field trial.
63 const std::string group_name = 49 const std::string group_name =
64 base::FieldTrialList::FindFullName("DirectWrite"); 50 base::FieldTrialList::FindFullName("DirectWrite");
65 return group_name != "Disabled"; 51 return group_name != "Disabled";
66 } 52 }
67 53
68 void MaybeInitializeDirectWrite() { 54 void MaybeInitializeDirectWrite() {
69 static bool tried_dwrite_initialize = false; 55 static bool tried_dwrite_initialize = false;
70 if (tried_dwrite_initialize) 56 if (tried_dwrite_initialize)
71 return; 57 return;
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 // (6.1.7600.*). We should just use GDI in these cases. 90 // (6.1.7600.*). We should just use GDI in these cases.
105 SkFontMgr* direct_write_font_mgr = SkFontMgr_New_DirectWrite(factory.get()); 91 SkFontMgr* direct_write_font_mgr = SkFontMgr_New_DirectWrite(factory.get());
106 if (direct_write_font_mgr) { 92 if (direct_write_font_mgr) {
107 SetDefaultSkiaFactory(direct_write_font_mgr); 93 SetDefaultSkiaFactory(direct_write_font_mgr);
108 gfx::PlatformFontWin::SetDirectWriteFactory(factory.get()); 94 gfx::PlatformFontWin::SetDirectWriteFactory(factory.get());
109 } 95 }
110 } 96 }
111 97
112 } // namespace win 98 } // namespace win
113 } // namespace gfx 99 } // namespace gfx
OLDNEW
« no previous file with comments | « content/test/data/font/dwrite_font_cache_corrupt.dat ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698