1 /* Pango 2 * pangofc-fontmap.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_MAP_H__ 23 #define __PANGO_FC_FONT_MAP_H__ 24 25 #include <pango/pango.h> 26 #include <fontconfig/fontconfig.h> 27 #include <pango/pangofc-decoder.h> 28 #include <pango/pangofc-font.h> 29 #include <hb.h> 30 31 G_BEGIN_DECLS 32 33 34 /* 35 * PangoFcFontMap 36 */ 37 38 #ifdef __GI_SCANNER__ 39 #define PANGO_FC_TYPE_FONT_MAP (pango_fc_font_map_get_type ()) 40 #define PANGO_FC_FONT_MAP(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), PANGO_FC_TYPE_FONT_MAP, PangoFcFontMap)) 41 #define PANGO_FC_IS_FONT_MAP(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), PANGO_FC_TYPE_FONT_MAP)) 42 #else 43 #define PANGO_TYPE_FC_FONT_MAP (pango_fc_font_map_get_type ()) 44 #define PANGO_FC_FONT_MAP(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), PANGO_TYPE_FC_FONT_MAP, PangoFcFontMap)) 45 #define PANGO_IS_FC_FONT_MAP(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), PANGO_TYPE_FC_FONT_MAP)) 46 #endif 47 48 typedef struct _PangoFcFontMap PangoFcFontMap; 49 typedef struct _PangoFcFontMapClass PangoFcFontMapClass; 50 typedef struct _PangoFcFontMapPrivate PangoFcFontMapPrivate; 51 52 PANGO_AVAILABLE_IN_ALL 53 GType pango_fc_font_map_get_type (void) G_GNUC_CONST; 54 55 PANGO_AVAILABLE_IN_1_4 56 void pango_fc_font_map_cache_clear (PangoFcFontMap *fcfontmap); 57 58 PANGO_AVAILABLE_IN_1_38 59 void 60 pango_fc_font_map_config_changed (PangoFcFontMap *fcfontmap); 61 62 PANGO_AVAILABLE_IN_1_38 63 void 64 pango_fc_font_map_set_config (PangoFcFontMap *fcfontmap, 65 FcConfig *fcconfig); 66 PANGO_AVAILABLE_IN_1_38 67 FcConfig * 68 pango_fc_font_map_get_config (PangoFcFontMap *fcfontmap); 69 70 /** 71 * PangoFcDecoderFindFunc: 72 * @pattern: a fully resolved `FcPattern` specifying the font on the system 73 * @user_data: user data passed to 74 * [method@PangoFc.FontMap.add_decoder_find_func] 75 * 76 * Callback function passed to [method@PangoFc.FontMap.add_decoder_find_func]. 77 * 78 * Return value: a new reference to a custom decoder for this pattern, 79 * or %NULL if the default decoder handling should be used. 80 **/ 81 typedef PangoFcDecoder * (*PangoFcDecoderFindFunc) (FcPattern *pattern, 82 gpointer user_data); 83 84 PANGO_AVAILABLE_IN_1_6 85 void pango_fc_font_map_add_decoder_find_func (PangoFcFontMap *fcfontmap, 86 PangoFcDecoderFindFunc findfunc, 87 gpointer user_data, 88 GDestroyNotify dnotify); 89 PANGO_AVAILABLE_IN_1_26 90 PangoFcDecoder *pango_fc_font_map_find_decoder (PangoFcFontMap *fcfontmap, 91 FcPattern *pattern); 92 93 PANGO_AVAILABLE_IN_1_4 94 PangoFontDescription *pango_fc_font_description_from_pattern (FcPattern *pattern, 95 gboolean include_size); 96 97 #ifndef PANGO_DISABLE_DEPRECATED 98 PANGO_DEPRECATED_IN_1_22_FOR(pango_font_map_create_context) 99 PangoContext * pango_fc_font_map_create_context (PangoFcFontMap *fcfontmap); 100 #endif 101 PANGO_AVAILABLE_IN_1_4 102 void pango_fc_font_map_shutdown (PangoFcFontMap *fcfontmap); 103 104 105 PANGO_AVAILABLE_IN_1_44 106 hb_face_t * pango_fc_font_map_get_hb_face (PangoFcFontMap *fcfontmap, 107 PangoFcFont *fcfont); 108 109 /** 110 * PangoFcSubstituteFunc: 111 * @pattern: the FcPattern to tweak. 112 * @data: user data. 113 * 114 * Function type for doing final config tweaking on prepared `FcPattern`s. 115 */ 116 typedef void (*PangoFcSubstituteFunc) (FcPattern *pattern, 117 gpointer data); 118 119 /** 120 * pango_fc_font_map_set_default_substitute: 121 * @fontmap: a `PangoFcFontMap` 122 * @func: function to call to to do final config tweaking on `FcPattern` objects 123 * @data: data to pass to @func 124 * @notify: function to call when @data is no longer used 125 * 126 * Sets a function that will be called to do final configuration 127 * substitution on a `FcPattern` before it is used to load 128 * the font. 129 * 130 * This function can be used to do things like set 131 * hinting and antialiasing options. 132 * 133 * Since: 1.48 134 */ 135 PANGO_AVAILABLE_IN_1_48 136 void pango_fc_font_map_set_default_substitute (PangoFcFontMap *fontmap, 137 PangoFcSubstituteFunc func, 138 gpointer data, 139 GDestroyNotify notify); 140 141 /** 142 * pango_fc_font_map_substitute_changed: 143 * @fontmap: a `PangoFcFontMap` 144 * 145 * Call this function any time the results of the default 146 * substitution function set with 147 * [method@PangoFc.FontMap.set_default_substitute] change. 148 * 149 * That is, if your substitution function will return different 150 * results for the same input pattern, you must call this function. 151 * 152 * Since: 1.48 153 */ 154 PANGO_AVAILABLE_IN_1_48 155 void pango_fc_font_map_substitute_changed (PangoFcFontMap *fontmap); 156 157 /** 158 * PANGO_FC_GRAVITY: 159 * 160 * Fontconfig property that Pango sets on any 161 * fontconfig pattern it passes to fontconfig 162 * if a `PangoGravity` other than %PANGO_GRAVITY_SOUTH 163 * is desired. 164 * 165 * The property will have a `PangoGravity` value as a string, 166 * like "east". This can be used to write fontconfig configuration 167 * rules to choose different fonts for horizontal and vertical 168 * writing directions. 169 * 170 * Since: 1.20 171 */ 172 #define PANGO_FC_GRAVITY "pangogravity" 173 174 /** 175 * PANGO_FC_VERSION: 176 * 177 * Fontconfig property that Pango sets on any 178 * fontconfig pattern it passes to fontconfig. 179 * 180 * The property will have an integer value equal to what 181 * [func@Pango.version] returns. This can be used to write 182 * fontconfig configuration rules that only affect certain 183 * pango versions (or only pango-using applications, or only 184 * non-pango-using applications). 185 * 186 * Since: 1.20 187 */ 188 #define PANGO_FC_VERSION "pangoversion" 189 190 /** 191 * PANGO_FC_PRGNAME: 192 * 193 * Fontconfig property that Pango sets on any 194 * fontconfig pattern it passes to fontconfig. 195 * 196 * The property will have a string equal to what 197 * g_get_prgname() returns. This can be used to write 198 * fontconfig configuration rules that only affect 199 * certain applications. 200 * 201 * This is equivalent to FC_PRGNAME in versions of 202 * fontconfig that have that. 203 * 204 * Since: 1.24 205 */ 206 #define PANGO_FC_PRGNAME "prgname" 207 208 /** 209 * PANGO_FC_FONT_FEATURES: 210 * 211 * Fontconfig property that Pango reads from font 212 * patterns to populate list of OpenType features 213 * to be enabled for the font by default. 214 * 215 * The property will have a number of string elements, 216 * each of which is the OpenType feature tag of one feature 217 * to enable. 218 * 219 * This is equivalent to FC_FONT_FEATURES in versions of 220 * fontconfig that have that. 221 * 222 * Since: 1.34 223 */ 224 #define PANGO_FC_FONT_FEATURES "fontfeatures" 225 226 /** 227 * PANGO_FC_FONT_VARIATIONS: 228 * 229 * Fontconfig property that Pango reads from font 230 * patterns to populate list of OpenType font variations 231 * to be used for a font. 232 * 233 * The property will have a string elements, each of which 234 * a comma-separated list of OpenType axis setting of the 235 * form AXIS=VALUE. 236 */ 237 #define PANGO_FC_FONT_VARIATIONS "fontvariations" 238 239 G_END_DECLS 240 241 #endif /* __PANGO_FC_FONT_MAP_H__ */ 242