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

Unified Diff: ui/gfx/font_render_params_linux.cc

Issue 400193004: Unify desktop Linux and Chrome OS font rendering params. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: use initializer list Created 6 years, 5 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 | « ui/gfx/BUILD.gn ('k') | ui/gfx/font_render_params_linux_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/font_render_params_linux.cc
diff --git a/ui/gfx/font_render_params_linux.cc b/ui/gfx/font_render_params_linux.cc
index acd37f6e616d4072c8006d01cd0f3ab0b2bcb8f6..c33e988911e98a4082ebe8896663544a6050d23a 100644
--- a/ui/gfx/font_render_params_linux.cc
+++ b/ui/gfx/font_render_params_linux.cc
@@ -6,24 +6,15 @@
#include "base/command_line.h"
#include "base/logging.h"
+#include "ui/gfx/linux_font_delegate.h"
#include "ui/gfx/switches.h"
#include <fontconfig/fontconfig.h>
-#if defined(OS_LINUX) && !defined(OS_CHROMEOS)
-#include "ui/gfx/linux_font_delegate.h"
-#endif
-
namespace gfx {
namespace {
-bool SubpixelPositioningRequested(bool for_web_contents) {
- return CommandLine::ForCurrentProcess()->HasSwitch(
- for_web_contents ? switches::kEnableWebkitTextSubpixelPositioning
- : switches::kEnableBrowserTextSubpixelPositioning);
-}
-
// Converts Fontconfig FC_HINT_STYLE to FontRenderParams::Hinting.
FontRenderParams::Hinting ConvertFontconfigHintStyle(int hint_style) {
switch (hint_style) {
@@ -139,40 +130,21 @@ FontRenderParams GetCustomFontRenderParams(
const int* pixel_size,
const int* point_size,
std::string* family_out) {
- FontRenderParams params;
if (family_out)
family_out->clear();
-#if defined(OS_CHROMEOS)
- // Use reasonable defaults.
- params.antialiasing = true;
- params.autohinter = true;
- params.use_bitmaps = true;
- params.hinting = FontRenderParams::HINTING_SLIGHT;
-
- // Query Fontconfig to get the family name and subpixel rendering setting.
- // In general, we try to limit Chrome OS's dependency on Fontconfig, but it's
- // used to configure fonts for different scripts and to disable subpixel
- // rendering on systems that use external displays.
- // TODO(derat): Decide if we should just use Fontconfig wholeheartedly on
- // Chrome OS; Blink is using it, after all.
- FontRenderParams fc_params;
- QueryFontconfig(family_list, pixel_size, point_size, &fc_params, family_out);
- params.subpixel_rendering = fc_params.subpixel_rendering;
-#else
// Start with the delegate's settings, but let Fontconfig have the final say.
- // TODO(derat): Figure out if we need to query the delegate at all. Does
- // GtkSettings always get overridden by Fontconfig in GTK apps?
+ FontRenderParams params;
const LinuxFontDelegate* delegate = LinuxFontDelegate::instance();
- if (delegate) {
- params.antialiasing = delegate->UseAntialiasing();
- params.hinting = delegate->GetHintingStyle();
- params.subpixel_rendering = delegate->GetSubpixelRenderingStyle();
- }
+ if (delegate)
+ params = delegate->GetDefaultFontRenderParams();
QueryFontconfig(family_list, pixel_size, point_size, &params, family_out);
-#endif
- params.subpixel_positioning = SubpixelPositioningRequested(for_web_contents);
+ // Fontconfig doesn't support configuring subpixel positioning; check a flag.
+ params.subpixel_positioning = CommandLine::ForCurrentProcess()->HasSwitch(
+ for_web_contents ?
+ switches::kEnableWebkitTextSubpixelPositioning :
+ switches::kEnableBrowserTextSubpixelPositioning);
// To enable subpixel positioning, we need to disable hinting.
if (params.subpixel_positioning)
« no previous file with comments | « ui/gfx/BUILD.gn ('k') | ui/gfx/font_render_params_linux_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698