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> |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 kAcceleratorChar, NULL); | 219 kAcceleratorChar, NULL); |
220 g_free(escaped_text); | 220 g_free(escaped_text); |
221 } else { | 221 } else { |
222 std::string utf8; | 222 std::string utf8; |
223 | 223 |
224 // Remove the ampersand character. A double ampersand is output as | 224 // Remove the ampersand character. A double ampersand is output as |
225 // a single ampersand. | 225 // a single ampersand. |
226 if (flags & Canvas::HIDE_PREFIX) { | 226 if (flags & Canvas::HIDE_PREFIX) { |
227 DCHECK_EQ(1, g_unichar_to_utf8(kAcceleratorChar, NULL)); | 227 DCHECK_EQ(1, g_unichar_to_utf8(kAcceleratorChar, NULL)); |
228 base::string16 accelerator_removed = | 228 base::string16 accelerator_removed = |
229 RemoveAcceleratorChar(text, static_cast<char16>(kAcceleratorChar), | 229 RemoveAcceleratorChar(text, |
| 230 static_cast<base::char16>(kAcceleratorChar), |
230 NULL, NULL); | 231 NULL, NULL); |
231 utf8 = UTF16ToUTF8(accelerator_removed); | 232 utf8 = UTF16ToUTF8(accelerator_removed); |
232 } else { | 233 } else { |
233 utf8 = UTF16ToUTF8(text); | 234 utf8 = UTF16ToUTF8(text); |
234 } | 235 } |
235 | 236 |
236 pango_layout_set_text(layout, utf8.data(), utf8.size()); | 237 pango_layout_set_text(layout, utf8.data(), utf8.size()); |
237 } | 238 } |
238 } | 239 } |
239 | 240 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
294 | 295 |
295 if (i == desc_to_metrics->end()) { | 296 if (i == desc_to_metrics->end()) { |
296 PangoFontMetrics* metrics = pango_context_get_metrics(context, desc, NULL); | 297 PangoFontMetrics* metrics = pango_context_get_metrics(context, desc, NULL); |
297 desc_to_metrics->insert(std::make_pair(desc_hash, metrics)); | 298 desc_to_metrics->insert(std::make_pair(desc_hash, metrics)); |
298 return metrics; | 299 return metrics; |
299 } | 300 } |
300 return i->second; | 301 return i->second; |
301 } | 302 } |
302 | 303 |
303 } // namespace gfx | 304 } // namespace gfx |
OLD | NEW |