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

Side by Side Diff: ui/gfx/font_render_params.cc

Issue 789583002: Updates subpixel positioning and hinting when DSF is changed (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: GN Created 6 years 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/gfx/font_render_params.h" 5 #include "ui/gfx/font_render_params.h"
6 6
7 namespace gfx { 7 namespace gfx {
8 8
9 namespace {
10
11 FontRenderParamsRewriter* g_instance = nullptr;
12 }
13
14 // static
15 FontRenderParamsRewriter* FontRenderParamsRewriter::GetInstance() {
16 return g_instance;
17 }
18
19 // static
20 void FontRenderParamsRewriter::SetInstance(FontRenderParamsRewriter* instance) {
21 Shutdown();
22 g_instance = instance;
23 }
24
25 // static
26 void FontRenderParamsRewriter::Shutdown() {
27 if (g_instance)
28 delete g_instance;
29 g_instance = nullptr;
30 }
31
32 FontRenderParamsRewriter::~FontRenderParamsRewriter() {
33 }
34
9 FontRenderParams::FontRenderParams() 35 FontRenderParams::FontRenderParams()
10 : antialiasing(true), 36 : antialiasing(true),
11 subpixel_positioning(true), 37 subpixel_positioning(true),
12 autohinter(false), 38 autohinter(false),
13 use_bitmaps(false), 39 use_bitmaps(false),
14 hinting(HINTING_MEDIUM), 40 hinting(HINTING_MEDIUM),
15 subpixel_rendering(SUBPIXEL_RENDERING_NONE) { 41 subpixel_rendering(SUBPIXEL_RENDERING_NONE) {
16 } 42 }
17 43
18 FontRenderParams::~FontRenderParams() {} 44 FontRenderParams::~FontRenderParams() {}
19 45
20 FontRenderParamsQuery::FontRenderParamsQuery(bool for_web_contents) 46 FontRenderParamsQuery::FontRenderParamsQuery(bool for_web_contents)
21 : for_web_contents(for_web_contents), 47 : for_web_contents(for_web_contents),
22 pixel_size(0), 48 pixel_size(0),
23 point_size(0), 49 point_size(0),
24 style(-1) { 50 style(-1) {
25 } 51 }
26 52
27 FontRenderParamsQuery::~FontRenderParamsQuery() {} 53 FontRenderParamsQuery::~FontRenderParamsQuery() {}
28 54
55 FontRenderParams GetCurrentFontRenderParams(const FontRenderParamsQuery& query,
56 std::string* family_out) {
57 FontRenderParams params = GetSystemFontRenderParams(query, family_out);
58 if (g_instance)
59 g_instance->RewriteParams(&params);
60 return params;
61 }
62
29 } // namespace gfx 63 } // namespace gfx
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698