Skip to content
This repository has been archived by the owner on Apr 3, 2020. It is now read-only.

Commit

Permalink
Disable direct write if font count in registry is greater than or equ…
Browse files Browse the repository at this point in the history
…al to threshold (currently 1750).

[email protected], ananta, asvitkine, cpu, scottmg
BUG=421305

Review URL: https://codereview.chromium.org/667013003

Cr-Commit-Position: refs/heads/master@{#300345}
(cherry picked from commit e2607d4)

Conflicts:
	ui/gfx/win/direct_write.cc

Review URL: https://codereview.chromium.org/671743002

Cr-Commit-Position: refs/branch-heads/2125@{#583}
Cr-Branched-From: b68026d-refs/heads/master@{#290040}
  • Loading branch information
Shrikant Kelkar committed Oct 21, 2014
1 parent 6a14a16 commit 5cbc557
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions content/common/sandbox_win.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
#include "base/win/iat_patch_function.h"
#include "base/win/registry.h"
#include "base/win/scoped_handle.h"
#include "base/win/scoped_process_information.h"
#include "base/win/windows_version.h"
Expand Down Expand Up @@ -603,6 +604,20 @@ bool ShouldUseDirectWrite() {
return true;
#endif

// We have logic in renderer_font_platform_win.cc for falling back to safe
// font list if machine has more than 1750 fonts installed. Users have
// complained about this as safe font list is usually not sufficient.
// We now disable direct write (gdi) if we encounter more number
// of fonts than a threshold (currently 1750).
// Refer: crbug.com/421305
const wchar_t kWindowsFontsRegistryKey[] =
L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Fonts";
base::win::RegistryValueIterator reg_iterator(HKEY_LOCAL_MACHINE,
kWindowsFontsRegistryKey);
const DWORD kMaxAllowedFontsBeforeFallbackToGDI = 1750;
if (reg_iterator.ValueCount() >= kMaxAllowedFontsBeforeFallbackToGDI)
return false;

// Otherwise, check the field trial.
const std::string group_name =
base::FieldTrialList::FindFullName("DirectWrite");
Expand Down

0 comments on commit 5cbc557

Please sign in to comment.