RE: Fonts



I'm begginer in gtk, but now I know how  to do it. Below is function i wrote
to change fonts of elements. element is name of element (for example
button1), fontname is fontame in format -misc-*-8...*-iso8859-2, mw is
widget to window where is element (for example main window). It works to me.
I know it's lame, but I don't know another method

void ustaw_czcionke(char* element,char *fontname, GtkWidget *mw)
{
  GtkWidget *text;
  GtkStyle *style;
  GdkFont *font1;

  font1=gdk_font_load(fontname); //translate font to GdkFont*
  text = lookup_widget (mw, element);
  /* If no font is selected, or the font couldn't be loaded, just return. */
  if (!font1)
   {
    fprintf(stderr,"Bad font!!!!!\n");
    return;
   }
  /* We copy the current style, and update the font. */
  style = gtk_style_copy (text->style);
  gdk_font_unref (style->font);
  style->font = font1;
  gdk_font_ref (font1);
  gtk_widget_set_style (text, style);
}

> -----Original Message-----
> From: gtk-list-admin gnome org
> [mailto:gtk-list-admin gnome org]On Behalf Of Sridhar Chigurupati
> Sent: Wednesday, July 10, 2002 12:53 PM
> To: gtk-list gnome org
> Subject: Fonts
>
>
> Hello,
>
> Can anybody please tell me the method for changing fonts and
> font size in GTK-1.2.
>
> Thanks in advance
> Sridhar
>
>
> -----------------------R-E-K-L-A-M-A-------------------------------
> Kolejna wiadomosc czeka na Ciebie pod adresem:
> http://www.bizz.pl/list_w_butelce_new/dostarczenie.php?id=1000
>




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