| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "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 | 11 |
| 12 #include "base/logging.h" | 12 #include "base/logging.h" |
| 13 #include "base/string_util.h" | 13 #include "base/string_util.h" |
| 14 #include "base/utf_string_conversions.h" | 14 #include "base/utf_string_conversions.h" |
| 15 #include "base/win/win_util.h" | 15 #include "base/win/win_util.h" |
| 16 #include "gfx/canvas_skia.h" | 16 #include "ui/gfx/canvas_skia.h" |
| 17 #include "gfx/font.h" | 17 #include "ui/gfx/font.h" |
| 18 | 18 |
| 19 namespace { | 19 namespace { |
| 20 | 20 |
| 21 // If the tmWeight field of a TEXTMETRIC structure has a value >= this, the | 21 // If the tmWeight field of a TEXTMETRIC structure has a value >= this, the |
| 22 // font is bold. | 22 // font is bold. |
| 23 const int kTextMetricWeightBold = 700; | 23 const int kTextMetricWeightBold = 700; |
| 24 | 24 |
| 25 // Returns either minimum font allowed for a current locale or | 25 // Returns either minimum font allowed for a current locale or |
| 26 // lf_height + size_delta value. | 26 // lf_height + size_delta value. |
| 27 int AdjustFontSize(int lf_height, int size_delta) { | 27 int AdjustFontSize(int lf_height, int size_delta) { |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 260 return new PlatformFontWin(native_font); | 260 return new PlatformFontWin(native_font); |
| 261 } | 261 } |
| 262 | 262 |
| 263 // static | 263 // static |
| 264 PlatformFont* PlatformFont::CreateFromNameAndSize(const string16& font_name, | 264 PlatformFont* PlatformFont::CreateFromNameAndSize(const string16& font_name, |
| 265 int font_size) { | 265 int font_size) { |
| 266 return new PlatformFontWin(font_name, font_size); | 266 return new PlatformFontWin(font_name, font_size); |
| 267 } | 267 } |
| 268 | 268 |
| 269 } // namespace gfx | 269 } // namespace gfx |
| OLD | NEW |