add new sigc++2 directory
[ardour.git] / libs / gtkmm2 / pango / pangomm / font.h
1 // -*- c++ -*-
2 // Generated by gtkmmproc -- DO NOT MODIFY!
3 #ifndef _PANGOMM_FONT_H
4 #define _PANGOMM_FONT_H
5
6
7 #include <glibmm.h>
8
9 /* $Id$ */
10
11 /* font.h
12  * 
13  * Copyright (C) 1998-1999 The gtkmm Development Team 
14  *
15  * This library is free software; you can redistribute it and/or
16  * modify it under the terms of the GNU Library General Public
17  * License as published by the Free Software Foundation; either
18  * version 2 of the License, or (at your option) any later version.
19  *
20  * This library is distributed in the hope that it will be useful,
21  * but WITHOUT ANY WARRANTY; without even the implied warranty of
22  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
23  * Library General Public License for more details.
24  *
25  * You should have received a copy of the GNU Library General Public
26  * License along with this library; if not, write to the Free
27  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
28  */
29
30
31 #include <glibmm/object.h>
32 #include <pangomm/rectangle.h>
33 #include <pangomm/language.h>
34 #include <pangomm/glyph.h>
35 #include <pangomm/fontdescription.h>
36 #include <pangomm/fontmetrics.h>
37 #include <pangomm/coverage.h>
38 #include <pango/pango-font.h>
39
40
41 #ifndef DOXYGEN_SHOULD_SKIP_THIS
42 typedef struct _PangoFont PangoFont;
43 typedef struct _PangoFontClass PangoFontClass;
44 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
45
46
47 namespace Pango
48 { class Font_Class; } // namespace Pango
49 namespace Pango
50 {
51
52 const int    SCALE          = 1024;
53 const double SCALE_XX_SMALL = 0.5787037037037;
54 const double SCALE_X_SMALL  = 0.6444444444444;
55 const double SCALE_SMALL    = 0.8333333333333;
56 const double SCALE_MEDIUM   = 1.0;
57 const double SCALE_LARGE    = 1.2;
58 const double SCALE_X_LARGE  = 1.4399999999999;
59 const double SCALE_XX_LARGE = 1.728;
60
61 #ifndef DOXYGEN_SHOULD_SKIP_THIS
62 class FontMap;
63 #endif //DOXYGEN_SHOULD_SKIP_THIS
64
65 /** A Pango::Font is used to represent a font in a rendering-system-independent matter.
66  */
67
68 class Font : public Glib::Object
69 {
70   
71 #ifndef DOXYGEN_SHOULD_SKIP_THIS
72
73 public:
74   typedef Font CppObjectType;
75   typedef Font_Class CppClassType;
76   typedef PangoFont BaseObjectType;
77   typedef PangoFontClass BaseClassType;
78
79 private:  friend class Font_Class;
80   static CppClassType font_class_;
81
82 private:
83   // noncopyable
84   Font(const Font&);
85   Font& operator=(const Font&);
86
87 protected:
88   explicit Font(const Glib::ConstructParams& construct_params);
89   explicit Font(PangoFont* castitem);
90
91 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
92
93 public:
94   virtual ~Font();
95
96 #ifndef DOXYGEN_SHOULD_SKIP_THIS
97   static GType get_type()      G_GNUC_CONST;
98   static GType get_base_type() G_GNUC_CONST;
99 #endif
100
101   ///Provides access to the underlying C GObject.
102   PangoFont*       gobj()       { return reinterpret_cast<PangoFont*>(gobject_); }
103
104   ///Provides access to the underlying C GObject.
105   const PangoFont* gobj() const { return reinterpret_cast<PangoFont*>(gobject_); }
106
107   ///Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
108   PangoFont* gobj_copy();
109
110 private:
111
112    //This would return a PangoEngineShape* but the definition of the struct is surrounded by #define PANGO_ENABLE_BACKEND [...] #endif. So don't wrap it.
113
114 public:
115   
116   /** Return value: a newly-allocated Pango::FontDescription object.
117    * @return A newly-allocated Pango::FontDescription object.
118    */
119   FontDescription describe() const;
120   
121   /** Return value: a newly-allocated Pango::FontDescription object.
122    * @return A newly-allocated Pango::FontDescription object.
123    * 
124    * Since: 1.14.
125    */
126   FontDescription describe_with_absolute_size() const;
127   
128   /** Computes the coverage map for a given font and language tag.
129    * @param language The language tag.
130    * @return A newly-allocated Pango::Coverage object.
131    */
132   Glib::RefPtr<Coverage> get_coverage(const Language& language) const;
133
134   /** Gets overall metric information for a font.
135    * The metrics may be substantially different for different scripts.
136    * However, this function overload returns the metrics for the entire font.
137    */
138   FontMetrics get_metrics() const;
139   
140   /** Gets overall metric information for a font. Since the metrics may be
141    * substantially different for different scripts, a language tag can
142    * be provided to indicate that the metrics should be retrieved that
143    * correspond to the script(s) used by that language.
144    * @param language Language tag used to determine which script to get the metrics
145    * for.
146    * @return A Pango::Metrics object.
147    */
148   FontMetrics get_metrics(const Language& language) const;
149
150   
151   /** Gets the logical and ink extents of a glyph within a font. The
152    * coordinate system for each rectangle has its origin at the
153    * base line and horizontal origin of the character with increasing
154    * coordinates extending to the right and down. The macros PANGO_ASCENT(),
155    * PANGO_DESCENT(), PANGO_LBEARING(), and PANGO_RBEARING can be used to convert
156    * from the extents rectangle to more traditional font metrics. The units
157    * of the rectangles are in 1/PANGO_SCALE of a device unit.
158    * @param glyph The glyph index.
159    * @param ink_rect Rectangle used to store the extents of the glyph as drawn.
160    * @param logical_rect Rectangle used to store the logical extents of the glyph.
161    */
162   void get_glyph_extents(Glyph glyph, Rectangle& ink_rect, Rectangle& logical_rect) const;
163
164   
165   /** Gets the font map for which the font was created.
166    * @return The Pango::FontMap for the font
167    * 
168    * Since: 1.10.
169    */
170   Glib::RefPtr<FontMap> get_font_map();
171   
172   /** Gets the font map for which the font was created.
173    * @return The Pango::FontMap for the font
174    * 
175    * Since: 1.10.
176    */
177   Glib::RefPtr<const FontMap> get_font_map() const;
178
179   /** Get the ink extents of a glyph within the font.
180    * @param glyph The glyph index.
181    * @return The extents of the glyph as drawn.
182    */
183   Rectangle get_glyph_ink_extents(Glyph glyph) const;
184
185   /** Gets the logical extents of a glyph within the font.
186    * @param glyph The glyph index.
187    * @return The logical extents of the glyph.
188    */
189   Rectangle get_glyph_logical_extents(Glyph glyph) const;
190
191
192 public:
193
194 public:
195   //C++ methods used to invoke GTK+ virtual functions:
196 #ifdef GLIBMM_VFUNCS_ENABLED
197 #endif //GLIBMM_VFUNCS_ENABLED
198
199 protected:
200   //GTK+ Virtual Functions (override these to change behaviour):
201 #ifdef GLIBMM_VFUNCS_ENABLED
202 #endif //GLIBMM_VFUNCS_ENABLED
203
204   //Default Signal Handlers::
205 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
206 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
207
208
209 };
210
211 } /* namespace Pango */
212
213
214 namespace Glib
215 {
216   /** A Glib::wrap() method for this object.
217    * 
218    * @param object The C instance.
219    * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref.
220    * @result A C++ instance that wraps this C instance.
221    *
222    * @relates Pango::Font
223    */
224   Glib::RefPtr<Pango::Font> wrap(PangoFont* object, bool take_copy = false);
225 }
226
227
228 #endif /* _PANGOMM_FONT_H */
229