Re: XSetting for font
- From: Owen Taylor <otaylor redhat com>
- To: Erwann Chenede <Erwann Chenede Sun COM>
- Cc: gtk-devel-list gnome org
- Subject: Re: XSetting for font
- Date: Wed, 27 Feb 2002 10:27:50 -0500 (EST)
Erwann Chenede <Erwann Chenede Sun COM> writes:
> Hi Owen,
> 
> [...]
> >> -  
> >> -  style->font_desc = pango_font_description_from_string ("Sans 10");
> >> +  GtkSettings *settings = gtk_settings_get_default ();
> >> +  gchar *font_name;
> >> +
> >> +  g_object_get (settings, "gtk-font-name", &font_name, NULL);
> >> +  style->font_desc = pango_font_description_from_string (font_name);
> >> +  g_free (font_name);
> >>  
> >>    style->attach_count = 0;
> >>    style->colormap = NULL;
> >
> >Using gtk_rc_context_get (gtk_settings_get_default ()) to call
> >_gtk_rc_context_get_default_font_name() should be OK for now.
> >
> >For 2.2 (multihead) we'll have to do something different - I think the
> >correct approach though is to add a ::font_desc GObject property,
> >and then set a default style->font_desc in a constructor() method
> >if it hasn't already been set. (A bug about this would be useful
> >as well.)
> 
> What difference would it make from the actual code as the constructor()
> as no way of figuring out what screen it is on ? 
> The ::font_desc GObject on GtkSetting just would be a duplicate of
>  gtk-font-name.
> 
> Am I missing something ?
The way it would basically work is that in gtkrc.c:gtk_rc_style_to_style ()
After calling:
  style = GTK_RC_STYLE_GET_CLASS (rc_style)->create_style (rc_style);
We'd set the default font. Unfortunately, since it's virtualized in this
way, we'll probably have to pay the price of creating a font description,
destroying it, and replacing it with the real font description.
Regards,
                                        Owen
[
Date Prev][
Date Next]   [
Thread Prev][
Thread Next]   
[
Thread Index]
[
Date Index]
[
Author Index]