2 // Generated by gtkmmproc -- DO NOT MODIFY!
3 #ifndef _PANGOMM_FONTDESCRIPTION_H
4 #define _PANGOMM_FONTDESCRIPTION_H
12 * Copyright (C) 1998-2002 The gtkmm Development Team
14 * This library is free software; you can redistribute it and/or
15 * modify it under the terms of the GNU Library General Public
16 * License as published by the Free Software Foundation; either
17 * version 2 of the License, or (at your option) any later version.
19 * This library is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22 * Library General Public License for more details.
24 * You should have received a copy of the GNU Library General Public
25 * License along with this library; if not, write to the Free
26 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
29 #include <pango/pango-font.h>
32 #ifndef DOXYGEN_SHOULD_SKIP_THIS
33 extern "C" { typedef struct _PangoFontDescription PangoFontDescription; }
40 /** @addtogroup pangommEnums Enums and Flags */
43 * @ingroup pangommEnums
55 #ifndef DOXYGEN_SHOULD_SKIP_THIS
60 class Value<Pango::Style> : public Glib::Value_Enum<Pango::Style>
63 static GType value_type() G_GNUC_CONST;
67 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
74 * @ingroup pangommEnums
85 #ifndef DOXYGEN_SHOULD_SKIP_THIS
90 class Value<Pango::Variant> : public Glib::Value_Enum<Pango::Variant>
93 static GType value_type() G_GNUC_CONST;
97 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
104 * @ingroup pangommEnums
108 STRETCH_ULTRA_CONDENSED,
109 STRETCH_EXTRA_CONDENSED,
111 STRETCH_SEMI_CONDENSED,
113 STRETCH_SEMI_EXPANDED,
115 STRETCH_EXTRA_EXPANDED,
116 STRETCH_ULTRA_EXPANDED
122 #ifndef DOXYGEN_SHOULD_SKIP_THIS
127 class Value<Pango::Stretch> : public Glib::Value_Enum<Pango::Stretch>
130 static GType value_type() G_GNUC_CONST;
134 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
141 * @ingroup pangommEnums
145 WEIGHT_ULTRALIGHT = 200,
149 WEIGHT_ULTRABOLD = 800,
156 #ifndef DOXYGEN_SHOULD_SKIP_THIS
161 class Value<Pango::Weight> : public Glib::Value_Enum<Pango::Weight>
164 static GType value_type() G_GNUC_CONST;
168 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
175 * @ingroup pangommEnums
176 * @par Bitwise operators:
177 * <tt>%FontMask operator|(FontMask, FontMask)</tt><br>
178 * <tt>%FontMask operator&(FontMask, FontMask)</tt><br>
179 * <tt>%FontMask operator^(FontMask, FontMask)</tt><br>
180 * <tt>%FontMask operator~(FontMask)</tt><br>
181 * <tt>%FontMask& operator|=(FontMask&, FontMask)</tt><br>
182 * <tt>%FontMask& operator&=(FontMask&, FontMask)</tt><br>
183 * <tt>%FontMask& operator^=(FontMask&, FontMask)</tt><br>
187 FONT_MASK_FAMILY = 1 << 0,
188 FONT_MASK_STYLE = 1 << 1,
189 FONT_MASK_VARIANT = 1 << 2,
190 FONT_MASK_WEIGHT = 1 << 3,
191 FONT_MASK_STRETCH = 1 << 4,
192 FONT_MASK_SIZE = 1 << 5
195 /** @ingroup pangommEnums */
196 inline FontMask operator|(FontMask lhs, FontMask rhs)
197 { return static_cast<FontMask>(static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs)); }
199 /** @ingroup pangommEnums */
200 inline FontMask operator&(FontMask lhs, FontMask rhs)
201 { return static_cast<FontMask>(static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs)); }
203 /** @ingroup pangommEnums */
204 inline FontMask operator^(FontMask lhs, FontMask rhs)
205 { return static_cast<FontMask>(static_cast<unsigned>(lhs) ^ static_cast<unsigned>(rhs)); }
207 /** @ingroup pangommEnums */
208 inline FontMask operator~(FontMask flags)
209 { return static_cast<FontMask>(~static_cast<unsigned>(flags)); }
211 /** @ingroup pangommEnums */
212 inline FontMask& operator|=(FontMask& lhs, FontMask rhs)
213 { return (lhs = static_cast<FontMask>(static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs))); }
215 /** @ingroup pangommEnums */
216 inline FontMask& operator&=(FontMask& lhs, FontMask rhs)
217 { return (lhs = static_cast<FontMask>(static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs))); }
219 /** @ingroup pangommEnums */
220 inline FontMask& operator^=(FontMask& lhs, FontMask rhs)
221 { return (lhs = static_cast<FontMask>(static_cast<unsigned>(lhs) ^ static_cast<unsigned>(rhs))); }
226 #ifndef DOXYGEN_SHOULD_SKIP_THIS
231 class Value<Pango::FontMask> : public Glib::Value_Flags<Pango::FontMask>
234 static GType value_type() G_GNUC_CONST;
238 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
245 /** A Pango::FontDescription represents the description of an ideal font.
246 * It is used both to list what fonts are available on the system and also for specifying the characteristics of a font to load.
248 class FontDescription
251 #ifndef DOXYGEN_SHOULD_SKIP_THIS
252 typedef FontDescription CppObjectType;
253 typedef PangoFontDescription BaseObjectType;
255 static GType get_type() G_GNUC_CONST;
256 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
260 explicit FontDescription(PangoFontDescription* gobject, bool make_a_copy = true);
262 FontDescription(const FontDescription& other);
263 FontDescription& operator=(const FontDescription& other);
267 void swap(FontDescription& other);
269 ///Provides access to the underlying C instance.
270 PangoFontDescription* gobj() { return gobject_; }
272 ///Provides access to the underlying C instance.
273 const PangoFontDescription* gobj() const { return gobject_; }
275 ///Provides access to the underlying C instance. The caller is responsible for freeing it. Use when directly setting fields in structs.
276 PangoFontDescription* gobj_copy() const;
279 PangoFontDescription* gobject_;
284 /* These functions are dangerous! The first casts the "const" from the parameter away
285 * copying the pointer and keep it hanging around.
286 * So desc.set_family_static("some_family") would lead to a segfault.
287 * The latter makes a shallow copy of the parameter's "family" data member.
288 * So if the FontDescription you passed in dies, a pointer to its (deleted)
289 * family data member still hangs around!
290 * This is why we can't wrap these functions!
295 /** Constructs a font description from a string representation.
296 * @a font_name must have the form
297 * "[FAMILY-LIST] [STYLE-OPTIONS] [SIZE]", where FAMILY-LIST is a comma separated
298 * list of families optionally terminated by a comma, STYLE_OPTIONS is a whitespace
299 * separated list of words where each WORD describes one of style, variant, weight,
300 * or stretch, and SIZE is an decimal number (size in points). Any one of the
301 * options may be absent. If FAMILY-LIST is absent, then the family_name field
302 * of the resulting font description will be initialized to 0. If STYLE-OPTIONS
303 * is missing, then all style options will be set to the default values. If SIZE
304 * is missing, the size in the resulting font description will be set to 0.
305 * @param font_name String representation of a font description.
307 explicit FontDescription(const Glib::ustring& font_name);
310 /** Computes a hash of a Pango::FontDescription structure suitable
311 * to be used, for example, as an argument to Glib::hash_table_new().
312 * @return The hash value.
316 /** Sets the family name field of a font description. The family
317 * name represents a family of related font styles, and will
318 * resolve to a particular Pango::FontFamily. In some uses of
319 * Pango::FontDescription, it is also possible to use a comma
320 * separated list of family names for this field.
321 * @param family A string representing the family name.
323 void set_family(const Glib::ustring& family);
325 /** Gets the family name field of a font description. See
326 * pango_font_description_set_family().
327 * @return The family name field. (Will be <tt>0</tt> if not previously set.).
329 Glib::ustring get_family() const;
331 /** Sets the style field of a Pango::FontDescription. The
332 * Pango::Style enumeration describes whether the font is slanted and
333 * the manner in which it is slanted; it can be either
334 * Pango::STYLE_NORMAL, Pango::STYLE_ITALIC, or Pango::STYLE_OBLIQUE.
335 * Most fonts will either have a italic style or an oblique
336 * style, but not both, and font matching in Pango will
337 * match italic specifications with oblique fonts and vice-versa
338 * if an exact match is not found.
339 * @param style The style for the font description.
341 void set_style(Style style);
343 /** Gets the style field of a Pango::FontDescription. See
344 * pango_font_description_set_style().
345 * @return The style field for the font description.
346 * Use pango_font_description_get_set_fields() to find out if
347 * the field was explicitely set or not.
349 Style get_style() const;
351 /** Sets the variant field of a font description. The Pango::Variant
352 * can either be Pango::VARIANT_NORMAL or Pango::VARIANT_SMALL_CAPS.
353 * @param variant The variant type for the font description.
355 void set_variant(Variant variant);
357 /** Gets the variant field of a Pango::FontDescription. See
358 * pango_font_description_set_variant().
359 * @return The variant field for the font description. Use
360 * pango_font_description_get_set_fields() to find out if
361 * the field was explicitely set or not.
363 Variant get_variant() const;
365 /** Sets the weight field of a font description. The weight field
366 * specifies how bold or light the font should be. In addition
367 * to the values of the Pango::Weight enumeration, other intermediate
368 * numeric values are possible.
369 * @param weight The weight for the font description.
371 void set_weight(Weight weight);
373 /** Gets the weight field of a font description. See
374 * pango_font_description_set_weight().
375 * @return The weight field for the font description. Use
376 * pango_font_description_get_set_fields() to find out if
377 * the field was explicitely set or not.
379 Weight get_weight() const;
381 /** Sets the stretch field of a font description. The stretch field
382 * specifies how narrow or wide the font should be.
383 * @param stretch The stretch for the font description.
385 void set_stretch(Stretch stretch);
387 /** Gets the stretch field of a font description.
388 * See pango_font_description_set_stretch().
389 * @return The stretch field for the font description. Use
390 * pango_font_description_get_set_fields() to find out if
391 * the field was explicitely set or not.
393 Stretch get_stretch() const;
395 /** Sets the size field of a font description in fractional points. This is mutually
396 * exclusive with pango_font_description_set_absolute_size().
397 * @param size The size of the font in points, scaled by PANGO_SCALE. (That is,
398 * a @a size value of 10 * PANGO_SCALE is a 10 point font. The conversion
399 * factor between points and device units depends on system configuration
400 * and the output device. For screen display, a logical DPI of 96 is
401 * common, in which case a 10 point font corresponds to a 10 * (96 / 72) = 13.3
402 * pixel font. Use pango_font_description_set_absolute_size() if you need
403 * a particular size in device units.
405 void set_size(int size);
407 /** Gets the size field of a font description.
408 * See pango_font_description_get_size().
409 * @return The size field for the font description in points or device units.
410 * You must call pango_font_description_get_size_is_absolute()
411 * to find out which is the case. Returns 0 if the size field has not
412 * previously been set. pango_font_description_get_set_fields() to
413 * find out if the field was explicitely set or not.
415 int get_size() const;
417 /** Determines which fields in a font description have been set.
418 * @return A bitmask with bits set corresponding to the
419 * fields in @a desc that have been set.
421 FontMask get_set_fields() const;
423 /** Unsets some of the fields in a Pango::FontDescription. Note that
424 * this merely marks the fields cleared, it does not clear the
425 * settings for those fields, to clear a family name set with
426 * pango_font_description_set_family_static() so that it won't
427 * be returned by subsequent calls to pango_font_description_get_family(),
428 * you must actually call pango_font_description_set_family (desc, <tt>0</tt>);
429 * @param to_unset Bitmask of fields in the @a desc to unset.
431 void unset_fields(FontMask to_unset);
433 /** Merges the fields that are set in @a desc_to_merge into the fields in
434 * @a desc . If @a replace_existing is <tt>false</tt>, only fields in @a desc that
435 * are not already set are affected. If <tt>true</tt>, then fields that are
436 * already set will be replaced as well.
437 * @param desc_to_merge The Pango::FontDescription to merge from.
438 * @param replace_existing If <tt>true</tt>, replace fields in @a desc with the
439 * corresponding values from @a desc_to_merge , even if they
442 void merge(const FontDescription& desc_to_merge, bool replace_existing);
444 /** Determines if the style attributes of @a new_match are a closer match
445 * for @a desc than @a old_match , or if @a old_match is <tt>0</tt>, determines if
446 * @a new_match is a match at all. Approximate matching is done for
447 * weight and style; other attributes must match exactly.
448 * @param old_match A Pango::FontDescription, or <tt>0</tt>.
449 * @param new_match A Pango::FontDescription.
450 * @return <tt>true</tt> if @a new_match is a better match.
452 bool better_match(const FontDescription& old_match, const FontDescription& new_match) const;
454 /** Creates a string representation of a font description. See
455 * description_from_string() for a description of the
456 * format of the string representation. The family list in the
457 * string description will only have a terminating comma if the
458 * last word of the list is a valid style option.
459 * @return The string.
461 Glib::ustring to_string() const;
463 /** Creates a filename representation of a font description. The
464 * filename is identical to the result from calling
465 * pango_font_description_to_string(), but with underscores instead of
466 * characters that are untypical in filenames, and in lower case only.
467 * @return The filename.
469 Glib::ustring to_filename() const;
480 /** @relates Pango::FontDescription
481 * @param lhs The left-hand side
482 * @param rhs The right-hand side
485 bool operator==(const FontDescription& lhs, const FontDescription& rhs);
487 /** @relates Pango::FontDescription
488 * @param lhs The left-hand side
489 * @param rhs The right-hand side
492 bool operator!=(const FontDescription& lhs, const FontDescription& rhs);
501 /** @relates Pango::FontDescription
502 * @param lhs The left-hand side
503 * @param rhs The right-hand side
505 inline void swap(FontDescription& lhs, FontDescription& rhs)
513 /** @relates Pango::FontDescription
514 * @param object The C instance
515 * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref.
516 * @result A C++ instance that wraps this C instance.
518 Pango::FontDescription wrap(PangoFontDescription* object, bool take_copy = false);
520 #ifndef DOXYGEN_SHOULD_SKIP_THIS
522 class Value<Pango::FontDescription> : public Glib::Value_Boxed<Pango::FontDescription>
524 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
528 #endif /* _PANGOMM_FONTDESCRIPTION_H */