1 /* Pango 2 * pango-fontset.h: Font set handling 3 * 4 * Copyright (C) 2001 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_FONTSET_H__ 23 #define __PANGO_FONTSET_H__ 24 25 #include <pango/pango-coverage.h> 26 #include <pango/pango-types.h> 27 28 #include <glib-object.h> 29 30 G_BEGIN_DECLS 31 32 /* 33 * PangoFontset 34 */ 35 36 #define PANGO_TYPE_FONTSET (pango_fontset_get_type ()) 37 #define PANGO_FONTSET(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), PANGO_TYPE_FONTSET, PangoFontset)) 38 #define PANGO_IS_FONTSET(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), PANGO_TYPE_FONTSET)) 39 #define PANGO_FONTSET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PANGO_TYPE_FONTSET, PangoFontsetClass)) 40 #define PANGO_IS_FONTSET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PANGO_TYPE_FONTSET)) 41 #define PANGO_FONTSET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PANGO_TYPE_FONTSET, PangoFontsetClass)) 42 43 44 PANGO_AVAILABLE_IN_ALL 45 GType pango_fontset_get_type (void) G_GNUC_CONST; 46 47 typedef struct _PangoFontset PangoFontset; 48 typedef struct _PangoFontsetClass PangoFontsetClass; 49 50 /** 51 * PangoFontsetForeachFunc: 52 * @fontset: a `PangoFontset` 53 * @font: a font from @fontset 54 * @user_data: callback data 55 * 56 * Callback used by pango_fontset_foreach() when enumerating 57 * fonts in a fontset. 58 * 59 * Returns: if %TRUE, stop iteration and return immediately. 60 * 61 * Since: 1.4 62 **/ 63 typedef gboolean (*PangoFontsetForeachFunc) (PangoFontset *fontset, 64 PangoFont *font, 65 gpointer user_data); 66 67 /** 68 * PangoFontset: 69 * 70 * A `PangoFontset` represents a set of `PangoFont` to use when rendering text. 71 * 72 * A `PAngoFontset` is the result of resolving a `PangoFontDescription` 73 * against a particular `PangoContext`. It has operations for finding the 74 * component font for a particular Unicode character, and for finding a 75 * composite set of metrics for the entire fontset. 76 */ 77 struct _PangoFontset 78 { 79 GObject parent_instance; 80 }; 81 82 /** 83 * PangoFontsetClass: 84 * @parent_class: parent `GObjectClass` 85 * @get_font: a function to get the font in the fontset that contains the 86 * best glyph for the given Unicode character; see pango_fontset_get_font(). 87 * @get_metrics: a function to get overall metric information for the fonts 88 * in the fontset; see pango_fontset_get_metrics(). 89 * @get_language: a function to get the language of the fontset. 90 * @foreach: a function to loop over the fonts in the fontset. See 91 * pango_fontset_foreach(). 92 * 93 * The `PangoFontsetClass` structure holds the virtual functions for 94 * a particular `PangoFontset` implementation. 95 */ 96 struct _PangoFontsetClass 97 { 98 GObjectClass parent_class; 99 100 /*< public >*/ 101 102 PangoFont * (*get_font) (PangoFontset *fontset, 103 guint wc); 104 105 PangoFontMetrics *(*get_metrics) (PangoFontset *fontset); 106 PangoLanguage * (*get_language) (PangoFontset *fontset); 107 void (*foreach) (PangoFontset *fontset, 108 PangoFontsetForeachFunc func, 109 gpointer data); 110 111 /*< private >*/ 112 113 /* Padding for future expansion */ 114 void (*_pango_reserved1) (void); 115 void (*_pango_reserved2) (void); 116 void (*_pango_reserved3) (void); 117 void (*_pango_reserved4) (void); 118 }; 119 120 /** 121 * PangoFontsetSimple: 122 * 123 * `PangoFontsetSimple` is a implementation of the abstract 124 * `PangoFontset` base class as an array of fonts. 125 * 126 * When creating a `PangoFontsetSimple`, you have to provide 127 * the array of fonts that make up the fontset. 128 */ 129 #define PANGO_TYPE_FONTSET_SIMPLE (pango_fontset_simple_get_type ()) 130 #define PANGO_FONTSET_SIMPLE(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), PANGO_TYPE_FONTSET_SIMPLE, PangoFontsetSimple)) 131 #define PANGO_IS_FONTSET_SIMPLE(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), PANGO_TYPE_FONTSET_SIMPLE)) 132 133 typedef struct _PangoFontsetSimple PangoFontsetSimple; 134 typedef struct _PangoFontsetSimpleClass PangoFontsetSimpleClass; 135 136 137 PANGO_AVAILABLE_IN_ALL 138 GType pango_fontset_simple_get_type (void) G_GNUC_CONST; 139 140 PANGO_AVAILABLE_IN_ALL 141 PangoFontsetSimple * pango_fontset_simple_new (PangoLanguage *language); 142 PANGO_AVAILABLE_IN_ALL 143 void pango_fontset_simple_append (PangoFontsetSimple *fontset, 144 PangoFont *font); 145 PANGO_AVAILABLE_IN_ALL 146 int pango_fontset_simple_size (PangoFontsetSimple *fontset); 147 148 149 PANGO_AVAILABLE_IN_ALL 150 PangoFont * pango_fontset_get_font (PangoFontset *fontset, 151 guint wc); 152 PANGO_AVAILABLE_IN_ALL 153 PangoFontMetrics *pango_fontset_get_metrics (PangoFontset *fontset); 154 PANGO_AVAILABLE_IN_1_4 155 void pango_fontset_foreach (PangoFontset *fontset, 156 PangoFontsetForeachFunc func, 157 gpointer data); 158 159 160 161 G_END_DECLS 162 163 #endif /* __PANGO_FONTSET_H__ */ 164