| 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_H_ | 5 #ifndef UI_GFX_PLATFORM_FONT_H_ |
| 6 #define UI_GFX_PLATFORM_FONT_H_ | 6 #define UI_GFX_PLATFORM_FONT_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| 11 #include "base/strings/string16.h" | 11 #include "base/strings/string16.h" |
| 12 #include "build/build_config.h" | 12 #include "build/build_config.h" |
| 13 #include "ui/gfx/font.h" | 13 #include "ui/gfx/font.h" |
| 14 #include "ui/gfx/gfx_export.h" | 14 #include "ui/gfx/gfx_export.h" |
| 15 #include "ui/gfx/native_widget_types.h" | 15 #include "ui/gfx/native_widget_types.h" |
| 16 | 16 |
| 17 namespace gfx { | 17 namespace gfx { |
| 18 | 18 |
| 19 class Font; | 19 class Font; |
| 20 struct FontRenderParams; | 20 struct FontRenderParams; |
| 21 | 21 |
| 22 class GFX_EXPORT PlatformFont : public base::RefCounted<PlatformFont> { | 22 class GFX_EXPORT PlatformFont |
| 23 : public base::RefCountedThreadSafe<PlatformFont> { |
| 23 public: | 24 public: |
| 24 // Creates an appropriate PlatformFont implementation. | 25 // Creates an appropriate PlatformFont implementation. |
| 25 static PlatformFont* CreateDefault(); | 26 static PlatformFont* CreateDefault(); |
| 26 #if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_IOS) | 27 #if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_IOS) |
| 27 static PlatformFont* CreateFromNativeFont(NativeFont native_font); | 28 static PlatformFont* CreateFromNativeFont(NativeFont native_font); |
| 28 #endif | 29 #endif |
| 29 // Creates a PlatformFont implementation with the specified |font_name| | 30 // Creates a PlatformFont implementation with the specified |font_name| |
| 30 // (encoded in UTF-8) and |font_size| in pixels. | 31 // (encoded in UTF-8) and |font_size| in pixels. |
| 31 static PlatformFont* CreateFromNameAndSize(const std::string& font_name, | 32 static PlatformFont* CreateFromNameAndSize(const std::string& font_name, |
| 32 int font_size); | 33 int font_size); |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 | 79 |
| 79 #if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_IOS) | 80 #if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_IOS) |
| 80 // Returns the native font handle. | 81 // Returns the native font handle. |
| 81 virtual NativeFont GetNativeFont() const = 0; | 82 virtual NativeFont GetNativeFont() const = 0; |
| 82 #endif | 83 #endif |
| 83 | 84 |
| 84 protected: | 85 protected: |
| 85 virtual ~PlatformFont() {} | 86 virtual ~PlatformFont() {} |
| 86 | 87 |
| 87 private: | 88 private: |
| 88 friend class base::RefCounted<PlatformFont>; | 89 friend class base::RefCountedThreadSafe<PlatformFont>; |
| 89 }; | 90 }; |
| 90 | 91 |
| 91 } // namespace gfx | 92 } // namespace gfx |
| 92 | 93 |
| 93 #endif // UI_GFX_PLATFORM_FONT_H_ | 94 #endif // UI_GFX_PLATFORM_FONT_H_ |
| OLD | NEW |