| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 #ifndef CHROME_COMMON_GFX_CHROME_FONT_H_ | 5 #ifndef CHROME_COMMON_GFX_CHROME_FONT_H_ |
| 6 #define CHROME_COMMON_GFX_CHROME_FONT_H_ | 6 #define CHROME_COMMON_GFX_CHROME_FONT_H_ |
| 7 | 7 |
| 8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 | 108 |
| 109 // Dialog units to pixels conversion. | 109 // Dialog units to pixels conversion. |
| 110 // See http://support.microsoft.com/kb/145994 for details. | 110 // See http://support.microsoft.com/kb/145994 for details. |
| 111 int horizontal_dlus_to_pixels(int dlus) { | 111 int horizontal_dlus_to_pixels(int dlus) { |
| 112 return dlus * font_ref_->dlu_base_x() / 4; | 112 return dlus * font_ref_->dlu_base_x() / 4; |
| 113 } | 113 } |
| 114 int vertical_dlus_to_pixels(int dlus) { | 114 int vertical_dlus_to_pixels(int dlus) { |
| 115 return dlus * font_ref_->height() / 8; | 115 return dlus * font_ref_->height() / 8; |
| 116 } | 116 } |
| 117 #elif defined(OS_LINUX) | 117 #elif defined(OS_LINUX) |
| 118 // We need a copy constructor to deal with the Skia reference counting. | 118 // We need a copy constructor and assignment operator to deal with |
| 119 // the Skia reference counting. |
| 119 ChromeFont(const ChromeFont& other); | 120 ChromeFont(const ChromeFont& other); |
| 121 ChromeFont& operator=(const ChromeFont& other); |
| 120 // Setup a Skia context to use the current typeface | 122 // Setup a Skia context to use the current typeface |
| 121 void PaintSetup(SkPaint* paint) const; | 123 void PaintSetup(SkPaint* paint) const; |
| 122 #endif | 124 #endif |
| 123 | 125 |
| 124 private: | 126 private: |
| 125 | 127 |
| 126 #if defined(OS_WIN) | 128 #if defined(OS_WIN) |
| 127 // Chrome text drawing bottoms out in the Windows GDI functions that take an | 129 // Chrome text drawing bottoms out in the Windows GDI functions that take an |
| 128 // HFONT (an opaque handle into Windows). To avoid lots of GDI object | 130 // HFONT (an opaque handle into Windows). To avoid lots of GDI object |
| 129 // allocation and destruction, ChromeFont indirectly refers to the HFONT | 131 // allocation and destruction, ChromeFont indirectly refers to the HFONT |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 // Cached metrics, generated at construction | 207 // Cached metrics, generated at construction |
| 206 int height_; | 208 int height_; |
| 207 int ascent_; | 209 int ascent_; |
| 208 int avg_width_; | 210 int avg_width_; |
| 209 #endif | 211 #endif |
| 210 | 212 |
| 211 }; | 213 }; |
| 212 | 214 |
| 213 #endif // CHROME_COMMON_GFX_CHROME_FONT_H_ | 215 #endif // CHROME_COMMON_GFX_CHROME_FONT_H_ |
| 214 | 216 |
| OLD | NEW |