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 "chrome/browser/ui/libgtk2ui/gtk2_ui.h" | 5 #include "chrome/browser/ui/libgtk2ui/gtk2_ui.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 | 8 |
9 #include <pango/pango.h> | 9 #include <pango/pango.h> |
10 | 10 |
(...skipping 1357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1368 return border; | 1368 return border; |
1369 } | 1369 } |
1370 | 1370 |
1371 void Gtk2UI::ClearAllThemeData() { | 1371 void Gtk2UI::ClearAllThemeData() { |
1372 gtk_images_.clear(); | 1372 gtk_images_.clear(); |
1373 } | 1373 } |
1374 | 1374 |
1375 void Gtk2UI::UpdateDefaultFont(const PangoFontDescription* desc) { | 1375 void Gtk2UI::UpdateDefaultFont(const PangoFontDescription* desc) { |
1376 // Use gfx::FontRenderParams to select a family and determine the rendering | 1376 // Use gfx::FontRenderParams to select a family and determine the rendering |
1377 // settings. | 1377 // settings. |
1378 gfx::FontRenderParamsQuery query(false /* for_web_contents */); | 1378 gfx::FontRenderParamsQuery query; |
1379 base::SplitString(pango_font_description_get_family(desc), ',', | 1379 base::SplitString(pango_font_description_get_family(desc), ',', |
1380 &query.families); | 1380 &query.families); |
1381 | 1381 |
1382 if (pango_font_description_get_size_is_absolute(desc)) { | 1382 if (pango_font_description_get_size_is_absolute(desc)) { |
1383 // If the size is absolute, it's specified in Pango units. There are | 1383 // If the size is absolute, it's specified in Pango units. There are |
1384 // PANGO_SCALE Pango units in a device unit (pixel). | 1384 // PANGO_SCALE Pango units in a device unit (pixel). |
1385 const int size_pixels = pango_font_description_get_size(desc) / PANGO_SCALE; | 1385 const int size_pixels = pango_font_description_get_size(desc) / PANGO_SCALE; |
1386 default_font_size_pixels_ = size_pixels; | 1386 default_font_size_pixels_ = size_pixels; |
1387 query.pixel_size = size_pixels; | 1387 query.pixel_size = size_pixels; |
1388 } else { | 1388 } else { |
(...skipping 29 matching lines...) Expand all Loading... |
1418 device_scale_factor_ = device_scale_factor; | 1418 device_scale_factor_ = device_scale_factor; |
1419 GtkStyle* label_style = gtk_rc_get_style(fake_label_.get()); | 1419 GtkStyle* label_style = gtk_rc_get_style(fake_label_.get()); |
1420 UpdateDefaultFont(label_style->font_desc); | 1420 UpdateDefaultFont(label_style->font_desc); |
1421 } | 1421 } |
1422 | 1422 |
1423 } // namespace libgtk2ui | 1423 } // namespace libgtk2ui |
1424 | 1424 |
1425 views::LinuxUI* BuildGtk2UI() { | 1425 views::LinuxUI* BuildGtk2UI() { |
1426 return new libgtk2ui::Gtk2UI; | 1426 return new libgtk2ui::Gtk2UI; |
1427 } | 1427 } |
OLD | NEW |