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

Unified Diff: content/renderer/renderer_font_platform_win.cc

Issue 541543002: Code to take into account font path specified in registry which matches system font folder. Also ad… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/renderer_font_platform_win.cc
diff --git a/content/renderer/renderer_font_platform_win.cc b/content/renderer/renderer_font_platform_win.cc
index b125fe7fc233f376b34c6e1514b4f8f054cbfb5f..4812a4e9f4b0edac88ca6e9abe6adba4371de17c 100644
--- a/content/renderer/renderer_font_platform_win.cc
+++ b/content/renderer/renderer_font_platform_win.cc
@@ -17,6 +17,7 @@
#include "base/files/memory_mapped_file.h"
#include "base/memory/scoped_ptr.h"
#include "base/memory/scoped_vector.h"
+#include "base/metrics/histogram.h"
#include "base/path_service.h"
#include "base/strings/utf_string_conversions.h"
#include "base/time/time.h"
@@ -266,6 +267,9 @@ bool FontCollectionLoader::LoadFontListFromRegistry() {
return false;
}
+ base::FilePath system_font_path;
+ PathService::Get(base::DIR_WINDOWS_FONTS, &system_font_path);
+
std::wstring name;
std::wstring value;
for (DWORD idx = 0; idx < regkey.GetValueCount(); idx++) {
@@ -276,11 +280,16 @@ bool FontCollectionLoader::LoadFontListFromRegistry() {
// we will ignore all other registry entries.
std::vector<base::FilePath::StringType> components;
path.GetComponents(&components);
- if (components.size() == 1) {
- reg_fonts_.push_back(value.c_str());
+ if (components.size() == 1 ||
+ base::FilePath::CompareEqualIgnoreCase(system_font_path.value(),
+ path.DirName().value())) {
+ reg_fonts_.push_back(path.BaseName().value());
}
}
}
+ UMA_HISTOGRAM_COUNTS("DirectWrite.Fonts.Loaded", reg_fonts_.size());
+ UMA_HISTOGRAM_COUNTS("DirectWrite.Fonts.Ignored",
+ regkey.GetValueCount() - reg_fonts_.size());
return true;
}
@@ -366,6 +375,8 @@ IDWriteFontCollection* GetCustomFontCollection(IDWriteFactory* factory) {
CHECK(SUCCEEDED(hr));
CHECK(g_font_collection.Get() != NULL);
+ UMA_HISTOGRAM_TIMES("DirectWrite.Fonts.LoadTime", time_delta);
+
base::debug::ClearCrashKey(kFontKeyName);
return g_font_collection.Get();
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698