Chromium Code Reviews| 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 : public base::RefCounted<PlatformFont> { |
| 23 public: | 23 public: |
| 24 // The size of the font returned by CreateDefault() on a "default" platform | |
| 25 // configuration. This allows UI that wants to target a particular size of font | |
| 26 // to obtain that size for the majority of users, while still compensating for a | |
| 27 // user preference for a larger or smaller font. | |
| 28 #if defined(OS_MACOSX) | |
| 29 static constexpr int kPopularDefaultFontSize = 13; | |
|
Peter Kasting
2017/04/06 06:17:07
Nit: I have no idea where the word "popular" in th
tapted
2017/04/06 09:11:10
heh, that was to try to distinguish it from "Creat
| |
| 30 #else | |
| 31 static constexpr int kPopularDefaultFontSize = 12; | |
| 32 #endif | |
| 33 | |
| 24 // Creates an appropriate PlatformFont implementation. | 34 // Creates an appropriate PlatformFont implementation. |
| 25 static PlatformFont* CreateDefault(); | 35 static PlatformFont* CreateDefault(); |
| 26 #if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_IOS) | 36 #if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_IOS) |
| 27 static PlatformFont* CreateFromNativeFont(NativeFont native_font); | 37 static PlatformFont* CreateFromNativeFont(NativeFont native_font); |
| 28 #endif | 38 #endif |
| 29 // Creates a PlatformFont implementation with the specified |font_name| | 39 // Creates a PlatformFont implementation with the specified |font_name| |
| 30 // (encoded in UTF-8) and |font_size| in pixels. | 40 // (encoded in UTF-8) and |font_size| in pixels. |
| 31 static PlatformFont* CreateFromNameAndSize(const std::string& font_name, | 41 static PlatformFont* CreateFromNameAndSize(const std::string& font_name, |
| 32 int font_size); | 42 int font_size); |
| 33 | 43 |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 84 protected: | 94 protected: |
| 85 virtual ~PlatformFont() {} | 95 virtual ~PlatformFont() {} |
| 86 | 96 |
| 87 private: | 97 private: |
| 88 friend class base::RefCounted<PlatformFont>; | 98 friend class base::RefCounted<PlatformFont>; |
| 89 }; | 99 }; |
| 90 | 100 |
| 91 } // namespace gfx | 101 } // namespace gfx |
| 92 | 102 |
| 93 #endif // UI_GFX_PLATFORM_FONT_H_ | 103 #endif // UI_GFX_PLATFORM_FONT_H_ |
| OLD | NEW |