Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.
 
 
 
 
 
 

121 rader
3.8 KiB

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