pango-utils.h 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  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. PANGO_DEPRECATED
  46. gboolean pango_parse_enum (GType type,
  47. const char *str,
  48. int *value,
  49. gboolean warn,
  50. char **possible_values);
  51. /* Functions for parsing textual representations
  52. * of PangoFontDescription fields. They return TRUE if the input string
  53. * contains a valid value, which then has been assigned to the corresponding
  54. * field in the PangoFontDescription. If the warn parameter is TRUE,
  55. * a warning is printed (with g_warning) if the string does not
  56. * contain a valid value.
  57. */
  58. PANGO_AVAILABLE_IN_ALL
  59. gboolean pango_parse_style (const char *str,
  60. PangoStyle *style,
  61. gboolean warn);
  62. PANGO_AVAILABLE_IN_ALL
  63. gboolean pango_parse_variant (const char *str,
  64. PangoVariant *variant,
  65. gboolean warn);
  66. PANGO_AVAILABLE_IN_ALL
  67. gboolean pango_parse_weight (const char *str,
  68. PangoWeight *weight,
  69. gboolean warn);
  70. PANGO_AVAILABLE_IN_ALL
  71. gboolean pango_parse_stretch (const char *str,
  72. PangoStretch *stretch,
  73. gboolean warn);
  74. /* Hint line position and thickness.
  75. */
  76. PANGO_AVAILABLE_IN_1_12
  77. void pango_quantize_line_geometry (int *thickness,
  78. int *position);
  79. /* A routine from fribidi that we either wrap or provide ourselves.
  80. */
  81. PANGO_AVAILABLE_IN_1_4
  82. guint8 * pango_log2vis_get_embedding_levels (const gchar *text,
  83. int length,
  84. PangoDirection *pbase_dir);
  85. /* Unicode characters that are zero-width and should not be rendered
  86. * normally.
  87. */
  88. PANGO_AVAILABLE_IN_1_10
  89. gboolean pango_is_zero_width (gunichar ch) G_GNUC_CONST;
  90. PANGO_AVAILABLE_IN_ALL
  91. void pango_find_paragraph_boundary (const char *text,
  92. int length,
  93. int *paragraph_delimiter_index,
  94. int *next_paragraph_start);
  95. /* Pango version checking */
  96. /* Encode a Pango version as an integer */
  97. /**
  98. * PANGO_VERSION_ENCODE:
  99. * @major: the major component of the version number
  100. * @minor: the minor component of the version number
  101. * @micro: the micro component of the version number
  102. *
  103. * This macro encodes the given Pango version into an integer. The numbers
  104. * returned by %PANGO_VERSION and pango_version() are encoded using this macro.
  105. * Two encoded version numbers can be compared as integers.
  106. */
  107. #define PANGO_VERSION_ENCODE(major, minor, micro) ( \
  108. ((major) * 10000) \
  109. + ((minor) * 100) \
  110. + ((micro) * 1))
  111. /* Encoded version of Pango at compile-time */
  112. /**
  113. * PANGO_VERSION:
  114. *
  115. * The version of Pango available at compile-time, encoded using PANGO_VERSION_ENCODE().
  116. */
  117. /**
  118. * PANGO_VERSION_STRING:
  119. *
  120. * A string literal containing the version of Pango available at compile-time.
  121. */
  122. /**
  123. * PANGO_VERSION_MAJOR:
  124. *
  125. * The major component of the version of Pango available at compile-time.
  126. */
  127. /**
  128. * PANGO_VERSION_MINOR:
  129. *
  130. * The minor component of the version of Pango available at compile-time.
  131. */
  132. /**
  133. * PANGO_VERSION_MICRO:
  134. *
  135. * The micro component of the version of Pango available at compile-time.
  136. */
  137. #define PANGO_VERSION PANGO_VERSION_ENCODE( \
  138. PANGO_VERSION_MAJOR, \
  139. PANGO_VERSION_MINOR, \
  140. PANGO_VERSION_MICRO)
  141. /* Check that compile-time Pango is as new as required */
  142. /**
  143. * PANGO_VERSION_CHECK:
  144. * @major: the major component of the version number
  145. * @minor: the minor component of the version number
  146. * @micro: the micro component of the version number
  147. *
  148. * Checks that the version of Pango available at compile-time is not older than
  149. * the provided version number.
  150. */
  151. #define PANGO_VERSION_CHECK(major,minor,micro) \
  152. (PANGO_VERSION >= PANGO_VERSION_ENCODE(major,minor,micro))
  153. /* Return encoded version of Pango at run-time */
  154. PANGO_AVAILABLE_IN_1_16
  155. int pango_version (void) G_GNUC_CONST;
  156. /* Return run-time Pango version as an string */
  157. PANGO_AVAILABLE_IN_1_16
  158. const char * pango_version_string (void) G_GNUC_CONST;
  159. /* Check that run-time Pango is as new as required */
  160. PANGO_AVAILABLE_IN_1_16
  161. const char * pango_version_check (int required_major,
  162. int required_minor,
  163. int required_micro) G_GNUC_CONST;
  164. G_END_DECLS
  165. #endif /* __PANGO_UTILS_H__ */