| 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 | /** |
| 37 | * PANGO_TYPE_FONTSET: |
| 38 | * |
| 39 | * The #GObject type for #PangoFontset. |
| 40 | */ |
| 41 | #define PANGO_TYPE_FONTSET (pango_fontset_get_type ()) |
| 42 | #define PANGO_FONTSET(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), PANGO_TYPE_FONTSET, PangoFontset)) |
| 43 | #define PANGO_IS_FONTSET(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), PANGO_TYPE_FONTSET)) |
| 44 | |
| 45 | PANGO_AVAILABLE_IN_ALL |
| 46 | GType pango_fontset_get_type (void) G_GNUC_CONST; |
| 47 | |
| 48 | typedef struct _PangoFontset PangoFontset; |
| 49 | |
| 50 | /** |
| 51 | * PangoFontsetForeachFunc: |
| 52 | * @fontset: a #PangoFontset |
| 53 | * @font: a font from @fontset |
| 54 | * @user_data: callback data |
| 55 | * |
| 56 | * A callback function used by pango_fontset_foreach() when enumerating |
| 57 | * the 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 | PANGO_AVAILABLE_IN_ALL |
| 68 | PangoFont * pango_fontset_get_font (PangoFontset *fontset, |
| 69 | guint wc); |
| 70 | PANGO_AVAILABLE_IN_ALL |
| 71 | PangoFontMetrics *pango_fontset_get_metrics (PangoFontset *fontset); |
| 72 | PANGO_AVAILABLE_IN_1_4 |
| 73 | void pango_fontset_foreach (PangoFontset *fontset, |
| 74 | PangoFontsetForeachFunc func, |
| 75 | gpointer data); |
| 76 | |
| 77 | #ifdef PANGO_ENABLE_BACKEND |
| 78 | |
| 79 | typedef struct _PangoFontsetClass PangoFontsetClass; |
| 80 | |
| 81 | #define PANGO_FONTSET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PANGO_TYPE_FONTSET, PangoFontsetClass)) |
| 82 | #define PANGO_IS_FONTSET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PANGO_TYPE_FONTSET)) |
| 83 | #define PANGO_FONTSET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PANGO_TYPE_FONTSET, PangoFontsetClass)) |
| 84 | |
| 85 | /** |
| 86 | * PangoFontset: |
| 87 | * |
| 88 | * A #PangoFontset represents a set of #PangoFont to use |
| 89 | * when rendering text. It is the result of resolving a |
| 90 | * #PangoFontDescription against a particular #PangoContext. |
| 91 | * It has operations for finding the component font for |
| 92 | * a particular Unicode character, and for finding a composite |
| 93 | * set of metrics for the entire fontset. |
| 94 | */ |
| 95 | struct _PangoFontset |
| 96 | { |
| 97 | GObject parent_instance; |
| 98 | }; |
| 99 | |
| 100 | /** |
| 101 | * PangoFontsetClass: |
| 102 | * @parent_class: parent #GObjectClass. |
| 103 | * @get_font: a function to get the font in the fontset that contains the |
| 104 | * best glyph for the given Unicode character; see pango_fontset_get_font(). |
| 105 | * @get_metrics: a function to get overall metric information for the fonts |
| 106 | * in the fontset; see pango_fontset_get_metrics(). |
| 107 | * @get_language: a function to get the language of the fontset. |
| 108 | * @foreach: a function to loop over the fonts in the fontset. See |
| 109 | * pango_fontset_foreach(). |
| 110 | * |
| 111 | * The #PangoFontsetClass structure holds the virtual functions for |
| 112 | * a particular #PangoFontset implementation. |
| 113 | */ |
| 114 | struct _PangoFontsetClass |
| 115 | { |
| 116 | GObjectClass parent_class; |
| 117 | |
| 118 | /*< public >*/ |
| 119 | |
| 120 | PangoFont * (*get_font) (PangoFontset *fontset, |
| 121 | guint wc); |
| 122 | |
| 123 | PangoFontMetrics *(*get_metrics) (PangoFontset *fontset); |
| 124 | PangoLanguage * (*get_language) (PangoFontset *fontset); |
| 125 | void (*foreach) (PangoFontset *fontset, |
| 126 | PangoFontsetForeachFunc func, |
| 127 | gpointer data); |
| 128 | |
| 129 | /*< private >*/ |
| 130 | |
| 131 | /* Padding for future expansion */ |
| 132 | void (*_pango_reserved1) (void); |
| 133 | void (*_pango_reserved2) (void); |
| 134 | void (*_pango_reserved3) (void); |
| 135 | void (*_pango_reserved4) (void); |
| 136 | }; |
| 137 | |
| 138 | /* |
| 139 | * PangoFontsetSimple |
| 140 | */ |
| 141 | |
| 142 | /** |
| 143 | * PANGO_TYPE_FONTSET_SIMPLE: |
| 144 | * |
| 145 | * The #GObject type for #PangoFontsetSimple. |
| 146 | */ |
| 147 | /** |
| 148 | * PangoFontsetSimple: |
| 149 | * |
| 150 | * #PangoFontsetSimple is a implementation of the abstract |
| 151 | * #PangoFontset base class in terms of an array of fonts, |
| 152 | * which the creator provides when constructing the |
| 153 | * #PangoFontsetSimple. |
| 154 | */ |
| 155 | #define PANGO_TYPE_FONTSET_SIMPLE (pango_fontset_simple_get_type ()) |
| 156 | #define PANGO_FONTSET_SIMPLE(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), PANGO_TYPE_FONTSET_SIMPLE, PangoFontsetSimple)) |
| 157 | #define PANGO_IS_FONTSET_SIMPLE(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), PANGO_TYPE_FONTSET_SIMPLE)) |
| 158 | |
| 159 | typedef struct _PangoFontsetSimple PangoFontsetSimple; |
| 160 | typedef struct _PangoFontsetSimpleClass PangoFontsetSimpleClass; |
| 161 | |
| 162 | PANGO_AVAILABLE_IN_ALL |
| 163 | GType pango_fontset_simple_get_type (void) G_GNUC_CONST; |
| 164 | |
| 165 | PANGO_AVAILABLE_IN_ALL |
| 166 | PangoFontsetSimple * pango_fontset_simple_new (PangoLanguage *language); |
| 167 | PANGO_AVAILABLE_IN_ALL |
| 168 | void pango_fontset_simple_append (PangoFontsetSimple *fontset, |
| 169 | PangoFont *font); |
| 170 | PANGO_AVAILABLE_IN_ALL |
| 171 | int pango_fontset_simple_size (PangoFontsetSimple *fontset); |
| 172 | |
| 173 | #endif /* PANGO_ENABLE_BACKEND */ |
| 174 | |
| 175 | G_END_DECLS |
| 176 | |
| 177 | #endif /* __PANGO_FONTSET_H__ */ |
| 178 | |