Re: Gnomish Thoughts



Havoc Pennington <rhpennin@midway.uchicago.edu> writes:

> If someone wants to fix this, it's quite easy. The steps are something
> like:
> 
> 1) call gtk_widget_set_name() on widgets that use fonts
> 2) if GTop uses fonts for custom drawing (looks like it does),
>    use widget->style->font instead of a hardcoded font. Text 
>    drawn by a widget will already be using this. If you really 
>    want to be cool, you could use gtk_paint_string and theme
>    the strings you draw
> 3) if the Gtk defaults are bad, write a gtoprc that sets the 
>    fonts you want for the widget names you set, and goes in $(datadir).
>    gnome_init parses this automatically (it assumes that gtop and 
>    gnome-libs are installed in the same place tho).

Another hack for multiple fonts in a widget:

  GtkStyle *style;
  
  style = gtk_style_ref (widget->style);
  gtk_widget_set_name (widget, "Name1");
  a_font = gdk_font_ref (widget->style->font);
  
  gtk_widget_set_name (widget, "Name2");
  another_font = gdk_font_ref (widget->style->font);
  
  gtk_widget_set_style (widget, style);
  gtk_style_unref (style);

And you can use gdk_draw_string with a_font and another_font.

I used this hack to fix gnome-about.  Though it looks unusual, IMHO
this hack is the best solution with gtkrc's limited power.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]