Chromium Code Reviews| Index: chrome/browser/ui/webui/options/font_settings_utils.cc |
| diff --git a/chrome/browser/ui/webui/options/font_settings_utils.cc b/chrome/browser/ui/webui/options/font_settings_utils.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..e7e46c2bae16e38eaa466149a03bfb14664fcb9d |
| --- /dev/null |
| +++ b/chrome/browser/ui/webui/options/font_settings_utils.cc |
| @@ -0,0 +1,29 @@ |
| +// Copyright (c) 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "chrome/browser/ui/webui/options/font_settings_utils.h" |
| + |
| +#include "ui/gfx/font.h" |
| + |
| +namespace options { |
| + |
| +// Returns the first available font if it starts with ",". |
|
msw
2016/10/26 20:33:49
These comments belong with the function declaratio
kojii
2016/10/26 22:20:02
Thank you, not very familiar with Chromium side ye
|
| +std::string FontSettingsUtilities::ResolveFontList( |
| + const std::string& font_name_or_list) { |
| + if (!font_name_or_list.empty() && font_name_or_list[0] == ',') |
| + return gfx::Font::FirstAvailableOrFirst(font_name_or_list); |
|
msw
2016/10/26 20:33:49
Why aren't we using the standard gfx::FontList cod
kojii
2016/10/26 22:20:02
gfx::FontList cascades by the availability of glyp
msw
2016/10/27 00:04:18
Using FontList to just parse the string and then r
|
| + return font_name_or_list; |
| +} |
| + |
| +#if !defined(OS_WIN) |
| +// Returns the localized name of a font so that settings can find it within the |
| +// list of system fonts. On Windows, the list of system fonts has names only |
| +// for the system locale, but the pref value may be in the English name. |
| +std::string FontSettingsUtilities::MaybeGetLocalizedFontName( |
|
msw
2016/10/26 20:33:49
Ditto to my comments and questions above.
|
| + const std::string& font_name_or_list) { |
| + return ResolveFontList(font_name_or_list); |
| +} |
| +#endif |
| + |
| +} // namespace options |