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

Side by Side Diff: ui/gfx/platform_font_mac.h

Issue 681773002: mac: Avoid PlatformFontMac log spam. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: whoops, add namespace to GetFontRenderParams() call Created 6 years, 1 month 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
« no previous file with comments | « no previous file | ui/gfx/platform_font_mac.mm » ('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 #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 "ui/gfx/font_render_params.h"
10 #include "ui/gfx/platform_font.h" 11 #include "ui/gfx/platform_font.h"
11 12
12 namespace gfx { 13 namespace gfx {
13 14
14 class PlatformFontMac : public PlatformFont { 15 class PlatformFontMac : public PlatformFont {
15 public: 16 public:
16 PlatformFontMac(); 17 PlatformFontMac();
17 explicit PlatformFontMac(NativeFont native_font); 18 explicit PlatformFontMac(NativeFont native_font);
18 PlatformFontMac(const std::string& font_name, 19 PlatformFontMac(const std::string& font_name,
19 int font_size); 20 int font_size);
20 21
21 // Overridden from PlatformFont: 22 // Overridden from PlatformFont:
22 Font DeriveFont(int size_delta, int style) const override; 23 Font DeriveFont(int size_delta, int style) const override;
23 int GetHeight() const override; 24 int GetHeight() const override;
24 int GetBaseline() const override; 25 int GetBaseline() const override;
25 int GetCapHeight() const override; 26 int GetCapHeight() const override;
26 int GetExpectedTextWidth(int length) const override; 27 int GetExpectedTextWidth(int length) const override;
27 int GetStyle() const override; 28 int GetStyle() const override;
28 std::string GetFontName() const override; 29 std::string GetFontName() const override;
29 std::string GetActualFontNameForTesting() const override; 30 std::string GetActualFontNameForTesting() const override;
30 int GetFontSize() const override; 31 int GetFontSize() const override;
31 const FontRenderParams& GetFontRenderParams() const override; 32 const FontRenderParams& GetFontRenderParams() const override;
32 NativeFont GetNativeFont() const override; 33 NativeFont GetNativeFont() const override;
33 34
34 private: 35 private:
35 PlatformFontMac(const std::string& font_name, int font_size, int font_style); 36 PlatformFontMac(const std::string& font_name, int font_size, int font_style);
36 ~PlatformFontMac() override; 37 ~PlatformFontMac() override;
37 38
38 // Calculates and caches the font metrics. 39 // Calculates and caches the font metrics and inits |render_params_|.
39 void CalculateMetrics(); 40 void CalculateMetricsAndInitRenderParams();
40 41
41 // The NSFont instance for this object. If this object was constructed from an 42 // The NSFont instance for this object. If this object was constructed from an
42 // NSFont instance, this holds that NSFont instance. Otherwise this NSFont 43 // NSFont instance, this holds that NSFont instance. Otherwise this NSFont
43 // instance is constructed from the name, size, and style, and if there is no 44 // instance is constructed from the name, size, and style, and if there is no
44 // active font that matched those criteria, this object may be nil. 45 // active font that matched those criteria, this object may be nil.
45 base::scoped_nsobject<NSFont> native_font_; 46 base::scoped_nsobject<NSFont> native_font_;
46 47
47 // The name/size/style trio that specify the font. Initialized in the 48 // The name/size/style trio that specify the font. Initialized in the
48 // constructors. 49 // constructors.
49 std::string font_name_; // Corresponds to -[NSFont fontFamily]. 50 std::string font_name_; // Corresponds to -[NSFont fontFamily].
50 int font_size_; 51 int font_size_;
51 int font_style_; 52 int font_style_;
52 53
53 // Cached metrics, generated in CalculateMetrics(). 54 // Cached metrics, generated in CalculateMetrics().
54 int height_; 55 int height_;
55 int ascent_; 56 int ascent_;
56 int cap_height_; 57 int cap_height_;
57 int average_width_; 58 int average_width_;
58 59
60 // Details about how the font should be rendered.
61 FontRenderParams render_params_;
62
59 DISALLOW_COPY_AND_ASSIGN(PlatformFontMac); 63 DISALLOW_COPY_AND_ASSIGN(PlatformFontMac);
60 }; 64 };
61 65
62 } // namespace gfx 66 } // namespace gfx
63 67
64 #endif // UI_GFX_PLATFORM_FONT_MAC_H_ 68 #endif // UI_GFX_PLATFORM_FONT_MAC_H_
OLDNEW
« no previous file with comments | « no previous file | ui/gfx/platform_font_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698