pangofc-fontmap.h 7.6 KB

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