| OLD | NEW |
| 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 #ifndef UI_GFX_PLATFORM_FONT_MAC_H_ | 5 #ifndef UI_GFX_PLATFORM_FONT_MAC_H_ |
| 6 #define UI_GFX_PLATFORM_FONT_MAC_H_ | 6 #define UI_GFX_PLATFORM_FONT_MAC_H_ |
| 7 | 7 |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/mac/scoped_nsobject.h" | 9 #include "base/mac/scoped_nsobject.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 std::string GetActualFontNameForTesting() const override; | 34 std::string GetActualFontNameForTesting() const override; |
| 35 int GetFontSize() const override; | 35 int GetFontSize() const override; |
| 36 const FontRenderParams& GetFontRenderParams() override; | 36 const FontRenderParams& GetFontRenderParams() override; |
| 37 NativeFont GetNativeFont() const override; | 37 NativeFont GetNativeFont() const override; |
| 38 | 38 |
| 39 private: | 39 private: |
| 40 PlatformFontMac(const std::string& font_name, | 40 PlatformFontMac(const std::string& font_name, |
| 41 int font_size, | 41 int font_size, |
| 42 int font_style, | 42 int font_style, |
| 43 Font::Weight font_weight); | 43 Font::Weight font_weight); |
| 44 |
| 45 PlatformFontMac(NativeFont font, |
| 46 const std::string& font_name, |
| 47 int font_size, |
| 48 int font_style, |
| 49 Font::Weight font_weight); |
| 50 |
| 44 ~PlatformFontMac() override; | 51 ~PlatformFontMac() override; |
| 45 | 52 |
| 46 // Calculates and caches the font metrics and inits |render_params_|. | 53 // Calculates and caches the font metrics and inits |render_params_|. |
| 47 void CalculateMetricsAndInitRenderParams(); | 54 void CalculateMetricsAndInitRenderParams(); |
| 48 | 55 |
| 49 // The NSFont instance for this object. If this object was constructed from an | 56 // The NSFont instance for this object. If this object was constructed from an |
| 50 // NSFont instance, this holds that NSFont instance. Otherwise this NSFont | 57 // NSFont instance, this holds that NSFont instance. Otherwise this NSFont |
| 51 // instance is constructed from the name, size, and style, and if there is no | 58 // instance is constructed from the name, size, and style, and if there is no |
| 52 // active font that matched those criteria, this object may be nil. | 59 // active font that matched those criteria, this object may be nil. |
| 53 base::scoped_nsobject<NSFont> native_font_; | 60 base::scoped_nsobject<NSFont> native_font_; |
| 54 | 61 |
| 55 // The name/size/style trio that specify the font. Initialized in the | 62 // The name/size/style trio that specify the font. Initialized in the |
| 56 // constructors. | 63 // constructors. |
| 57 std::string font_name_; // Corresponds to -[NSFont fontFamily]. | 64 const std::string font_name_; // Corresponds to -[NSFont fontFamily]. |
| 58 int font_size_; | 65 const int font_size_; |
| 59 int font_style_; | 66 const int font_style_; |
| 60 Font::Weight font_weight_; | 67 const Font::Weight font_weight_; |
| 61 | 68 |
| 62 // Cached metrics, generated in CalculateMetrics(). | 69 // Cached metrics, generated in CalculateMetrics(). |
| 63 int height_; | 70 int height_; |
| 64 int ascent_; | 71 int ascent_; |
| 65 int cap_height_; | 72 int cap_height_; |
| 66 int average_width_; | 73 int average_width_; |
| 67 | 74 |
| 68 // Details about how the font should be rendered. | 75 // Details about how the font should be rendered. |
| 69 FontRenderParams render_params_; | 76 FontRenderParams render_params_; |
| 70 | 77 |
| 71 DISALLOW_COPY_AND_ASSIGN(PlatformFontMac); | 78 DISALLOW_COPY_AND_ASSIGN(PlatformFontMac); |
| 72 }; | 79 }; |
| 73 | 80 |
| 74 } // namespace gfx | 81 } // namespace gfx |
| 75 | 82 |
| 76 #endif // UI_GFX_PLATFORM_FONT_MAC_H_ | 83 #endif // UI_GFX_PLATFORM_FONT_MAC_H_ |
| OLD | NEW |