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 <math.h> | 7 #include <math.h> |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include <pango/pango.h> | 10 #include <pango/pango.h> |
(...skipping 1371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1382 } | 1382 } |
1383 | 1383 |
1384 void Gtk2UI::ClearAllThemeData() { | 1384 void Gtk2UI::ClearAllThemeData() { |
1385 gtk_images_.clear(); | 1385 gtk_images_.clear(); |
1386 } | 1386 } |
1387 | 1387 |
1388 void Gtk2UI::UpdateDefaultFont(const PangoFontDescription* desc) { | 1388 void Gtk2UI::UpdateDefaultFont(const PangoFontDescription* desc) { |
1389 // Use gfx::FontRenderParams to select a family and determine the rendering | 1389 // Use gfx::FontRenderParams to select a family and determine the rendering |
1390 // settings. | 1390 // settings. |
1391 gfx::FontRenderParamsQuery query; | 1391 gfx::FontRenderParamsQuery query; |
1392 base::SplitString(pango_font_description_get_family(desc), ',', | 1392 query.families = base::SplitString(pango_font_description_get_family(desc), |
1393 &query.families); | 1393 ",", base::TRIM_WHITESPACE, |
| 1394 base::SPLIT_WANT_ALL); |
1394 | 1395 |
1395 if (pango_font_description_get_size_is_absolute(desc)) { | 1396 if (pango_font_description_get_size_is_absolute(desc)) { |
1396 // If the size is absolute, it's specified in Pango units. There are | 1397 // If the size is absolute, it's specified in Pango units. There are |
1397 // PANGO_SCALE Pango units in a device unit (pixel). | 1398 // PANGO_SCALE Pango units in a device unit (pixel). |
1398 const int size_pixels = pango_font_description_get_size(desc) / PANGO_SCALE; | 1399 const int size_pixels = pango_font_description_get_size(desc) / PANGO_SCALE; |
1399 default_font_size_pixels_ = size_pixels; | 1400 default_font_size_pixels_ = size_pixels; |
1400 query.pixel_size = size_pixels; | 1401 query.pixel_size = size_pixels; |
1401 } else { | 1402 } else { |
1402 // Non-absolute sizes are in points (again scaled by PANGO_SIZE). | 1403 // Non-absolute sizes are in points (again scaled by PANGO_SIZE). |
1403 // Round the value when converting to pixels to match GTK's logic. | 1404 // Round the value when converting to pixels to match GTK's logic. |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1437 float scale = GetFontDPI() / GetBaseDPI(); | 1438 float scale = GetFontDPI() / GetBaseDPI(); |
1438 // Round to 1 decimal, e.g. to 1.4. | 1439 // Round to 1 decimal, e.g. to 1.4. |
1439 return roundf(scale * 10) / 10; | 1440 return roundf(scale * 10) / 10; |
1440 } | 1441 } |
1441 | 1442 |
1442 } // namespace libgtk2ui | 1443 } // namespace libgtk2ui |
1443 | 1444 |
1444 views::LinuxUI* BuildGtk2UI() { | 1445 views::LinuxUI* BuildGtk2UI() { |
1445 return new libgtk2ui::Gtk2UI; | 1446 return new libgtk2ui::Gtk2UI; |
1446 } | 1447 } |
OLD | NEW |