4 * Copyright (C) 1999 Red Hat Software
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.
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.
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.
22 #ifndef __PANGO_BREAK_H__
23 #define __PANGO_BREAK_H__
29 #include <pango/pango-item.h>
31 /* Logical attributes of a character.
35 guint is_line_break : 1; /* Can break line in front of character */
37 guint is_mandatory_break : 1; /* Must break line in front of character */
39 guint is_char_break : 1; /* Can break here when doing char wrap */
41 guint is_white : 1; /* Whitespace character */
43 /* Cursor can appear in front of character (i.e. this is a grapheme
44 * boundary, or the first character in the text).
46 guint is_cursor_position : 1;
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).
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 */
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
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 */
68 /* If set, backspace deletes one character rather than
69 * the entire grapheme cluster.
71 guint backspace_deletes_character : 1;
73 /* Only few space variants (U+0020 and U+00A0) have variable
74 * width during justification.
76 guint is_expandable_space : 1;
78 /* Word boundary as defined by UAX#29 */
79 guint is_word_boundary : 1; /* is NOT in the middle of a word */
82 /* Determine information about cluster/word/line breaks in a string
85 void pango_break (const gchar *text,
87 PangoAnalysis *analysis,
91 void pango_find_paragraph_boundary (const gchar *text,
93 gint *paragraph_delimiter_index,
94 gint *next_paragraph_start);
96 void pango_get_log_attrs (const char *text,
99 PangoLanguage *language,
100 PangoLogAttr *log_attrs,
103 #ifdef PANGO_ENABLE_ENGINE
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.
110 void pango_default_break (const gchar *text,
112 PangoAnalysis *analysis,
116 #endif /* PANGO_ENABLE_ENGINE */
120 #endif /* __PANGO_BREAK_H__ */