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

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

Issue 789583002: Updates subpixel positioning and hinting when DSF is changed (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: linux fix Created 6 years 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 | « ui/gfx/platform_font_mac.mm ('k') | ui/gfx/platform_font_pango.cc » ('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_PANGO_H_ 5 #ifndef UI_GFX_PLATFORM_FONT_PANGO_H_
6 #define UI_GFX_PLATFORM_FONT_PANGO_H_ 6 #define UI_GFX_PLATFORM_FONT_PANGO_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 // Overridden from PlatformFont: 43 // Overridden from PlatformFont:
44 Font DeriveFont(int size_delta, int style) const override; 44 Font DeriveFont(int size_delta, int style) const override;
45 int GetHeight() const override; 45 int GetHeight() const override;
46 int GetBaseline() const override; 46 int GetBaseline() const override;
47 int GetCapHeight() const override; 47 int GetCapHeight() const override;
48 int GetExpectedTextWidth(int length) const override; 48 int GetExpectedTextWidth(int length) const override;
49 int GetStyle() const override; 49 int GetStyle() const override;
50 std::string GetFontName() const override; 50 std::string GetFontName() const override;
51 std::string GetActualFontNameForTesting() const override; 51 std::string GetActualFontNameForTesting() const override;
52 int GetFontSize() const override; 52 int GetFontSize() const override;
53 const FontRenderParams& GetFontRenderParams() const override; 53 const FontRenderParams& GetFontRenderParams() override;
54 NativeFont GetNativeFont() const override; 54 NativeFont GetNativeFont() const override;
55 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 PlatformFontPango(const skia::RefPtr<SkTypeface>& typeface, 59 PlatformFontPango(const skia::RefPtr<SkTypeface>& typeface,
60 const std::string& name, 60 const std::string& name,
61 int size_pixels, 61 int size_pixels,
62 int style, 62 int style,
63 const FontRenderParams& params); 63 const FontRenderParams& params);
(...skipping 23 matching lines...) Expand all
87 // The average width of a character, initialized and cached if needed. 87 // The average width of a character, initialized and cached if needed.
88 double GetAverageWidth() const; 88 double GetAverageWidth() const;
89 89
90 skia::RefPtr<SkTypeface> typeface_; 90 skia::RefPtr<SkTypeface> typeface_;
91 91
92 // Additional information about the face. 92 // Additional information about the face.
93 // Skia actually expects a family name and not a font name. 93 // Skia actually expects a family name and not a font name.
94 std::string font_family_; 94 std::string font_family_;
95 int font_size_pixels_; 95 int font_size_pixels_;
96 int style_; 96 int style_;
97 #if defined(OS_CHROMEOS)
98 float device_scale_factor_;
99 #endif
97 100
98 // Information describing how the font should be rendered. 101 // Information describing how the font should be rendered.
99 FontRenderParams font_render_params_; 102 FontRenderParams font_render_params_;
100 103
101 // Cached metrics, generated at construction. 104 // Cached metrics, generated at construction.
102 int ascent_pixels_; 105 int ascent_pixels_;
103 int height_pixels_; 106 int height_pixels_;
104 int cap_height_pixels_; 107 int cap_height_pixels_;
105 108
106 // The pango metrics are much more expensive so we wait until we need them 109 // The pango metrics are much more expensive so we wait until we need them
107 // to compute them. 110 // to compute them.
108 bool pango_metrics_inited_; 111 bool pango_metrics_inited_;
109 double average_width_pixels_; 112 double average_width_pixels_;
110 113
111 // The default font, used for the default constructor. 114 // The default font, used for the default constructor.
112 static Font* default_font_; 115 static Font* default_font_;
113 116
114 #if defined(OS_CHROMEOS) 117 #if defined(OS_CHROMEOS)
115 // A Pango font description. 118 // A Pango font description.
116 static std::string* default_font_description_; 119 static std::string* default_font_description_;
117 #endif 120 #endif
118 121
119 DISALLOW_COPY_AND_ASSIGN(PlatformFontPango); 122 DISALLOW_COPY_AND_ASSIGN(PlatformFontPango);
120 }; 123 };
121 124
122 } // namespace gfx 125 } // namespace gfx
123 126
124 #endif // UI_GFX_PLATFORM_FONT_PANGO_H_ 127 #endif // UI_GFX_PLATFORM_FONT_PANGO_H_
OLDNEW
« no previous file with comments | « ui/gfx/platform_font_mac.mm ('k') | ui/gfx/platform_font_pango.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698