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

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

Issue 387743002: Apply hinting in SkiaTextRenderer::SetFontRenderParams(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: apply review feedback 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 unified diff | Download patch | Annotate | Revision Log
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 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "base/memory/singleton.h" 8 #include "base/memory/singleton.h"
9 #include "ui/gfx/win/singleton_hwnd.h" 9 #include "ui/gfx/win/singleton_hwnd.h"
10 10
11 namespace gfx { 11 namespace gfx {
12 12
13 namespace { 13 namespace {
14 14
15 // Caches font render params and updates them on system notifications. 15 // Caches font render params and updates them on system notifications.
16 class CachedFontRenderParams : public gfx::SingletonHwnd::Observer { 16 class CachedFontRenderParams : public gfx::SingletonHwnd::Observer {
17 public: 17 public:
18 static CachedFontRenderParams* GetInstance() { 18 static CachedFontRenderParams* GetInstance() {
19 return Singleton<CachedFontRenderParams>::get(); 19 return Singleton<CachedFontRenderParams>::get();
20 } 20 }
21 21
22 const FontRenderParams& GetParams() { 22 const FontRenderParams& GetParams() {
23 if (params_) 23 if (params_)
24 return *params_; 24 return *params_;
25 25
26 params_.reset(new FontRenderParams()); 26 params_.reset(new FontRenderParams());
27 params_->antialiasing = false; 27 params_->antialiasing = false;
28 params_->subpixel_positioning = false; 28 params_->subpixel_positioning = false;
29 params_->autohinter = false;
30 params_->use_bitmaps = false;
31 params_->hinting = FontRenderParams::HINTING_MEDIUM;
29 params_->subpixel_rendering = FontRenderParams::SUBPIXEL_RENDERING_NONE; 32 params_->subpixel_rendering = FontRenderParams::SUBPIXEL_RENDERING_NONE;
30 33
31 BOOL enabled = false; 34 BOOL enabled = false;
32 if (SystemParametersInfo(SPI_GETFONTSMOOTHING, 0, &enabled, 0) && enabled) { 35 if (SystemParametersInfo(SPI_GETFONTSMOOTHING, 0, &enabled, 0) && enabled) {
33 params_->antialiasing = true; 36 params_->antialiasing = true;
34 params_->subpixel_positioning = true; 37 params_->subpixel_positioning = true;
35 38
36 UINT type = 0; 39 UINT type = 0;
37 if (SystemParametersInfo(SPI_GETFONTSMOOTHINGTYPE, 0, &type, 0) && 40 if (SystemParametersInfo(SPI_GETFONTSMOOTHINGTYPE, 0, &type, 0) &&
38 type == FE_FONTSMOOTHINGCLEARTYPE) { 41 type == FE_FONTSMOOTHINGCLEARTYPE) {
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 74
72 const FontRenderParams& GetDefaultFontRenderParams() { 75 const FontRenderParams& GetDefaultFontRenderParams() {
73 return CachedFontRenderParams::GetInstance()->GetParams(); 76 return CachedFontRenderParams::GetInstance()->GetParams();
74 } 77 }
75 78
76 const FontRenderParams& GetDefaultWebKitFontRenderParams() { 79 const FontRenderParams& GetDefaultWebKitFontRenderParams() {
77 return GetDefaultFontRenderParams(); 80 return GetDefaultFontRenderParams();
78 } 81 }
79 82
80 } // namespace gfx 83 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gfx/font_render_params_linux.cc ('k') | ui/gfx/gfx.gyp » ('j') | ui/gfx/render_text.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698