pango-utils.h 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  1. /* Pango
  2. * pango-utils.c: Utilities for internal functions and modules
  3. *
  4. * Copyright (C) 2000 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_UTILS_H__
  22. #define __PANGO_UTILS_H__
  23. #include <stdio.h>
  24. #include <glib.h>
  25. #include <pango/pango-font.h>
  26. G_BEGIN_DECLS
  27. PANGO_DEPRECATED
  28. char ** pango_split_file_list (const char *str);
  29. PANGO_DEPRECATED
  30. char *pango_trim_string (const char *str);
  31. PANGO_DEPRECATED
  32. gint pango_read_line (FILE *stream,
  33. GString *str);
  34. PANGO_DEPRECATED
  35. gboolean pango_skip_space (const char **pos);
  36. PANGO_DEPRECATED
  37. gboolean pango_scan_word (const char **pos,
  38. GString *out);
  39. PANGO_DEPRECATED
  40. gboolean pango_scan_string (const char **pos,
  41. GString *out);
  42. PANGO_DEPRECATED
  43. gboolean pango_scan_int (const char **pos,
  44. int *out);
  45. #ifdef PANGO_ENABLE_BACKEND
  46. PANGO_DEPRECATED_IN_1_38
  47. char * pango_config_key_get_system (const char *key);
  48. PANGO_DEPRECATED_IN_1_38
  49. char * pango_config_key_get (const char *key);
  50. PANGO_DEPRECATED_IN_1_32
  51. void pango_lookup_aliases (const char *fontname,
  52. char ***families,
  53. int *n_families);
  54. #endif /* PANGO_ENABLE_BACKEND */
  55. PANGO_DEPRECATED
  56. gboolean pango_parse_enum (GType type,
  57. const char *str,
  58. int *value,
  59. gboolean warn,
  60. char **possible_values);
  61. /* Functions for parsing textual representations
  62. * of PangoFontDescription fields. They return TRUE if the input string
  63. * contains a valid value, which then has been assigned to the corresponding
  64. * field in the PangoFontDescription. If the warn parameter is TRUE,
  65. * a warning is printed (with g_warning) if the string does not
  66. * contain a valid value.
  67. */
  68. PANGO_AVAILABLE_IN_ALL
  69. gboolean pango_parse_style (const char *str,
  70. PangoStyle *style,
  71. gboolean warn);
  72. PANGO_AVAILABLE_IN_ALL
  73. gboolean pango_parse_variant (const char *str,
  74. PangoVariant *variant,
  75. gboolean warn);
  76. PANGO_AVAILABLE_IN_ALL
  77. gboolean pango_parse_weight (const char *str,
  78. PangoWeight *weight,
  79. gboolean warn);
  80. PANGO_AVAILABLE_IN_ALL
  81. gboolean pango_parse_stretch (const char *str,
  82. PangoStretch *stretch,
  83. gboolean warn);
  84. #ifdef PANGO_ENABLE_BACKEND
  85. /* On Unix, return the name of the "pango" subdirectory of SYSCONFDIR
  86. * (which is set at compile time). On Win32, return the Pango
  87. * installation directory (which is set at installation time, and
  88. * stored in the registry). The returned string should not be
  89. * g_free'd.
  90. */
  91. PANGO_DEPRECATED
  92. const char * pango_get_sysconf_subdirectory (void) G_GNUC_PURE;
  93. /* Ditto for LIBDIR/pango. On Win32, use the same Pango
  94. * installation directory. This returned string should not be
  95. * g_free'd either.
  96. */
  97. PANGO_DEPRECATED
  98. const char * pango_get_lib_subdirectory (void) G_GNUC_PURE;
  99. #endif /* PANGO_ENABLE_BACKEND */
  100. /* Hint line position and thickness.
  101. */
  102. PANGO_AVAILABLE_IN_1_12
  103. void pango_quantize_line_geometry (int *thickness,
  104. int *position);
  105. /* A routine from fribidi that we either wrap or provide ourselves.
  106. */
  107. PANGO_AVAILABLE_IN_1_4
  108. guint8 * pango_log2vis_get_embedding_levels (const gchar *text,
  109. int length,
  110. PangoDirection *pbase_dir);
  111. /* Unicode characters that are zero-width and should not be rendered
  112. * normally.
  113. */
  114. PANGO_AVAILABLE_IN_1_10
  115. gboolean pango_is_zero_width (gunichar ch) G_GNUC_CONST;
  116. /* Pango version checking */
  117. /* Encode a Pango version as an integer */
  118. /**
  119. * PANGO_VERSION_ENCODE:
  120. * @major: the major component of the version number
  121. * @minor: the minor component of the version number
  122. * @micro: the micro component of the version number
  123. *
  124. * This macro encodes the given Pango version into an integer. The numbers
  125. * returned by %PANGO_VERSION and pango_version() are encoded using this macro.
  126. * Two encoded version numbers can be compared as integers.
  127. */
  128. #define PANGO_VERSION_ENCODE(major, minor, micro) ( \
  129. ((major) * 10000) \
  130. + ((minor) * 100) \
  131. + ((micro) * 1))
  132. /* Encoded version of Pango at compile-time */
  133. /**
  134. * PANGO_VERSION:
  135. *
  136. * The version of Pango available at compile-time, encoded using PANGO_VERSION_ENCODE().
  137. */
  138. /**
  139. * PANGO_VERSION_STRING:
  140. *
  141. * A string literal containing the version of Pango available at compile-time.
  142. */
  143. /**
  144. * PANGO_VERSION_MAJOR:
  145. *
  146. * The major component of the version of Pango available at compile-time.
  147. */
  148. /**
  149. * PANGO_VERSION_MINOR:
  150. *
  151. * The minor component of the version of Pango available at compile-time.
  152. */
  153. /**
  154. * PANGO_VERSION_MICRO:
  155. *
  156. * The micro component of the version of Pango available at compile-time.
  157. */
  158. #define PANGO_VERSION PANGO_VERSION_ENCODE( \
  159. PANGO_VERSION_MAJOR, \
  160. PANGO_VERSION_MINOR, \
  161. PANGO_VERSION_MICRO)
  162. /* Check that compile-time Pango is as new as required */
  163. /**
  164. * PANGO_VERSION_CHECK:
  165. * @major: the major component of the version number
  166. * @minor: the minor component of the version number
  167. * @micro: the micro component of the version number
  168. *
  169. * Checks that the version of Pango available at compile-time is not older than
  170. * the provided version number.
  171. */
  172. #define PANGO_VERSION_CHECK(major,minor,micro) \
  173. (PANGO_VERSION >= PANGO_VERSION_ENCODE(major,minor,micro))
  174. /* Return encoded version of Pango at run-time */
  175. PANGO_AVAILABLE_IN_1_16
  176. int pango_version (void) G_GNUC_CONST;
  177. /* Return run-time Pango version as an string */
  178. PANGO_AVAILABLE_IN_1_16
  179. const char * pango_version_string (void) G_GNUC_CONST;
  180. /* Check that run-time Pango is as new as required */
  181. PANGO_AVAILABLE_IN_1_16
  182. const char * pango_version_check (int required_major,
  183. int required_minor,
  184. int required_micro) G_GNUC_CONST;
  185. G_END_DECLS
  186. #endif /* __PANGO_UTILS_H__ */