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 0 : {
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 :
74 : /* Determine information about cluster/word/line breaks in a string
75 : * of Unicode text.
76 : */
77 : void pango_break (const gchar *text,
78 : int length,
79 : PangoAnalysis *analysis,
80 : PangoLogAttr *attrs,
81 : int attrs_len);
82 :
83 : void pango_find_paragraph_boundary (const gchar *text,
84 : gint length,
85 : gint *paragraph_delimiter_index,
86 : gint *next_paragraph_start);
87 :
88 : void pango_get_log_attrs (const char *text,
89 : int length,
90 : int level,
91 : PangoLanguage *language,
92 : PangoLogAttr *log_attrs,
93 : int attrs_len);
94 :
95 : #ifdef PANGO_ENABLE_ENGINE
96 :
97 : /* This is the default break algorithm, used if no language
98 : * engine overrides it. Normally you should use pango_break()
99 : * instead; this function is mostly useful for chaining up
100 : * from a language engine override.
101 : */
102 : void pango_default_break (const gchar *text,
103 : int length,
104 : PangoAnalysis *analysis,
105 : PangoLogAttr *attrs,
106 : int attrs_len);
107 :
108 : #endif /* PANGO_ENABLE_ENGINE */
109 :
110 : G_END_DECLS
111 :
112 : #endif /* __PANGO_BREAK_H__ */
|