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 #include "ui/gfx/pango_util.h" | 5 #include "ui/gfx/pango_util.h" |
6 | 6 |
7 #include <cairo/cairo.h> | 7 #include <cairo/cairo.h> |
8 #include <fontconfig/fontconfig.h> | 8 #include <fontconfig/fontconfig.h> |
9 #include <pango/pango.h> | 9 #include <pango/pango.h> |
10 #include <pango/pangocairo.h> | 10 #include <pango/pangocairo.h> |
11 | 11 |
12 #include <algorithm> | 12 #include <algorithm> |
13 #include <map> | 13 #include <map> |
14 #include <vector> | 14 #include <vector> |
15 | 15 |
16 #include "base/logging.h" | 16 #include "base/logging.h" |
17 #include "base/utf_string_conversions.h" | 17 #include "base/utf_string_conversions.h" |
18 #include "ui/gfx/canvas.h" | 18 #include "ui/gfx/canvas.h" |
19 #include "ui/gfx/font.h" | 19 #include "ui/gfx/font.h" |
20 #include "ui/gfx/platform_font_pango.h" | 20 #include "ui/gfx/platform_font_pango.h" |
21 #include "ui/gfx/rect.h" | 21 #include "ui/gfx/rect.h" |
22 | 22 |
23 #if !defined(USE_WAYLAND) && defined(TOOLKIT_GTK) | 23 #if defined(TOOLKIT_GTK) |
24 #include <gdk/gdk.h> | 24 #include <gdk/gdk.h> |
25 #include <gtk/gtk.h> | 25 #include <gtk/gtk.h> |
26 #include "ui/gfx/gtk_util.h" | 26 #include "ui/gfx/gtk_util.h" |
27 #endif | 27 #endif |
28 | 28 |
29 #include "ui/gfx/skia_util.h" | 29 #include "ui/gfx/skia_util.h" |
30 | 30 |
31 namespace { | 31 namespace { |
32 | 32 |
33 // Marker for accelerators in the text. | 33 // Marker for accelerators in the text. |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 } | 172 } |
173 | 173 |
174 return pixels_in_point; | 174 return pixels_in_point; |
175 } | 175 } |
176 | 176 |
177 } // namespace | 177 } // namespace |
178 | 178 |
179 namespace gfx { | 179 namespace gfx { |
180 | 180 |
181 PangoContext* GetPangoContext() { | 181 PangoContext* GetPangoContext() { |
182 #if defined(USE_WAYLAND) || defined(USE_AURA) | 182 #if defined(USE_AURA) |
183 PangoFontMap* font_map = pango_cairo_font_map_get_default(); | 183 PangoFontMap* font_map = pango_cairo_font_map_get_default(); |
184 return pango_font_map_create_context(font_map); | 184 return pango_font_map_create_context(font_map); |
185 #else | 185 #else |
186 return gdk_pango_context_get(); | 186 return gdk_pango_context_get(); |
187 #endif | 187 #endif |
188 } | 188 } |
189 | 189 |
190 double GetPangoResolution() { | 190 double GetPangoResolution() { |
191 static double resolution; | 191 static double resolution; |
192 static bool determined_resolution = false; | 192 static bool determined_resolution = false; |
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
480 | 480 |
481 if (i == desc_to_metrics->end()) { | 481 if (i == desc_to_metrics->end()) { |
482 PangoFontMetrics* metrics = pango_context_get_metrics(context, desc, NULL); | 482 PangoFontMetrics* metrics = pango_context_get_metrics(context, desc, NULL); |
483 desc_to_metrics->insert(std::make_pair(desc_hash, metrics)); | 483 desc_to_metrics->insert(std::make_pair(desc_hash, metrics)); |
484 return metrics; | 484 return metrics; |
485 } | 485 } |
486 return i->second; | 486 return i->second; |
487 } | 487 } |
488 | 488 |
489 } // namespace gfx | 489 } // namespace gfx |
OLD | NEW |