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_LINUX_H_ | 5 #ifndef UI_GFX_PLATFORM_FONT_LINUX_H_ |
6 #define UI_GFX_PLATFORM_FONT_LINUX_H_ | 6 #define UI_GFX_PLATFORM_FONT_LINUX_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
12 #include "base/macros.h" | 12 #include "base/macros.h" |
13 #include "build/build_config.h" | 13 #include "build/build_config.h" |
14 #include "third_party/skia/include/core/SkRefCnt.h" | 14 #include "third_party/skia/include/core/SkTypeface.h" |
15 #include "ui/gfx/font_render_params.h" | 15 #include "ui/gfx/font_render_params.h" |
16 #include "ui/gfx/platform_font.h" | 16 #include "ui/gfx/platform_font.h" |
17 | 17 |
18 class SkTypeface; | |
19 | |
20 namespace gfx { | 18 namespace gfx { |
21 | 19 |
22 class GFX_EXPORT PlatformFontLinux : public PlatformFont { | 20 class GFX_EXPORT PlatformFontLinux : public PlatformFont { |
23 public: | 21 public: |
24 // TODO(derat): Get rid of the default constructor in favor of using | 22 // TODO(derat): Get rid of the default constructor in favor of using |
25 // FontList (which also has the concept of a default font but may contain | 23 // FontList (which also has the concept of a default font but may contain |
26 // multiple font families) everywhere. See http://crbug.com/398885#c16. | 24 // multiple font families) everywhere. See http://crbug.com/398885#c16. |
27 PlatformFontLinux(); | 25 PlatformFontLinux(); |
28 PlatformFontLinux(const std::string& font_name, int font_size_pixels); | 26 PlatformFontLinux(const std::string& font_name, int font_size_pixels); |
29 | 27 |
(...skipping 16 matching lines...) Expand all Loading... |
46 Font::Weight GetWeight() const override; | 44 Font::Weight GetWeight() const override; |
47 int GetBaseline() override; | 45 int GetBaseline() override; |
48 int GetCapHeight() override; | 46 int GetCapHeight() override; |
49 int GetExpectedTextWidth(int length) override; | 47 int GetExpectedTextWidth(int length) override; |
50 int GetStyle() const override; | 48 int GetStyle() const override; |
51 const std::string& GetFontName() const override; | 49 const std::string& GetFontName() const override; |
52 std::string GetActualFontNameForTesting() const override; | 50 std::string GetActualFontNameForTesting() const override; |
53 int GetFontSize() const override; | 51 int GetFontSize() const override; |
54 const FontRenderParams& GetFontRenderParams() override; | 52 const FontRenderParams& GetFontRenderParams() override; |
55 | 53 |
| 54 sk_sp<SkTypeface> typeface() const { return typeface_; } |
| 55 |
56 private: | 56 private: |
57 // Create a new instance of this object with the specified properties. Called | 57 // Create a new instance of this object with the specified properties. Called |
58 // from DeriveFont. | 58 // from DeriveFont. |
59 PlatformFontLinux(sk_sp<SkTypeface> typeface, | 59 PlatformFontLinux(sk_sp<SkTypeface> typeface, |
60 const std::string& family, | 60 const std::string& family, |
61 int size_pixels, | 61 int size_pixels, |
62 int style, | 62 int style, |
63 Font::Weight weight, | 63 Font::Weight weight, |
64 const FontRenderParams& params); | 64 const FontRenderParams& params); |
65 ~PlatformFontLinux() override; | 65 ~PlatformFontLinux() override; |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 // A font description string of the format used by FontList. | 104 // A font description string of the format used by FontList. |
105 static std::string* default_font_description_; | 105 static std::string* default_font_description_; |
106 #endif | 106 #endif |
107 | 107 |
108 DISALLOW_COPY_AND_ASSIGN(PlatformFontLinux); | 108 DISALLOW_COPY_AND_ASSIGN(PlatformFontLinux); |
109 }; | 109 }; |
110 | 110 |
111 } // namespace gfx | 111 } // namespace gfx |
112 | 112 |
113 #endif // UI_GFX_PLATFORM_FONT_LINUX_H_ | 113 #endif // UI_GFX_PLATFORM_FONT_LINUX_H_ |
OLD | NEW |