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

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

Issue 400193004: Unify desktop Linux and Chrome OS font rendering params. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: make ScopedPangoFontDescription accept a string Created 6 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « ui/gfx/linux_font_delegate.h ('k') | ui/gfx/platform_font_pango.h » ('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_PANGO_UTIL_H_ 5 #ifndef UI_GFX_PANGO_UTIL_H_
6 #define UI_GFX_PANGO_UTIL_H_ 6 #define UI_GFX_PANGO_UTIL_H_
7 7
8 #include <cairo/cairo.h> 8 #include <cairo/cairo.h>
9 #include <pango/pango.h> 9 #include <pango/pango.h>
10 10
11 #include "base/i18n/rtl.h" 11 #include "base/i18n/rtl.h"
12 #include "base/logging.h" 12 #include "base/logging.h"
13 #include "base/strings/string16.h" 13 #include "base/strings/string16.h"
14 #include "third_party/skia/include/core/SkColor.h" 14 #include "third_party/skia/include/core/SkColor.h"
15 #include "ui/gfx/gfx_export.h" 15 #include "ui/gfx/gfx_export.h"
16 16
17 namespace gfx { 17 namespace gfx {
18 18
19 class FontList; 19 class FontList;
20 20
21 // Utility class to ensure that PangoFontDescription is freed. 21 // Utility class to ensure that PangoFontDescription is freed.
22 class ScopedPangoFontDescription { 22 class ScopedPangoFontDescription {
23 public: 23 public:
24 explicit ScopedPangoFontDescription(PangoFontDescription* description) 24 explicit ScopedPangoFontDescription(PangoFontDescription* description)
25 : description_(description) { 25 : description_(description) {
26 DCHECK(description); 26 DCHECK(description);
27 } 27 }
28 28
29 explicit ScopedPangoFontDescription(const std::string& str) {
30 description_ = pango_font_description_from_string(str.c_str());
msw 2014/07/18 20:31:39 nit: can this be done in an initializer list?
Daniel Erat 2014/07/18 20:35:04 yep!
31 }
32
29 ~ScopedPangoFontDescription() { 33 ~ScopedPangoFontDescription() {
30 pango_font_description_free(description_); 34 pango_font_description_free(description_);
31 } 35 }
32 36
33 PangoFontDescription* get() { return description_; } 37 PangoFontDescription* get() { return description_; }
34 38
35 private: 39 private:
36 PangoFontDescription* description_; 40 PangoFontDescription* description_;
37 41
38 DISALLOW_COPY_AND_ASSIGN(ScopedPangoFontDescription); 42 DISALLOW_COPY_AND_ASSIGN(ScopedPangoFontDescription);
(...skipping 16 matching lines...) Expand all
55 int GetPangoFontSizeInPixels(PangoFontDescription* pango_font); 59 int GetPangoFontSizeInPixels(PangoFontDescription* pango_font);
56 60
57 // Retrieves the Pango metrics for a Pango font description. Caches the metrics 61 // Retrieves the Pango metrics for a Pango font description. Caches the metrics
58 // and never frees them. The metrics objects are relatively small and very 62 // and never frees them. The metrics objects are relatively small and very
59 // expensive to look up. 63 // expensive to look up.
60 PangoFontMetrics* GetPangoFontMetrics(PangoFontDescription* desc); 64 PangoFontMetrics* GetPangoFontMetrics(PangoFontDescription* desc);
61 65
62 } // namespace gfx 66 } // namespace gfx
63 67
64 #endif // UI_GFX_PANGO_UTIL_H_ 68 #endif // UI_GFX_PANGO_UTIL_H_
OLDNEW
« no previous file with comments | « ui/gfx/linux_font_delegate.h ('k') | ui/gfx/platform_font_pango.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698