1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "ui/gfx/font_render_params.h"
7 #include "base/logging.h"
13 // Initializes |params| with the system's default settings.
14 void LoadDefaults(FontRenderParams
* params
) {
15 params
->antialiasing
= true;
16 params
->autohinter
= true;
17 params
->use_bitmaps
= true;
18 params
->subpixel_rendering
= FontRenderParams::SUBPIXEL_RENDERING_NONE
;
20 // Use subpixel text positioning to keep consistent character spacing when
21 // the page is scaled by a fractional factor.
22 params
->subpixel_positioning
= true;
23 // Slight hinting renders much better than normal hinting on Android.
24 params
->hinting
= FontRenderParams::HINTING_SLIGHT
;
29 const FontRenderParams
& GetDefaultFontRenderParams() {
30 static bool loaded_defaults
= false;
31 static FontRenderParams default_params
;
33 LoadDefaults(&default_params
);
34 loaded_defaults
= true;
35 return default_params
;
38 FontRenderParams
GetCustomFontRenderParams(
39 bool for_web_contents
,
40 const std::vector
<std::string
>* family_list
,
41 const int* pixel_size
,
42 const int* point_size
,
43 std::string
* family_out
) {
45 return GetDefaultFontRenderParams();
48 const FontRenderParams
& GetDefaultWebKitFontRenderParams() {
49 return GetDefaultFontRenderParams();