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

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

Issue 382273002: ui/gfx: Allow for font-specific rendering settings. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix fontconfig leak 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
« no previous file with comments | « ui/gfx/platform_font_win.h ('k') | ui/gfx/render_text_harfbuzz.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 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/platform_font_win.h" 5 #include "ui/gfx/platform_font_win.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 #include <math.h> 8 #include <math.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
11 #include <string> 11 #include <string>
12 12
13 #include "base/logging.h" 13 #include "base/logging.h"
14 #include "base/strings/string_util.h" 14 #include "base/strings/string_util.h"
15 #include "base/strings/sys_string_conversions.h" 15 #include "base/strings/sys_string_conversions.h"
16 #include "base/strings/utf_string_conversions.h" 16 #include "base/strings/utf_string_conversions.h"
17 #include "base/win/scoped_gdi_object.h" 17 #include "base/win/scoped_gdi_object.h"
18 #include "base/win/scoped_hdc.h" 18 #include "base/win/scoped_hdc.h"
19 #include "base/win/scoped_select_object.h" 19 #include "base/win/scoped_select_object.h"
20 #include "base/win/win_util.h" 20 #include "base/win/win_util.h"
21 #include "ui/gfx/canvas.h" 21 #include "ui/gfx/canvas.h"
22 #include "ui/gfx/font.h" 22 #include "ui/gfx/font.h"
23 #include "ui/gfx/font_render_params.h"
23 #include "ui/gfx/win/scoped_set_map_mode.h" 24 #include "ui/gfx/win/scoped_set_map_mode.h"
24 25
25 namespace { 26 namespace {
26 27
27 // If the tmWeight field of a TEXTMETRIC structure has a value >= this, the 28 // If the tmWeight field of a TEXTMETRIC structure has a value >= this, the
28 // font is bold. 29 // font is bold.
29 const int kTextMetricWeightBold = 700; 30 const int kTextMetricWeightBold = 700;
30 31
31 // Returns the minimum font size, using the minimum size callback, if set. 32 // Returns the minimum font size, using the minimum size callback, if set.
32 int GetMinimumFontSize() { 33 int GetMinimumFontSize() {
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 &localized_font_name[0]); 185 &localized_font_name[0]);
185 if (length <= 0) 186 if (length <= 0)
186 return GetFontName(); 187 return GetFontName();
187 return base::SysWideToUTF8(localized_font_name); 188 return base::SysWideToUTF8(localized_font_name);
188 } 189 }
189 190
190 int PlatformFontWin::GetFontSize() const { 191 int PlatformFontWin::GetFontSize() const {
191 return font_ref_->font_size(); 192 return font_ref_->font_size();
192 } 193 }
193 194
195 const FontRenderParams& PlatformFontWin::GetFontRenderParams() const {
196 return GetDefaultFontRenderParams();
197 }
198
194 NativeFont PlatformFontWin::GetNativeFont() const { 199 NativeFont PlatformFontWin::GetNativeFont() const {
195 return font_ref_->hfont(); 200 return font_ref_->hfont();
196 } 201 }
197 202
198 //////////////////////////////////////////////////////////////////////////////// 203 ////////////////////////////////////////////////////////////////////////////////
199 // Font, private: 204 // Font, private:
200 205
201 void PlatformFontWin::InitWithCopyOfHFONT(HFONT hfont) { 206 void PlatformFontWin::InitWithCopyOfHFONT(HFONT hfont) {
202 DCHECK(hfont); 207 DCHECK(hfont);
203 LOGFONT font_info; 208 LOGFONT font_info;
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
369 return new PlatformFontWin(native_font); 374 return new PlatformFontWin(native_font);
370 } 375 }
371 376
372 // static 377 // static
373 PlatformFont* PlatformFont::CreateFromNameAndSize(const std::string& font_name, 378 PlatformFont* PlatformFont::CreateFromNameAndSize(const std::string& font_name,
374 int font_size) { 379 int font_size) {
375 return new PlatformFontWin(font_name, font_size); 380 return new PlatformFontWin(font_name, font_size);
376 } 381 }
377 382
378 } // namespace gfx 383 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gfx/platform_font_win.h ('k') | ui/gfx/render_text_harfbuzz.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698