Git init
[external/pango1.0.git] / pango / pango-break.h
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
27 G_BEGIN_DECLS
28
29 #include <pango/pango-item.h>
30
31 /* Logical attributes of a character.
32  */
33 struct _PangoLogAttr
34 {
35   guint is_line_break : 1;      /* Can break line in front of character */
36
37   guint is_mandatory_break : 1; /* Must break line in front of character */
38
39   guint is_char_break : 1;      /* Can break here when doing char wrap */
40
41   guint is_white : 1;           /* Whitespace character */
42
43   /* Cursor can appear in front of character (i.e. this is a grapheme
44    * boundary, or the first character in the text).
45    */
46   guint is_cursor_position : 1;
47
48   /* Note that in degenerate cases, you could have both start/end set on
49    * some text, most likely for sentences (e.g. no space after a period, so
50    * the next sentence starts right away).
51    */
52
53   guint is_word_start : 1;      /* first character in a word */
54   guint is_word_end   : 1;      /* is first non-word char after a word */
55
56   /* There are two ways to divide sentences. The first assigns all
57    * intersentence whitespace/control/format chars to some sentence,
58    * so all chars are in some sentence; is_sentence_boundary denotes
59    * the boundaries there. The second way doesn't assign
60    * between-sentence spaces, etc. to any sentence, so
61    * is_sentence_start/is_sentence_end mark the boundaries of those
62    * sentences.
63    */
64   guint is_sentence_boundary : 1;
65   guint is_sentence_start : 1;  /* first character in a sentence */
66   guint is_sentence_end : 1;    /* first non-sentence char after a sentence */
67
68   /* If set, backspace deletes one character rather than
69    * the entire grapheme cluster.
70    */
71   guint backspace_deletes_character : 1;
72
73   /* Only few space variants (U+0020 and U+00A0) have variable
74    * width during justification.
75    */
76   guint is_expandable_space : 1;
77
78   /* Word boundary as defined by UAX#29 */
79   guint is_word_boundary : 1;   /* is NOT in the middle of a word */
80 };
81
82 /* Determine information about cluster/word/line breaks in a string
83  * of Unicode text.
84  */
85 void pango_break (const gchar   *text,
86                   int            length,
87                   PangoAnalysis *analysis,
88                   PangoLogAttr  *attrs,
89                   int            attrs_len);
90
91 void pango_find_paragraph_boundary (const gchar *text,
92                                     gint         length,
93                                     gint        *paragraph_delimiter_index,
94                                     gint        *next_paragraph_start);
95
96 void pango_get_log_attrs (const char    *text,
97                           int            length,
98                           int            level,
99                           PangoLanguage *language,
100                           PangoLogAttr  *log_attrs,
101                           int            attrs_len);
102
103 #ifdef PANGO_ENABLE_ENGINE
104
105 /* This is the default break algorithm, used if no language
106  * engine overrides it. Normally you should use pango_break()
107  * instead; this function is mostly useful for chaining up
108  * from a language engine override.
109  */
110 void pango_default_break (const gchar   *text,
111                           int            length,
112                           PangoAnalysis *analysis,
113                           PangoLogAttr  *attrs,
114                           int            attrs_len);
115
116 #endif /* PANGO_ENABLE_ENGINE */
117
118 G_END_DECLS
119
120 #endif /* __PANGO_BREAK_H__ */