Reference Manual
Inti Logo
Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Namespace Members | Compound Members | File Members

font.h

Go to the documentation of this file.
00001 /*  Inti: Integrated Foundation Classes
00002  *  Copyright (C) 2002-2003 The Inti 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 INTI_PANGO_FONT_H
00025 #define INTI_PANGO_FONT_H
00026 
00027 #ifndef INTI_PANGO_TYPES_H
00028 #include <inti/pango/types.h>
00029 #endif
00030 
00031 #ifndef INTI_G_BOXED_H
00032 #include <inti/glib/boxed.h>
00033 #endif
00034 
00035 #ifndef INTI_G_OBJECT_H
00036 #include <inti/glib/object.h>
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 Inti {
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 { return (PangoFontDescription*)boxed_; }
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         FontMask 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 String& family);
00293 
00294         void set_style(Style style);
00303 
00304         void set_variant(Variant variant);
00309 
00310         void set_weight(Weight weight);
00316 
00317         void set_stretch(Stretch stretch);
00322         
00323         void set_size(int size);
00329 
00330         void unset_fields(FontMask to_unset);
00336         
00337         void merge(const FontDescription& desc_to_merge, bool replace_existing);
00345 
00346         bool better_match(const FontDescription& new_match, const FontDescription *old_match = 0) const;
00354 
00356 };
00357 
00362 
00363 class FontMetrics : public G::Boxed
00364 {
00365 public:
00368 
00369         explicit FontMetrics(PangoFontMetrics *metrics);
00377 
00378         FontMetrics(PangoFontMetrics *metrics, bool copy);
00390 
00391         FontMetrics(const FontMetrics& src);
00394 
00395         virtual ~FontMetrics();
00397 
00398         FontMetrics& operator=(const FontMetrics& src);
00401 
00405 
00406         PangoFontMetrics* pango_font_metrics() const { return (PangoFontMetrics*)boxed_; }
00408 
00409         operator PangoFontMetrics* () const;
00411 
00412         int get_ascent() const;
00419 
00420         int get_descent() const;
00427 
00428         int get_approximate_char_width() const;
00434 
00435         int get_approximate_digit_width() const;
00441 
00443 };
00444 
00450 
00451 class FontFace : public G::Object
00452 {
00453         friend class G::Object;
00454 
00455         FontFace(const FontFace&);
00456         FontFace& operator=(const FontFace&);
00457         
00458 protected:
00461         
00462         explicit FontFace(PangoFontFace *face, bool reference = true);
00469 
00471 
00472 public:
00475         
00476         virtual ~FontFace();
00478 
00482         
00483         PangoFontFace* pango_font_face() const { return (PangoFontFace*)instance; }
00485 
00486         operator PangoFontFace* () const;
00488 
00489         Pointer<FontDescription> describe() const;
00494         
00495         String get_face_name() const;
00501 
00503 };
00504 
00511 
00512 class FontFamily : public G::Object
00513 {
00514         friend class G::Object;
00515 
00516         FontFamily(const FontFamily&);
00517         FontFamily& operator=(const FontFamily&);
00518         
00519 protected:
00522 
00523         explicit FontFamily(PangoFontFamily *family, bool reference = true);
00530 
00532 
00533 public:
00536 
00537         virtual ~FontFamily();
00539 
00543 
00544         PangoFontFamily* pango_font_family() const { return (PangoFontFamily*)instance; }
00546 
00547         operator PangoFontFamily* () const;
00549 
00550         String get_name() const;
00556 
00560         
00561         bool list_faces(std::vector<FontFace*>& faces);
00568 
00570 };
00571 
00576 
00577 class Font : public G::Object
00578 {
00579         friend class G::Object;
00580 
00581         Font(const Font&);
00582         Font& operator=(const Font&);
00583         
00584 protected:
00587         
00588         explicit Font(PangoFont *font, bool reference = true);
00595 
00597 
00598 public:
00601         
00602         virtual ~Font();
00604         
00608         
00609         PangoFont* pango_font() const { return (PangoFont*)instance; }
00611 
00612         operator PangoFont* () const ;
00614 
00615         Pointer<FontDescription> describe() const;
00618 
00619         Pointer<Coverage> get_coverage(PangoLanguage *language) const;
00623 
00624         Pointer<FontMetrics> get_metrics(PangoLanguage *language = 0) const;
00633 
00634         void get_glyph_extents(Glyph glyph, Rectangle *ink_rect, Rectangle *logical_rect) const;
00648 
00652 
00653         PangoEngineShape* find_shaper(unsigned int character_code, PangoLanguage *language);
00658 
00660 };
00661 
00662 } // namespace Pango
00663 
00664 } // namespace Inti
00665 
00666 #endif // INTI_PANGO_FONT_H
00667 
Main Page - Footer


Generated on Sun Sep 14 20:08:02 2003 for Inti by doxygen 1.3.2 written by Dimitri van Heesch, © 1997-2002