/* $Id: fontdescription.hg,v 1.18 2002/11/25 20:14:20 murrayc Exp $ */ /* fontdescription.h * * Copyright (C) 1998-2002 The gtkmm Development Team * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the Free * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include _DEFS(pangomm,pango) namespace Pango { _CC_INCLUDE(pango/pango-enum-types.h) _WRAP_ENUM(Style, PangoStyle) _WRAP_ENUM(Variant, PangoVariant) _WRAP_ENUM(Stretch, PangoStretch) _WRAP_ENUM(Weight, PangoWeight) _WRAP_ENUM(FontMask, PangoFontMask) /** A Pango::FontDescription represents the description of an ideal font. * It is used both to list what fonts are available on the system and also for specifying the characteristics of a font to load. */ class FontDescription { _CLASS_BOXEDTYPE(FontDescription, PangoFontDescription, pango_font_description_new, pango_font_description_copy, pango_font_description_free) _IGNORE(pango_font_description_free, pango_font_description_copy, pango_font_description_copy_static, pango_font_description_equal) /* These functions are dangerous! The first casts the "const" from the parameter away * copying the pointer and keep it hanging around. * So desc.set_family_static("some_family") would lead to a segfault. * The latter makes a shallow copy of the parameter's "family" data member. * So if the FontDescription you passed in dies, a pointer to its (deleted) * family data member still hangs around! * This is why we can't wrap these functions! */ _IGNORE(pango_font_description_set_family_static, pango_font_description_merge_static) public: /** Constructs a font description from a string representation. * @a font_name must have 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 an decimal number (size in points). Any one of the * options may be absent. If FAMILY-LIST is absent, then the family_name field * of the resulting font description will be initialized to 0. 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. * @param font_name String representation of a font description. */ explicit FontDescription(const Glib::ustring& font_name); _WRAP_METHOD(guint hash() const, pango_font_description_hash) _WRAP_METHOD(void set_family(const Glib::ustring& family), pango_font_description_set_family) _WRAP_METHOD(Glib::ustring get_family() const, pango_font_description_get_family) _WRAP_METHOD(void set_style(Style style), pango_font_description_set_style) _WRAP_METHOD(Style get_style() const, pango_font_description_get_style) _WRAP_METHOD(void set_variant(Variant variant),pango_font_description_set_variant) _WRAP_METHOD(Variant get_variant() const, pango_font_description_get_variant) _WRAP_METHOD(void set_weight(Weight weight), pango_font_description_set_weight) _WRAP_METHOD(Weight get_weight() const, pango_font_description_get_weight) _WRAP_METHOD(void set_stretch(Stretch stretch), pango_font_description_set_stretch) _WRAP_METHOD(Stretch get_stretch() const, pango_font_description_get_stretch) _WRAP_METHOD(void set_size(int size), pango_font_description_set_size) _WRAP_METHOD(int get_size() const, pango_font_description_get_size) _WRAP_METHOD(FontMask get_set_fields() const, pango_font_description_get_set_fields) _WRAP_METHOD(void unset_fields(FontMask to_unset), pango_font_description_unset_fields) _WRAP_METHOD(void merge(const FontDescription& desc_to_merge, bool replace_existing), pango_font_description_merge) _WRAP_METHOD(bool better_match(const FontDescription& old_match, const FontDescription& new_match) const, pango_font_description_better_match) _WRAP_METHOD(Glib::ustring to_string() const, pango_font_description_to_string) _WRAP_METHOD(Glib::ustring to_filename() const, pango_font_description_to_filename) #m4begin _WRAP_EQUAL(pango_font_description_equal) #m4end }; } //namespace Pango