1a05542005-07-28Martin Nilsson class Pango.FontDescription; //! Pango Font Description. void create(?string desc) //! Create a new font description. If desc is present, creates a new font //! description from a string representation in the form //! "[FAMILY-LIST] [STYLE-OPTIONS] [SIZE]", where FAMILY-LIST is a comma //! separated list of families optionally terminated by a comma, STYLE-OPTIONS //! is a whitespace separated list of words where each word describes one of //! style, variant, weight, or stretch, and size is a decimal number (size in //! points). Any one of the options may be absent. If FAMILY-LIST is absent, //! then the family name will be blank. If STYLE-OPTIONS is missing, then all //! style options will be set to the default values. If SIZE is missing, the //! size in the resulting font description will be set to 0. { pgtk_verify_not_inited(); pgtk_verify_setup(); if (args) { char *str; get_all_args("create",args,"%s",&str); if (str) THIS->obj=(void *)pango_font_description_from_string(str); else THIS->obj=(void *)pango_font_description_new();
3d76632005-11-03Lance Dillon  my_pop_n_elems(args);
1a05542005-07-28Martin Nilsson  } else THIS->obj=(void *)pango_font_description_new(); pgtk__init_this_object(); } Pango.FontDescription copy() //! Copy a font description. { pgtk_verify_inited(); { PangoFontDescription *pfd=pango_font_description_copy( (PangoFontDescription *)THIS->obj); my_pop_n_elems(args); push_gobjectclass(pfd,ppango_font_description_program); } } int equal(Pango.FontDescription desc) //! Compares two font descriptions for equality. { pgtk_verify_inited(); { struct object *o1;
3d76632005-11-03Lance Dillon  int res;
1a05542005-07-28Martin Nilsson  get_all_args("equal",args,"%o",&o1);
3d76632005-11-03Lance Dillon  res=pango_font_description_equal((PangoFontDescription *)THIS->obj, (PangoFontDescription *)get_gobject(o1));
1a05542005-07-28Martin Nilsson  my_pop_n_elems(args);
3d76632005-11-03Lance Dillon  PGTK_PUSH_INT(res);
1a05542005-07-28Martin Nilsson  } } void destroy() //! Destructor. { if (THIS->obj) pango_font_description_free((PangoFontDescription *)THIS->obj); THIS->obj=0;
3d76632005-11-03Lance Dillon  my_pop_n_elems(args);
1a05542005-07-28Martin Nilsson  push_int(0); } void set_family(string family) //! Sets the family name. The family name represents a family of related //! fonts styles, and will resolve to a particular PangoFontFamily. { pgtk_verify_inited(); { char *str; get_all_args("set_family",args,"%s",&str); pango_font_description_set_family((PangoFontDescription *)THIS->obj, str); } RETURN_THIS(); } string get_family() //! Gets the family name. { pgtk_verify_inited(); my_pop_n_elems(args); PGTK_PUSH_GCHAR( pango_font_description_get_family((PangoFontDescription *)THIS->obj)); } void set_style(int style) //! Sets the style. This describes whether the font is slanted and the manner //! in which is is slanted. One of CONST(PANGO_STYLE_). Most fonts will //! either have an italic style or an oblique style, but not both, and font //! matching in Pango will match italic specifications with oblique fonts and //! vice-versa if an exact match is not found. { pgtk_verify_inited(); { int style; get_all_args("set_style",args,"%i",&style); pango_font_description_set_style((PangoFontDescription *)THIS->obj,style); } RETURN_THIS(); } int get_style() //! Gets the style. { pgtk_verify_inited(); my_pop_n_elems(args); push_int(pango_font_description_get_style((PangoFontDescription *)THIS->obj)); } void set_variant(int variant) //! Sets the variant. One of CONST(PANGO_VARIANT_). { pgtk_verify_inited(); { int var; get_all_args("set_variant",args,"%i",&var); pango_font_description_set_variant((PangoFontDescription *)THIS->obj,var); } RETURN_THIS(); } int get_variant() //! Gets the variant. { pgtk_verify_inited(); my_pop_n_elems(args); push_int(pango_font_description_get_variant( (PangoFontDescription *)THIS->obj)); } void set_weight(int weight) //! Sets the weight. The weight specifies how bold or light the font should //! be. In addition to the values of CONST(PANGO_WEIGHT_), other intermediate //! numeric values are possible. { pgtk_verify_inited(); { int we; get_all_args("set_weight",args,"%i",&we); pango_font_description_set_weight((PangoFontDescription *)THIS->obj,we); } RETURN_THIS(); } int get_weight() //! Gets the weight. { pgtk_verify_inited(); my_pop_n_elems(args); push_int(pango_font_description_get_weight( (PangoFontDescription *)THIS->obj)); } void set_stretch(int stretch) //! Sets the stretch. This specifies how narrow or wide the font should be. //! One of CONST(PANGO_STRETCH_). { pgtk_verify_inited(); { int st; get_all_args("set_stretch",args,"%i",&st); pango_font_description_set_stretch((PangoFontDescription *)THIS->obj,st); } RETURN_THIS(); } int get_stretch() //! Get the stretch. { pgtk_verify_inited(); my_pop_n_elems(args); push_int(pango_font_description_get_stretch( (PangoFontDescription *)THIS->obj)); } void set_size(int size) //! Sets the size in fractional points. This is the size of the font in //! points, scaled by PANGO_SCALE. (That is, a size value of 10*PANGO_SCALE) //! is a 10 point font. The conversion factor between points and device units //! depends on system configuration and the output device. For screen display, //! a logical DPI of 96 is common, in which case a 10 point font corresponds //! to a 1o*(96.72) = 13.3 pixel font. Use set_absolute_size() if you need //! a particular size in device units. { pgtk_verify_inited(); { int size; get_all_args("set_size",args,"%i",&size); pango_font_description_set_size((PangoFontDescription *)THIS->obj,size); } RETURN_THIS(); } int get_size() //! Gets the size. { pgtk_verify_inited(); my_pop_n_elems(args); push_int(pango_font_description_get_size( (PangoFontDescription *)THIS->obj)); } /* void set_absolute_size(float size) //! Sets the size in pango units. There are GTK2.PANGO_SCALE pango units in //! one device unit. For an output backend where a device unit is a pixel, //! a size value of 10*GTK2.PANGO_SCALE gives a 10 pixel font. { pgtk_verify_inited(); { double size; get_all_args("set_absolute_size",args,"%i",&size); pango_font_description_set_absolute_size((PangoFontDescription *)THIS->obj, size); } RETURN_THIS(); } int get_size_is_absolute() //! Determines whether the size of the font is in points or device units. { pgtk_verify_inited(); my_pop_n_elems(args); push_int(pango_font_description_get_size_is_absolute( (PangoFontDescription *)THIS->obj)); } */ void merge(Pango.FontDescription desc, int replace) //! Merges the fields that are set int desc to the fields in this description. //! If replace is false, only fields in this description that are not already //! set are affected. If true, then fields that are already set will be //! replaced as well. { pgtk_verify_inited(); { int rep; struct object *o1; get_all_args("merge",args,"%o%i",&o1,&rep); pango_font_description_merge((PangoFontDescription *)THIS->obj, (PangoFontDescription *)get_gobject(o1),rep); } RETURN_THIS(); } int better_match(Pango.FontDescription new, ?Pango.FontDescription old) //! Determines if the style attributes of new are a closer match than old, or //! if old is omitted, determines if new is a match at all. Approximate //! matching is done for weight and style; other attributes must match exactly. { pgtk_verify_inited(); { struct object *o1,*o2=NULL; int res;
3d76632005-11-03Lance Dillon  get_all_args("better_match",args,"%o.%o",&o1,&o2);
1a05542005-07-28Martin Nilsson  res=pango_font_description_better_match((PangoFontDescription *)THIS->obj, (PangoFontDescription *)get_gobject(o2), (PangoFontDescription *)get_gobject(o1));
3d76632005-11-03Lance Dillon  my_pop_n_elems(args);
1a05542005-07-28Martin Nilsson  push_int(res); } } string to_string() //! Creates a string representation. The family list in the string description //! will only have a terminating comm if the last word of the list is a valid //! style option. { pgtk_verify_inited(); my_pop_n_elems(args); { char *str=pango_font_description_to_string( (PangoFontDescription *)THIS->obj); PGTK_PUSH_GCHAR(str); } } string to_filename() //! Creates a filename representation. The filename is identical to the //! result from calling to_string(), but with underscores instead of characters //! that are untypical in filenames, and in lower case only. { pgtk_verify_inited(); my_pop_n_elems(args); { char *str=pango_font_description_to_filename( (PangoFontDescription *)THIS->obj); PGTK_PUSH_GCHAR(str); } }