- resize_in_progress = false;
-
- Glib::RefPtr<Gdk::Window> win = get_window();
- Pango::FontDescription fd (clock.get_style()->get_font());
- int current_size = fd.get_size ();
- int x, y, w, h, d;
-
- if (!fd.get_size_is_absolute ()) {
- current_size /= PANGO_SCALE;
- }
-
- win->get_geometry (x, y, w, h, d);
-
- double scale = min (((double) w / (double) original_width),
- ((double) h / (double) original_height));
-
- int size = (int) lrintf (original_font_size * scale);
-
- if (size != current_size) {
-
- string family = fd.get_family();
- std::vector<char> buf(family.length()+16);
- snprintf (&buf[0], family.length()+16, "%s %d", family.c_str(), size);
-
- try {
- Pango::FontDescription fd (&buf[0]);
- Glib::RefPtr<Gtk::RcStyle> rcstyle = clock.get_modifier_style ();
- rcstyle->set_font (fd);
- clock.modify_style (rcstyle);
- }
-
- catch (...) {
- /* oh well, do nothing */
- }
- }
-
- return false;