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 <pango/pango.h>
26#include <ft2build.h>
27#include FT_FREETYPE_H
28#include <fontconfig/fontconfig.h>
29
30G_BEGIN_DECLS
31
32#define PANGO_TYPE_FC_FONT (pango_fc_font_get_type ())
33#define PANGO_FC_FONT(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), PANGO_TYPE_FC_FONT, PangoFcFont))
34#define PANGO_IS_FC_FONT(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), PANGO_TYPE_FC_FONT))
35
36typedef struct _PangoFcFont PangoFcFont;
37typedef struct _PangoFcFontClass PangoFcFontClass;
38
39#if defined(PANGO_ENABLE_ENGINE) || defined(PANGO_ENABLE_BACKEND)
40
41/**
42 * PANGO_RENDER_TYPE_FC:
43 *
44 * A string constant used to identify shape engines that work
45 * with the fontconfig based backends. See the @engine_type field
46 * of #PangoEngineInfo.
47 **/
48#define PANGO_RENDER_TYPE_FC "PangoRenderFc"
49
50#ifdef PANGO_ENABLE_BACKEND
51
52#define PANGO_FC_FONT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PANGO_TYPE_FC_FONT, PangoFcFontClass))
53#define PANGO_IS_FC_FONT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PANGO_TYPE_FC_FONT))
54#define PANGO_FC_FONT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PANGO_TYPE_FC_FONT, PangoFcFontClass))
55
56/**
57 * PangoFcFont:
58 *
59 * #PangoFcFont is a base class for font implementations
60 * using the Fontconfig and FreeType libraries and is used in
61 * conjunction with #PangoFcFontMap. When deriving from this
62 * class, you need to implement all of its virtual functions
63 * other than shutdown() along with the get_glyph_extents()
64 * virtual function from #PangoFont.
65 **/
66struct _PangoFcFont
67{
68 PangoFont parent_instance;
69
70 FcPattern *font_pattern; /* fully resolved pattern */
71 PangoFontMap *fontmap; /* associated map */
72 gpointer priv; /* used internally */
73 PangoMatrix matrix; /* used internally */
74 PangoFontDescription *description;
75
76 GSList *metrics_by_lang;
77
78 guint is_hinted : 1;
79 guint is_transformed : 1;
80};
81
82/**
83 * PangoFcFontClass:
84 * @lock_face: Returns the FT_Face of the font and increases
85 * the reference count for the face by one.
86 * @unlock_face: Decreases the reference count for the
87 * FT_Face of the font by one. When the count is zero,
88 * the #PangoFcFont subclass is allowed to free the
89 * FT_Face.
90 * @has_char: Return %TRUE if the the font contains a glyph
91 * corresponding to the specified character.
92 * @get_glyph: Gets the glyph that corresponds to the given
93 * Unicode character.
94 * @get_unknown_glyph: (nullable): Gets the glyph that
95 * should be used to display an unknown-glyph indication
96 * for the specified Unicode character. May be %NULL.
97 * @shutdown: (nullable): Performs any font-specific
98 * shutdown code that needs to be done when
99 * pango_fc_font_map_shutdown is called. May be %NULL.
100 *
101 * Class structure for #PangoFcFont.
102 **/
103struct _PangoFcFontClass
104{
105 /*< private >*/
106 PangoFontClass parent_class;
107
108 /*< public >*/
109 FT_Face (*lock_face) (PangoFcFont *font);
110 void (*unlock_face) (PangoFcFont *font);
111 gboolean (*has_char) (PangoFcFont *font,
112 gunichar wc);
113 guint (*get_glyph) (PangoFcFont *font,
114 gunichar wc);
115 PangoGlyph (*get_unknown_glyph) (PangoFcFont *font,
116 gunichar wc);
117 void (*shutdown) (PangoFcFont *font);
118 /*< private >*/
119
120 /* Padding for future expansion */
121 void (*_pango_reserved1) (void);
122 void (*_pango_reserved2) (void);
123 void (*_pango_reserved3) (void);
124 void (*_pango_reserved4) (void);
125};
126
127#endif /* PANGO_ENABLE_BACKEND */
128
129gboolean pango_fc_font_has_char (PangoFcFont *font,
130 gunichar wc);
131guint pango_fc_font_get_glyph (PangoFcFont *font,
132 gunichar wc);
133#ifndef PANGO_DISABLE_DEPRECATED
134G_DEPRECATED_FOR(PANGO_GET_UNKNOWN_GLYPH)
135PangoGlyph pango_fc_font_get_unknown_glyph (PangoFcFont *font,
136 gunichar wc);
137G_DEPRECATED
138void pango_fc_font_kern_glyphs (PangoFcFont *font,
139 PangoGlyphString *glyphs);
140#endif /* PANGO_DISABLE_DEPRECATED */
141
142#endif /* PANGO_ENABLE_ENGINE || PANGO_ENABLE_BACKEND */
143
144GType pango_fc_font_get_type (void) G_GNUC_CONST;
145
146FT_Face pango_fc_font_lock_face (PangoFcFont *font);
147void pango_fc_font_unlock_face (PangoFcFont *font);
148
149G_END_DECLS
150#endif /* __PANGO_FC_FONT_H__ */
151