2 * pangofc-font.h: Base fontmap type for fontconfig-based backends
4 * Copyright (C) 2003 Red Hat Software
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.
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.
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.
22 #ifndef __PANGO_FC_FONT_H__
23 #define __PANGO_FC_FONT_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>
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))
38 typedef struct _PangoFcFont PangoFcFont;
39 typedef struct _PangoFcFontClass PangoFcFontClass;
41 #if defined(PANGO_ENABLE_ENGINE) || defined(PANGO_ENABLE_BACKEND)
44 * PANGO_RENDER_TYPE_FC:
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.
50 #define PANGO_RENDER_TYPE_FC "PangoRenderFc"
52 #ifdef PANGO_ENABLE_BACKEND
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))
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.
70 PangoFont parent_instance;
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;
78 GSList *metrics_by_lang;
81 guint is_transformed : 1;
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
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
96 * @get_unknown_glyph: Gets the glyph that should be used to
97 * display an unknown-glyph indication for the specified
100 * @shutdown: Performs any font-specific shutdown code that
101 * needs to be done when pango_fc_font_map_shutdown is called.
104 * Class structure for #PangoFcFont.
106 struct _PangoFcFontClass
109 PangoFontClass parent_class;
112 FT_Face (*lock_face) (PangoFcFont *font);
113 void (*unlock_face) (PangoFcFont *font);
114 gboolean (*has_char) (PangoFcFont *font,
116 guint (*get_glyph) (PangoFcFont *font,
118 PangoGlyph (*get_unknown_glyph) (PangoFcFont *font,
120 void (*shutdown) (PangoFcFont *font);
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);
130 #endif /* PANGO_ENABLE_BACKEND */
132 gboolean pango_fc_font_has_char (PangoFcFont *font,
134 guint pango_fc_font_get_glyph (PangoFcFont *font,
136 #ifndef PANGO_DISABLE_DEPRECATED
137 PangoGlyph pango_fc_font_get_unknown_glyph (PangoFcFont *font,
139 #endif /* PANGO_DISABLE_DEPRECATED */
140 void pango_fc_font_kern_glyphs (PangoFcFont *font,
141 PangoGlyphString *glyphs);
143 #endif /* PANGO_ENABLE_ENGINE || PANGO_ENABLE_BACKEND */
145 GType pango_fc_font_get_type (void) G_GNUC_CONST;
147 FT_Face pango_fc_font_lock_face (PangoFcFont *font);
148 void pango_fc_font_unlock_face (PangoFcFont *font);
151 #endif /* __PANGO_FC_FONT_H__ */