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

source code of include/pango-1.0/pango/pango-break.h