Re: Default settings for GtkTextAttributes
- From: Owen Taylor <otaylor redhat com>
- To: gtk-devel-list gnome org
- Cc: Oisin Boydell <Oisin Boydell Sun COM>
- Subject: Re: Default settings for GtkTextAttributes
- Date: 01 Jun 2001 17:22:24 -0400
Oisin Boydell <Oisin Boydell Sun COM> writes:
> I noticed that the function gtk_text_attributes_new() which sets up a new GtkTextAttributes structure sets most
> of the values to 0 by default. This is not correct since setting 0 for the
> GtkTextAttributes->(PangoFontDescription)font->(PangoStretch)stretch corresponds to
> "PANGO_STRETCH_ULTRA_CONDENSED" in the PangoStretch enum. The default value should be 4 which corresponds to
> "PANGO_STRETCH_NORMAL". It is also incorrect to set
> GtkTextAttributes->(PangoFontDescription)font->(PangoWeight)weight to 0 which corresponds to
> "PANGO_WEIGHT_ULTRALIGHT". It should be "PANGO_WEIGHT_NORMAL".
>
> Problems arise when using gtk_text_iter_get_attributes() which fills a GtkTextAttributes struct given as
> parameter. If I use a newly created GtkTextAttributes initialized with gtk_text_attributes_new() then any
> values which are not set by tags in the text remain as the default values... the wrong default values as
> mentioned above such as PANGO_STRETCH_ULTRA_CONDENSED when the text has no stretch attribute associated with
> it. The value should be PANGO_STRETCH_NORMAL.
>
> I will send a patch soon for gtktexttag.c which sets a GtkTextAttributes struct to correct default values when
> initialized with gtk_text_attributes_new().
I'm not sure that PANGO_WEIGHT_NORMAL is really any better of a default
than PANGO_WEIGHT_ULTRALIGHT.
What you really need is a function to get the default attributes for a
particular text view - this is stored as view->layout->default_style,
but there is no public accessor for this.
So, some function like gtk_text_view_get_default_attributes() that
a bit like:
{
gtk_text_view_ensure_layout (text_view);
return gtk_text_attributes_copy (text_view->layout->default_style);
}
Regards,
Owen
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]