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