Upload tizen 2.0 beta source
[external/pango1.0.git] / pango / pangofc-font.h
1 /* Pango
2  * pangofc-font.h: Base fontmap type for fontconfig-based backends
3  *
4  * Copyright (C) 2003 Red Hat Software
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Library General Public
8  * License as published by the Free Software Foundation; either
9  * version 2 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Library General Public License for more details.
15  *
16  * You should have received a copy of the GNU Library General Public
17  * License along with this library; if not, write to the
18  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19  * Boston, MA 02111-1307, USA.
20  */
21
22 #ifndef __PANGO_FC_FONT_H__
23 #define __PANGO_FC_FONT_H__
24
25 #include <ft2build.h>
26 #include FT_FREETYPE_H
27 #include <fontconfig/fontconfig.h>
28 #include <pango/pango-font.h>
29 #include <pango/pango-fontmap.h>
30 #include <pango/pango-glyph.h>
31
32 G_BEGIN_DECLS
33
34 #define PANGO_TYPE_FC_FONT              (pango_fc_font_get_type ())
35 #define PANGO_FC_FONT(object)           (G_TYPE_CHECK_INSTANCE_CAST ((object), PANGO_TYPE_FC_FONT, PangoFcFont))
36 #define PANGO_IS_FC_FONT(object)        (G_TYPE_CHECK_INSTANCE_TYPE ((object), PANGO_TYPE_FC_FONT))
37
38 typedef struct _PangoFcFont      PangoFcFont;
39 typedef struct _PangoFcFontClass PangoFcFontClass;
40
41 #if defined(PANGO_ENABLE_ENGINE) || defined(PANGO_ENABLE_BACKEND)
42
43 /**
44  * PANGO_RENDER_TYPE_FC:
45  *
46  * A string constant used to identify shape engines that work
47  * with the fontconfig based backends. See the @engine_type field
48  * of #PangoEngineInfo.
49  **/
50 #define PANGO_RENDER_TYPE_FC "PangoRenderFc"
51
52 #ifdef PANGO_ENABLE_BACKEND
53
54 #define PANGO_FC_FONT_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST ((klass), PANGO_TYPE_FC_FONT, PangoFcFontClass))
55 #define PANGO_IS_FC_FONT_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), PANGO_TYPE_FC_FONT))
56 #define PANGO_FC_FONT_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), PANGO_TYPE_FC_FONT, PangoFcFontClass))
57
58 /**
59  * PangoFcFont:
60  *
61  * #PangoFcFont is a base class for font implementations
62  * using the Fontconfig and FreeType libraries and is used in
63  * conjunction with #PangoFcFontMap. When deriving from this
64  * class, you need to implement all of its virtual functions
65  * other than shutdown() along with the get_glyph_extents()
66  * virtual function from #PangoFont.
67  **/
68 struct _PangoFcFont
69 {
70   PangoFont parent_instance;
71
72   FcPattern *font_pattern;          /* fully resolved pattern */
73   PangoFontMap *fontmap;            /* associated map */
74   gpointer priv;                    /* used internally */
75   PangoMatrix matrix;               /* used internally */
76   PangoFontDescription *description;
77
78   GSList *metrics_by_lang;
79
80   guint is_hinted : 1;
81   guint is_transformed : 1;
82 };
83
84 /**
85  * PangoFcFontClass:
86  * @lock_face: Returns the FT_Face of the font and increases
87  *  the reference count for the face by one.
88  * @unlock_face: Decreases the reference count for the
89  *  FT_Face of the font by one. When the count is zero,
90  *  the #PangoFcFont subclass is allowed to free the
91  *  FT_Face.
92  * @has_char: Return %TRUE if the the font contains a glyph
93  *   corresponding to the specified character.
94  * @get_glyph: Gets the glyph that corresponds to the given
95  *   Unicode character.
96  * @get_unknown_glyph: Gets the glyph that should be used to
97  *   display an unknown-glyph indication for the specified
98  *   Unicode character.
99  *   May be %NULL.
100  * @shutdown: Performs any font-specific shutdown code that
101  *   needs to be done when pango_fc_font_map_shutdown is called.
102  *   May be %NULL.
103  *
104  * Class structure for #PangoFcFont.
105  **/
106 struct _PangoFcFontClass
107 {
108   /*< private >*/
109   PangoFontClass parent_class;
110
111   /*< public >*/
112   FT_Face    (*lock_face)         (PangoFcFont      *font);
113   void       (*unlock_face)       (PangoFcFont      *font);
114   gboolean   (*has_char)          (PangoFcFont      *font,
115                                    gunichar          wc);
116   guint      (*get_glyph)         (PangoFcFont      *font,
117                                    gunichar          wc);
118   PangoGlyph (*get_unknown_glyph) (PangoFcFont      *font,
119                                    gunichar          wc);
120   void       (*shutdown)          (PangoFcFont      *font);
121   /*< private >*/
122
123   /* Padding for future expansion */
124   void (*_pango_reserved1) (void);
125   void (*_pango_reserved2) (void);
126   void (*_pango_reserved3) (void);
127   void (*_pango_reserved4) (void);
128 };
129
130 #endif /* PANGO_ENABLE_BACKEND */
131
132 gboolean   pango_fc_font_has_char          (PangoFcFont      *font,
133                                             gunichar          wc);
134 guint      pango_fc_font_get_glyph         (PangoFcFont      *font,
135                                             gunichar          wc);
136 #ifndef PANGO_DISABLE_DEPRECATED
137 PangoGlyph pango_fc_font_get_unknown_glyph (PangoFcFont      *font,
138                                             gunichar          wc);
139 #endif /* PANGO_DISABLE_DEPRECATED */
140 void       pango_fc_font_kern_glyphs       (PangoFcFont      *font,
141                                             PangoGlyphString *glyphs);
142
143 #endif /* PANGO_ENABLE_ENGINE || PANGO_ENABLE_BACKEND */
144
145 GType      pango_fc_font_get_type (void) G_GNUC_CONST;
146
147 FT_Face    pango_fc_font_lock_face         (PangoFcFont      *font);
148 void       pango_fc_font_unlock_face       (PangoFcFont      *font);
149
150 G_END_DECLS
151 #endif /* __PANGO_FC_FONT_H__ */