pango-break.inc 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  1. // included by pango.pp
  2. {$IFDEF read_interface_types}
  3. { Logical attributes of a character.
  4. }
  5. { Can break line in front of character }
  6. { Must break line in front of character }
  7. { Can break here when doing char wrap }
  8. { Whitespace character }
  9. { cursor can appear in front of character (i.e. this is a grapheme
  10. boundary, or the first character in the text)
  11. }
  12. { Note that in degenerate cases, you could have both start/theEnd set on
  13. some text, most likely for sentences (e.g. no space after a period, so
  14. the next sentence starts right away)
  15. }
  16. { first character in a word }
  17. { is first non-word char after a word }
  18. { There are two ways to divide sentences. The first assigns all
  19. intersentence whitespace/control/format chars to some sentence,
  20. so all chars are in some sentence; is_sentence_boundary denotes
  21. the boundaries there. The second way doesn't assign
  22. between-sentence spaces, etc. to any sentence, so
  23. is_sentence_start/is_sentence_end mark the boundaries of those
  24. sentences.
  25. }
  26. { first character in a sentence }
  27. { first non-sentence char after a sentence }
  28. PPangoLogAttr = ^TPangoLogAttr;
  29. TPangoLogAttr = record
  30. flag0 : word;
  31. end;
  32. {$ENDIF read_interface_types}
  33. //------------------------------------------------------------------------------
  34. {$IFDEF read_interface_functions}
  35. const
  36. bm_TPangoLogAttr_is_line_break = $1;
  37. bp_TPangoLogAttr_is_line_break = 0;
  38. bm_TPangoLogAttr_is_mandatory_break = $2;
  39. bp_TPangoLogAttr_is_mandatory_break = 1;
  40. bm_TPangoLogAttr_is_char_break = $4;
  41. bp_TPangoLogAttr_is_char_break = 2;
  42. bm_TPangoLogAttr_is_white = $8;
  43. bp_TPangoLogAttr_is_white = 3;
  44. bm_TPangoLogAttr_is_cursor_position = $10;
  45. bp_TPangoLogAttr_is_cursor_position = 4;
  46. bm_TPangoLogAttr_is_word_start = $20;
  47. bp_TPangoLogAttr_is_word_start = 5;
  48. bm_TPangoLogAttr_is_word_end = $40;
  49. bp_TPangoLogAttr_is_word_end = 6;
  50. bm_TPangoLogAttr_is_sentence_boundary = $80;
  51. bp_TPangoLogAttr_is_sentence_boundary = 7;
  52. bm_TPangoLogAttr_is_sentence_start = $100;
  53. bp_TPangoLogAttr_is_sentence_start = 8;
  54. bm_TPangoLogAttr_is_sentence_end = $200;
  55. bp_TPangoLogAttr_is_sentence_end = 9;
  56. function is_line_break(var a : TPangoLogAttr) : guint;
  57. procedure set_is_line_break(var a : TPangoLogAttr; __is_line_break : guint);
  58. function is_mandatory_break(var a : TPangoLogAttr) : guint;
  59. procedure set_is_mandatory_break(var a : TPangoLogAttr; __is_mandatory_break : guint);
  60. function is_char_break(var a : TPangoLogAttr) : guint;
  61. procedure set_is_char_break(var a : TPangoLogAttr; __is_char_break : guint);
  62. function is_white(var a : TPangoLogAttr) : guint;
  63. procedure set_is_white(var a : TPangoLogAttr; __is_white : guint);
  64. function is_cursor_position(var a : TPangoLogAttr) : guint;
  65. procedure set_is_cursor_position(var a : TPangoLogAttr; __is_cursor_position : guint);
  66. function is_word_start(var a : TPangoLogAttr) : guint;
  67. procedure set_is_word_start(var a : TPangoLogAttr; __is_word_start : guint);
  68. function is_word_end(var a : TPangoLogAttr) : guint;
  69. procedure set_is_word_end(var a : TPangoLogAttr; __is_word_end : guint);
  70. function is_sentence_boundary(var a : TPangoLogAttr) : guint;
  71. procedure set_is_sentence_boundary(var a : TPangoLogAttr; __is_sentence_boundary : guint);
  72. function is_sentence_start(var a : TPangoLogAttr) : guint;
  73. procedure set_is_sentence_start(var a : TPangoLogAttr; __is_sentence_start : guint);
  74. function is_sentence_end(var a : TPangoLogAttr) : guint;
  75. procedure set_is_sentence_end(var a : TPangoLogAttr; __is_sentence_end : guint);
  76. { Determine information about cluster/word/line breaks in a string
  77. of Unicode text.
  78. }
  79. procedure pango_break(text:Pgchar; length:longint; analysis:PPangoAnalysis; attrs:PPangoLogAttr; attrs_len:longint); cdecl; external pangolib;
  80. procedure pango_find_paragraph_boundary(text:Pgchar; length:gint; paragraph_delimiter_index:Pgint; next_paragraph_start:Pgint); cdecl; external pangolib;
  81. procedure pango_get_log_attrs(text:Pchar; length:longint; level:longint; language:PPangoLanguage; log_attrs:PPangoLogAttr;
  82. attrs_len:longint); cdecl; external pangolib;
  83. {$ifdef PANGO_ENABLE_ENGINE}
  84. { This is the default break algorithm, used if no language
  85. engine overrides it. Normally you should use pango_break()
  86. instead; this function is mostly useful for chaining up
  87. from a language engine override.
  88. }
  89. procedure pango_default_break(text:Pgchar; length:longint; analysis:PPangoAnalysis; attrs:PPangoLogAttr; attrs_len:longint); cdecl; external pangolib;
  90. {$endif PANGO_ENABLE_ENGINE}
  91. {$endif read_interface_functions}
  92. //------------------------------------------------------------------------------
  93. {$IFDEF read_implementation}
  94. function is_line_break(var a : TPangoLogAttr) : guint;
  95. begin
  96. is_line_break:=(a.flag0 and bm_TPangoLogAttr_is_line_break) shr bp_TPangoLogAttr_is_line_break;
  97. end;
  98. procedure set_is_line_break(var a : TPangoLogAttr; __is_line_break : guint);
  99. begin
  100. a.flag0:=a.flag0 or ((__is_line_break shl bp_TPangoLogAttr_is_line_break) and bm_TPangoLogAttr_is_line_break);
  101. end;
  102. function is_mandatory_break(var a : TPangoLogAttr) : guint;
  103. begin
  104. is_mandatory_break:=(a.flag0 and bm_TPangoLogAttr_is_mandatory_break) shr bp_TPangoLogAttr_is_mandatory_break;
  105. end;
  106. procedure set_is_mandatory_break(var a : TPangoLogAttr; __is_mandatory_break : guint);
  107. begin
  108. a.flag0:=a.flag0 or ((__is_mandatory_break shl bp_TPangoLogAttr_is_mandatory_break) and bm_TPangoLogAttr_is_mandatory_break);
  109. end;
  110. function is_char_break(var a : TPangoLogAttr) : guint;
  111. begin
  112. is_char_break:=(a.flag0 and bm_TPangoLogAttr_is_char_break) shr bp_TPangoLogAttr_is_char_break;
  113. end;
  114. procedure set_is_char_break(var a : TPangoLogAttr; __is_char_break : guint);
  115. begin
  116. a.flag0:=a.flag0 or ((__is_char_break shl bp_TPangoLogAttr_is_char_break) and bm_TPangoLogAttr_is_char_break);
  117. end;
  118. function is_white(var a : TPangoLogAttr) : guint;
  119. begin
  120. is_white:=(a.flag0 and bm_TPangoLogAttr_is_white) shr bp_TPangoLogAttr_is_white;
  121. end;
  122. procedure set_is_white(var a : TPangoLogAttr; __is_white : guint);
  123. begin
  124. a.flag0:=a.flag0 or ((__is_white shl bp_TPangoLogAttr_is_white) and bm_TPangoLogAttr_is_white);
  125. end;
  126. function is_cursor_position(var a : TPangoLogAttr) : guint;
  127. begin
  128. is_cursor_position:=(a.flag0 and bm_TPangoLogAttr_is_cursor_position) shr bp_TPangoLogAttr_is_cursor_position;
  129. end;
  130. procedure set_is_cursor_position(var a : TPangoLogAttr; __is_cursor_position : guint);
  131. begin
  132. a.flag0:=a.flag0 or ((__is_cursor_position shl bp_TPangoLogAttr_is_cursor_position) and bm_TPangoLogAttr_is_cursor_position);
  133. end;
  134. function is_word_start(var a : TPangoLogAttr) : guint;
  135. begin
  136. is_word_start:=(a.flag0 and bm_TPangoLogAttr_is_word_start) shr bp_TPangoLogAttr_is_word_start;
  137. end;
  138. procedure set_is_word_start(var a : TPangoLogAttr; __is_word_start : guint);
  139. begin
  140. a.flag0:=a.flag0 or ((__is_word_start shl bp_TPangoLogAttr_is_word_start) and bm_TPangoLogAttr_is_word_start);
  141. end;
  142. function is_word_end(var a : TPangoLogAttr) : guint;
  143. begin
  144. is_word_end:=(a.flag0 and bm_TPangoLogAttr_is_word_end) shr bp_TPangoLogAttr_is_word_end;
  145. end;
  146. procedure set_is_word_end(var a : TPangoLogAttr; __is_word_end : guint);
  147. begin
  148. a.flag0:=a.flag0 or ((__is_word_end shl bp_TPangoLogAttr_is_word_end) and bm_TPangoLogAttr_is_word_end);
  149. end;
  150. function is_sentence_boundary(var a : TPangoLogAttr) : guint;
  151. begin
  152. is_sentence_boundary:=(a.flag0 and bm_TPangoLogAttr_is_sentence_boundary) shr bp_TPangoLogAttr_is_sentence_boundary;
  153. end;
  154. procedure set_is_sentence_boundary(var a : TPangoLogAttr; __is_sentence_boundary : guint);
  155. begin
  156. a.flag0:=a.flag0 or ((__is_sentence_boundary shl bp_TPangoLogAttr_is_sentence_boundary) and bm_TPangoLogAttr_is_sentence_boundary);
  157. end;
  158. function is_sentence_start(var a : TPangoLogAttr) : guint;
  159. begin
  160. is_sentence_start:=(a.flag0 and bm_TPangoLogAttr_is_sentence_start) shr bp_TPangoLogAttr_is_sentence_start;
  161. end;
  162. procedure set_is_sentence_start(var a : TPangoLogAttr; __is_sentence_start : guint);
  163. begin
  164. a.flag0:=a.flag0 or ((__is_sentence_start shl bp_TPangoLogAttr_is_sentence_start) and bm_TPangoLogAttr_is_sentence_start);
  165. end;
  166. function is_sentence_end(var a : TPangoLogAttr) : guint;
  167. begin
  168. is_sentence_end:=(a.flag0 and bm_TPangoLogAttr_is_sentence_end) shr bp_TPangoLogAttr_is_sentence_end;
  169. end;
  170. procedure set_is_sentence_end(var a : TPangoLogAttr; __is_sentence_end : guint);
  171. begin
  172. a.flag0:=a.flag0 or ((__is_sentence_end shl bp_TPangoLogAttr_is_sentence_end) and bm_TPangoLogAttr_is_sentence_end);
  173. end;
  174. {$ENDIF read_implementation}