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

Side by Side Diff: app/gfx/font.h

Issue 1095004: Clamp the max size of fonts used by skia/chrome canvas. (Closed)
Patch Set: Created 10 years, 9 months 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 | app/gfx/font_gtk.cc » ('j') | app/gfx/font_gtk.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 APP_GFX_FONT_H_ 5 #ifndef APP_GFX_FONT_H_
6 #define APP_GFX_FONT_H_ 6 #define APP_GFX_FONT_H_
7 7
8 #include "build/build_config.h" 8 #include "build/build_config.h"
9 9
10 #include <string> 10 #include <string>
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 explicit Font(SkTypeface* typeface, const std::wstring& name, 212 explicit Font(SkTypeface* typeface, const std::wstring& name,
213 int size, int style); 213 int size, int style);
214 // Calculate and cache the font metrics. 214 // Calculate and cache the font metrics.
215 void calculateMetrics(); 215 void calculateMetrics();
216 // Make |this| a copy of |other|. 216 // Make |this| a copy of |other|.
217 void CopyFont(const Font& other); 217 void CopyFont(const Font& other);
218 218
219 // The default font, used for the default constructor. 219 // The default font, used for the default constructor.
220 static Font* default_font_; 220 static Font* default_font_;
221 221
222 // Return the scale factor for fonts that account for DPI. We clamp the
223 // max DPI to prevent large fonts from overflowing UI elements.
224 static float GetPangoScaleFactor();
225
222 // The average width of a character, initialized and cached if needed. 226 // The average width of a character, initialized and cached if needed.
223 double avg_width() const; 227 double avg_width() const;
224 228
225 // Potentially slow call to get pango metrics (avg width, underline info). 229 // Potentially slow call to get pango metrics (avg width, underline info).
226 void InitPangoMetrics(); 230 void InitPangoMetrics();
227 231
228 // These two both point to the same SkTypeface. We use the SkAutoUnref to 232 // These two both point to the same SkTypeface. We use the SkAutoUnref to
229 // handle the reference counting, but without @typeface_ we would have to 233 // handle the reference counting, but without @typeface_ we would have to
230 // cast the SkRefCnt from @typeface_helper_ every time. 234 // cast the SkRefCnt from @typeface_helper_ every time.
231 scoped_ptr<SkAutoUnref> typeface_helper_; 235 scoped_ptr<SkAutoUnref> typeface_helper_;
(...skipping 29 matching lines...) Expand all
261 int height_; 265 int height_;
262 int ascent_; 266 int ascent_;
263 int avg_width_; 267 int avg_width_;
264 #endif 268 #endif
265 269
266 }; 270 };
267 271
268 } // namespace gfx 272 } // namespace gfx
269 273
270 #endif // APP_GFX_FONT_H_ 274 #endif // APP_GFX_FONT_H_
OLDNEW
« no previous file with comments | « no previous file | app/gfx/font_gtk.cc » ('j') | app/gfx/font_gtk.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698