diff options
author | tc@google.com <tc@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-18 21:28:49 +0000 |
---|---|---|
committer | tc@google.com <tc@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-18 21:28:49 +0000 |
commit | 13ee61d7b61d186baeb2fec423e7b2b0a17c7e98 (patch) | |
tree | 3b67bf691e186fbdd7bf83f7520c7c8c67346f56 /chrome/common | |
parent | 3c53cfa23d26b9477e3ca46e141c820e9793a5f2 (diff) | |
download | chromium_src-13ee61d7b61d186baeb2fec423e7b2b0a17c7e98.zip chromium_src-13ee61d7b61d186baeb2fec423e7b2b0a17c7e98.tar.gz chromium_src-13ee61d7b61d186baeb2fec423e7b2b0a17c7e98.tar.bz2 |
Force the font size in the omnibox, tabs, find bar, and download shelf
so we don't get layout overflow issues. Ideally, we would have
vector graphics for buttons and stuff so this wouldn't be an issue,
but for now, this will have to do.
BUG=11128
Review URL: http://codereview.chromium.org/113546
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@16327 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common')
-rw-r--r-- | chrome/common/gtk_util.cc | 11 | ||||
-rw-r--r-- | chrome/common/gtk_util.h | 3 |
2 files changed, 14 insertions, 0 deletions
diff --git a/chrome/common/gtk_util.cc b/chrome/common/gtk_util.cc index 280a7ea..c3b0ea9 100644 --- a/chrome/common/gtk_util.cc +++ b/chrome/common/gtk_util.cc @@ -7,6 +7,7 @@ #include <gtk/gtk.h> #include "base/linux_util.h" +#include "base/logging.h" #include "third_party/skia/include/core/SkBitmap.h" namespace { @@ -54,6 +55,16 @@ void RemoveAllChildren(GtkWidget* container) { gtk_container_foreach(GTK_CONTAINER(container), RemoveWidget, container); } +void ForceFontSizePixels(GtkWidget* widget, double size_pixels) { + GtkStyle* style = widget->style; + PangoFontDescription* font_desc = style->font_desc; + // pango_font_description_set_absolute_size sets the font size in device + // units, which for us is pixels. + pango_font_description_set_absolute_size(font_desc, + PANGO_SCALE * size_pixels); + gtk_widget_modify_font(widget, font_desc); +} + gfx::Point GetWidgetScreenPosition(GtkWidget* widget) { int x = 0, y = 0; diff --git a/chrome/common/gtk_util.h b/chrome/common/gtk_util.h index 8a9b3f0..d72045b 100644 --- a/chrome/common/gtk_util.h +++ b/chrome/common/gtk_util.h @@ -32,6 +32,9 @@ GtkWidget* CreateGtkBorderBin(GtkWidget* child, const GdkColor* color, // Remove all children from this container. void RemoveAllChildren(GtkWidget* container); +// Force the font size of the widget to |size_pixels|. +void ForceFontSizePixels(GtkWidget* widget, double size_pixels); + // Gets the position of a gtk widget in screen coordinates. gfx::Point GetWidgetScreenPosition(GtkWidget* widget); |