GFC Logo GFC Title Logo
Reference Manual
Main Page  |  Namespace List  |  Alphabetical List  |  Class List  |  File List

font.hh

Go to the documentation of this file.
00001 /* GFC-UI: GTK+ Foundation Classes (User Interface Library) 00002 * Copyright (C) 2002-2004 The GFC Development Team. 00003 * 00004 * This program is free software; you can redistribute it and/or modify 00005 * it under the terms of the GNU General Public License as published by 00006 * the Free Software Foundation; either version 2 of the License, or 00007 * (at your option) any later version. 00008 * 00009 * This program is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 * GNU Library General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU Library General Public License 00015 * along with this program; if not, write to the Free Software 00016 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00017 */ 00018 00023 00024 #ifndef GFC_PANGO_FONT_HH 00025 #define GFC_PANGO_FONT_HH 00026 00027 #ifndef GFC_PANGO_TYPES_HH 00028 #include <gfc/pango/types.hh> 00029 #endif 00030 00031 #ifndef GFC_G_BOXED_HH 00032 #include <gfc/glib/boxed.hh> 00033 #endif 00034 00035 #ifndef GFC_G_OBJECT_HH 00036 #include <gfc/glib/object.hh> 00037 #endif 00038 00039 #ifndef __PANGO_FONT_H__ 00040 #include <pango/pango-font.h> 00041 #endif 00042 00043 #ifndef _CPP_VECTOR 00044 #include <vector> 00045 #endif 00046 00047 namespace GFC { 00048 00049 namespace Pango { 00050 00051 class Coverage; 00052 00055 00056 enum Style 00057 { 00058 STYLE_NORMAL = PANGO_STYLE_NORMAL, 00059 STYLE_OBLIQUE = PANGO_STYLE_OBLIQUE, 00060 STYLE_ITALIC = PANGO_STYLE_ITALIC 00061 }; 00062 00065 00066 enum Variant 00067 { 00068 VARIANT_NORMAL = PANGO_VARIANT_NORMAL, 00070 00071 VARIANT_SMALL_CAPS = PANGO_VARIANT_SMALL_CAPS 00073 }; 00074 00078 00079 enum Weight 00080 { 00081 WEIGHT_ULTALIGHT = PANGO_WEIGHT_ULTRALIGHT, 00082 WEIGHT_LIGHT = PANGO_WEIGHT_LIGHT, 00083 WEIGHT_NORMAL = PANGO_WEIGHT_NORMAL, 00084 WEIGHT_BOLD = PANGO_WEIGHT_BOLD, 00085 WEIGHT_ULTRABOLD = PANGO_WEIGHT_ULTRABOLD, 00086 WEIGHT_HEAVY = PANGO_WEIGHT_HEAVY 00087 }; 00088 00091 00092 enum Stretch 00093 { 00094 STRETCH_UTLRA_CONDENSED = PANGO_STRETCH_ULTRA_CONDENSED, 00095 STRETCH_EXTRA_CONDENSED = PANGO_STRETCH_EXTRA_CONDENSED, 00096 STRETCH_CONDENSED = PANGO_STRETCH_CONDENSED, 00097 STRETCH_SEMI_CONDENSED = PANGO_STRETCH_SEMI_CONDENSED, 00098 STRETCH_NORMAL = PANGO_STRETCH_NORMAL, 00099 STRETCH_SEMI_EXPANDED = PANGO_STRETCH_SEMI_EXPANDED, 00100 STRETCH_EXPANDED = PANGO_STRETCH_EXPANDED, 00101 STRETCH_EXTRA_EXPANDED = PANGO_STRETCH_EXTRA_EXPANDED, 00102 STRETCH_ULTRA_EXPANDED = PANGO_STRETCH_ULTRA_EXPANDED 00103 }; 00104 00107 00108 enum FontMask 00109 { 00110 FONT_MASK_FAMILY = PANGO_FONT_MASK_FAMILY, 00111 FONT_MASK_STYLE = PANGO_FONT_MASK_STYLE, 00112 FONT_MASK_VARIANT = PANGO_FONT_MASK_VARIANT, 00113 FONT_MASK_WEIGHT = PANGO_FONT_MASK_WEIGHT, 00114 FONT_MASK_STRETCH = PANGO_FONT_MASK_STRETCH, 00115 FONT_MASK_SIZE = PANGO_FONT_MASK_SIZE 00116 }; 00117 00119 00120 typedef unsigned int FontMaskField; 00121 00128 00129 class FontDescription : public G::Boxed 00130 { 00131 public: 00134 00135 FontDescription(); 00137 00138 FontDescription(const String& desc); 00145 00146 FontDescription(const String& family, int size, Style style = STYLE_NORMAL, Weight weight = WEIGHT_NORMAL); 00152 00153 FontDescription(PangoFontDescription *desc); 00161 00162 FontDescription(PangoFontDescription *desc, bool copy); 00174 00175 FontDescription(const FontDescription& src); 00178 00179 virtual ~FontDescription(); 00181 00182 FontDescription& operator=(const FontDescription& src); 00185 00189 00190 PangoFontDescription* pango_font_description() const; 00192 00193 operator PangoFontDescription* () const; 00195 00196 String get_family() const; 00199 00200 Style get_style() const; 00205 00206 Variant get_variant() const; 00211 00212 Weight get_weight() const; 00217 00218 Stretch get_stretch() const; 00223 00224 int get_size() const; 00231 00232 FontMaskField get_set_fields() const; 00235 00236 bool equal(const FontDescription& other) const; 00242 00243 bool operator==(const FontDescription& other) const; 00249 00250 bool operator!=(const FontDescription& other) const; 00256 00260 00261 unsigned int hash() const; 00265 00266 String to_string() const; 00278 00279 String to_filename() const; 00285 00286 void set_family(const char *family); 00287 void set_family(const String& family); 00294 00295 void set_style(Style style); 00304 00305 void set_variant(Variant variant); 00310 00311 void set_weight(Weight weight); 00317 00318 void set_stretch(Stretch stretch); 00323 00324 void set_size(int size); 00330 00331 void unset_fields(FontMaskField to_unset); 00337 00338 void merge(const FontDescription& desc_to_merge, bool replace_existing); 00346 00347 bool better_match(const FontDescription& new_match, const FontDescription *old_match = 0) const; 00355 00357 }; 00358 00363 00364 class FontMetrics : public G::Boxed 00365 { 00366 public: 00369 00370 explicit FontMetrics(PangoFontMetrics *metrics); 00378 00379 FontMetrics(PangoFontMetrics *metrics, bool copy); 00391 00392 FontMetrics(const FontMetrics& src); 00395 00396 virtual ~FontMetrics(); 00398 00399 FontMetrics& operator=(const FontMetrics& src); 00402 00406 00407 PangoFontMetrics* pango_font_metrics() const; 00409 00410 operator PangoFontMetrics* () const; 00412 00413 int get_ascent() const; 00420 00421 int get_descent() const; 00428 00429 int get_approximate_char_width() const; 00435 00436 int get_approximate_digit_width() const; 00442 00444 }; 00445 00451 00452 class FontFace : public G::Object 00453 { 00454 friend class G::Object; 00455 00456 FontFace(const FontFace&); 00457 FontFace& operator=(const FontFace&); 00458 00459 protected: 00462 00463 explicit FontFace(PangoFontFace *face, bool owns_reference = true); 00470 00472 00473 public: 00476 00477 virtual ~FontFace(); 00479 00483 00484 PangoFontFace* pango_font_face() const; 00486 00487 operator PangoFontFace* () const; 00489 00490 Pointer<FontDescription> describe() const; 00495 00496 String get_face_name() const; 00502 00506 00507 bool list_sizes(std::vector<int>& sizes) const; 00515 00517 }; 00518 00525 00526 class FontFamily : public G::Object 00527 { 00528 friend class G::Object; 00529 00530 FontFamily(const FontFamily&); 00531 FontFamily& operator=(const FontFamily&); 00532 00533 protected: 00536 00537 explicit FontFamily(PangoFontFamily *family, bool owns_reference = true); 00544 00546 00547 public: 00550 00551 virtual ~FontFamily(); 00553 00557 00558 PangoFontFamily* pango_font_family() const; 00560 00561 operator PangoFontFamily* () const; 00563 00564 String get_name() const; 00570 00571 bool is_monospace() const; 00584 00588 00589 bool list_faces(std::vector<FontFace*>& faces) const; 00596 00598 }; 00599 00604 00605 class Font : public G::Object 00606 { 00607 friend class G::Object; 00608 00609 Font(const Font&); 00610 Font& operator=(const Font&); 00611 00612 protected: 00615 00616 explicit Font(PangoFont *font, bool owns_reference = true); 00623 00625 00626 public: 00629 00630 virtual ~Font(); 00632 00636 00637 PangoFont* pango_font() const; 00639 00640 operator PangoFont* () const ; 00642 00643 Pointer<FontDescription> describe() const; 00646 00647 Pointer<Coverage> get_coverage(PangoLanguage *language) const; 00651 00652 Pointer<FontMetrics> get_metrics(PangoLanguage *language = 0) const; 00661 00662 void get_glyph_extents(Glyph glyph, Rectangle *ink_rect, Rectangle *logical_rect) const; 00676 00680 00681 PangoEngineShape* find_shaper(unsigned int character_code, PangoLanguage *language); 00686 00688 }; 00689 00690 } // namespace Pango 00691 00692 } // namespace GFC 00693 00694 #include <gfc/pango/inline/font.inl> 00695 00696 #endif // GFC_PANGO_FONT_HH 00697

Generated on Tue Aug 24 00:34:31 2004 for GFC-UI by doxygen 1.3.8