PageRenderTime 37ms CodeModel.GetById 14ms app.highlight 19ms RepoModel.GetById 1ms app.codeStats 1ms

/binding/pango/pbreak.d

http://github.com/wilkie/djehuty
D | 88 lines | 38 code | 16 blank | 34 comment | 0 complexity | 8ec98463456e22f517e4491e8348967f MD5 | raw file
 1/*
 2 * pbreak.d
 3 *
 4 * This file holds bindings to pango's pango-pbreak.h.
 5 *
 6 * Author: Dave Wilkinson
 7 *
 8 */
 9
10module binding.pango.pbreak;
11
12import binding.pango.types;
13import binding.pango.item;
14
15extern(C):
16
17struct _PangoLogAttr
18{
19  guint is_line_break;      /* Can break line in front of character */
20
21  guint is_mandatory_break; /* Must break line in front of character */
22
23  guint is_char_break;      /* Can break here when doing char wrap */
24
25  guint is_white;           /* Whitespace character */
26
27  /* cursor can appear in front of character (i.e. this is a grapheme
28   * boundary, or the first character in the text)
29   */
30  guint is_cursor_position;
31
32  /* Note that in degenerate cases, you could have both start/end set on
33   * some text, most likely for sentences (e.g. no space after a period, so
34   * the next sentence starts right away)
35   */
36
37  guint is_word_start;      /* first character in a word */
38  guint is_word_end;      /* is first non-word char after a word */
39
40  /* There are two ways to divide sentences. The first assigns all
41   * intersentence whitespace/control/format chars to some sentence,
42   * so all chars are in some sentence; is_sentence_boundary denotes
43   * the boundaries there. The second way doesn't assign
44   * between-sentence spaces, etc. to any sentence, so
45   * is_sentence_start/is_sentence_end mark the boundaries of those
46   * sentences.
47   */
48  guint is_sentence_boundary;
49  guint is_sentence_start;  /* first character in a sentence */
50  guint is_sentence_end;    /* first non-sentence char after a sentence */
51
52  /* if set, backspace deletes one character rather than
53   * the entire grapheme cluster
54   */
55  guint backspace_deletes_character;
56};
57
58/* Determine information about cluster/word/line breaks in a string
59 * of Unicode text.
60 */
61void pango_break (gchar   *text,
62		  int            length,
63		  PangoAnalysis *analysis,
64		  PangoLogAttr  *attrs,
65		  int            attrs_len);
66
67void pango_find_paragraph_boundary (gchar *text,
68				    gint         length,
69				    gint        *paragraph_delimiter_index,
70				    gint        *next_paragraph_start);
71
72void pango_get_log_attrs (char    *text,
73			  int            length,
74			  int            level,
75			  PangoLanguage *language,
76			  PangoLogAttr  *log_attrs,
77			  int            attrs_len);
78
79/* This is the default break algorithm, used if no language
80 * engine overrides it. Normally you should use pango_break()
81 * instead; this function is mostly useful for chaining up
82 * from a language engine override.
83 */
84void pango_default_break (gchar   *text,
85			  int            length,
86			  PangoAnalysis *analysis,
87			  PangoLogAttr  *attrs,
88			  int            attrs_len);