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

Unified Diff: chrome/browser/ui/libgtk2ui/gtk2_ui.cc

Issue 406493002: linux: Get font DPI from GTK. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: inline initialization of a static variable 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/libgtk2ui/gtk2_ui.h ('k') | ui/gfx/linux_font_delegate.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/libgtk2ui/gtk2_ui.cc
diff --git a/chrome/browser/ui/libgtk2ui/gtk2_ui.cc b/chrome/browser/ui/libgtk2ui/gtk2_ui.cc
index 035c9aaeaa08c2efea0c6abc6fc6430dcb7161cd..dc44417c7072ebe40b3bf8b74e8b8983d240ccba 100644
--- a/chrome/browser/ui/libgtk2ui/gtk2_ui.cc
+++ b/chrome/browser/ui/libgtk2ui/gtk2_ui.cc
@@ -659,6 +659,16 @@ std::string Gtk2UI::GetDefaultFontDescription() const {
return default_font_description_;
}
+double Gtk2UI::GetFontDPI() const {
+ GtkSettings* gtk_settings = gtk_settings_get_default();
+ CHECK(gtk_settings);
+ gint dpi = -1;
+ g_object_get(gtk_settings, "gtk-xft-dpi", &dpi, NULL);
+
+ // GTK multiplies the DPI by 1024 before storing it.
+ return (dpi > 0) ? dpi / 1024.0 : dpi;
+}
+
ui::SelectFileDialog* Gtk2UI::CreateSelectFileDialog(
ui::SelectFileDialog::Listener* listener,
ui::SelectFilePolicy* policy) const {
« no previous file with comments | « chrome/browser/ui/libgtk2ui/gtk2_ui.h ('k') | ui/gfx/linux_font_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698