pango-break.h 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. /* Pango
  2. * pango-break.h:
  3. *
  4. * Copyright (C) 1999 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_BREAK_H__
  22. #define __PANGO_BREAK_H__
  23. #include <glib.h>
  24. G_BEGIN_DECLS
  25. #include <pango/pango-item.h>
  26. /* Logical attributes of a character.
  27. */
  28. /**
  29. * PangoLogAttr:
  30. * @is_line_break: if set, can break line in front of character
  31. * @is_mandatory_break: if set, must break line in front of character
  32. * @is_char_break: if set, can break here when doing character wrapping
  33. * @is_white: is whitespace character
  34. * @is_cursor_position: if set, cursor can appear in front of character.
  35. * i.e. this is a grapheme boundary, or the first character in the text.
  36. * This flag implements Unicode's
  37. * [Grapheme Cluster Boundaries](http://www.unicode.org/reports/tr29/)
  38. * semantics.
  39. * @is_word_start: is first character in a word
  40. * @is_word_end: is first non-word char after a word
  41. * Note that in degenerate cases, you could have both @is_word_start
  42. * and @is_word_end set for some character.
  43. * @is_sentence_boundary: is a sentence boundary.
  44. * There are two ways to divide sentences. The first assigns all
  45. * inter-sentence whitespace/control/format chars to some sentence,
  46. * so all chars are in some sentence; @is_sentence_boundary denotes
  47. * the boundaries there. The second way doesn't assign
  48. * between-sentence spaces, etc. to any sentence, so
  49. * @is_sentence_start/@is_sentence_end mark the boundaries of those sentences.
  50. * @is_sentence_start: is first character in a sentence
  51. * @is_sentence_end: is first char after a sentence.
  52. * Note that in degenerate cases, you could have both @is_sentence_start
  53. * and @is_sentence_end set for some character. (e.g. no space after a
  54. * period, so the next sentence starts right away)
  55. * @backspace_deletes_character: if set, backspace deletes one character
  56. * rather than the entire grapheme cluster. This field is only meaningful
  57. * on grapheme boundaries (where @is_cursor_position is set). In some languages,
  58. * the full grapheme (e.g. letter + diacritics) is considered a unit, while in
  59. * others, each decomposed character in the grapheme is a unit. In the default
  60. * implementation of [func@break], this bit is set on all grapheme boundaries
  61. * except those following Latin, Cyrillic or Greek base characters.
  62. * @is_expandable_space: is a whitespace character that can possibly be
  63. * expanded for justification purposes. (Since: 1.18)
  64. * @is_word_boundary: is a word boundary, as defined by UAX#29.
  65. * More specifically, means that this is not a position in the middle of a word.
  66. * For example, both sides of a punctuation mark are considered word boundaries.
  67. * This flag is particularly useful when selecting text word-by-word. This flag
  68. * implements Unicode's [Word Boundaries](http://www.unicode.org/reports/tr29/)
  69. * semantics. (Since: 1.22)
  70. * @break_inserts_hyphen: when breaking lines before this char, insert a hyphen.
  71. * Since: 1.50
  72. * @break_removes_preceding: when breaking lines before this char, remove the
  73. * preceding char. Since 1.50
  74. *
  75. * The `PangoLogAttr` structure stores information about the attributes of a
  76. * single character.
  77. */
  78. struct _PangoLogAttr
  79. {
  80. guint is_line_break : 1;
  81. guint is_mandatory_break : 1;
  82. guint is_char_break : 1;
  83. guint is_white : 1;
  84. guint is_cursor_position : 1;
  85. guint is_word_start : 1;
  86. guint is_word_end : 1;
  87. guint is_sentence_boundary : 1;
  88. guint is_sentence_start : 1;
  89. guint is_sentence_end : 1;
  90. guint backspace_deletes_character : 1;
  91. guint is_expandable_space : 1;
  92. guint is_word_boundary : 1;
  93. guint break_inserts_hyphen : 1;
  94. guint break_removes_preceding : 1;
  95. guint reserved : 17;
  96. };
  97. PANGO_DEPRECATED_IN_1_44
  98. void pango_break (const char *text,
  99. int length,
  100. PangoAnalysis *analysis,
  101. PangoLogAttr *attrs,
  102. int attrs_len);
  103. PANGO_AVAILABLE_IN_ALL
  104. void pango_get_log_attrs (const char *text,
  105. int length,
  106. int level,
  107. PangoLanguage *language,
  108. PangoLogAttr *attrs,
  109. int attrs_len);
  110. PANGO_AVAILABLE_IN_ALL
  111. void pango_default_break (const char *text,
  112. int length,
  113. PangoAnalysis *analysis,
  114. PangoLogAttr *attrs,
  115. int attrs_len);
  116. PANGO_AVAILABLE_IN_1_44
  117. void pango_tailor_break (const char *text,
  118. int length,
  119. PangoAnalysis *analysis,
  120. int offset,
  121. PangoLogAttr *attrs,
  122. int attrs_len);
  123. PANGO_AVAILABLE_IN_1_50
  124. void pango_attr_break (const char *text,
  125. int length,
  126. PangoAttrList *attr_list,
  127. int offset,
  128. PangoLogAttr *attrs,
  129. int attrs_len);
  130. G_END_DECLS
  131. #endif /* __PANGO_BREAK_H__ */