fribidi.h 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. /* FriBidi
  2. * fribidi.h - Unicode bidirectional and Arabic joining/shaping algorithms
  3. *
  4. * Author:
  5. * Behdad Esfahbod, 2004
  6. *
  7. * Copyright (C) 2004 Sharif FarsiWeb, Inc
  8. *
  9. * This library is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU Lesser General Public
  11. * License as published by the Free Software Foundation; either
  12. * version 2.1 of the License, or (at your option) any later version.
  13. *
  14. * This library is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  17. * Lesser General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU Lesser General Public License
  20. * along with this library, in a file named COPYING; if not, write to the
  21. * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  22. * Boston, MA 02110-1301, USA
  23. *
  24. * For licensing issues, contact <fribidi.license@gmail.com>.
  25. */
  26. #ifndef _FRIBIDI_H
  27. #define _FRIBIDI_H
  28. #include "fribidi-common.h"
  29. #include "fribidi-unicode.h"
  30. #include "fribidi-types.h"
  31. #include "fribidi-flags.h"
  32. #include "fribidi-bidi-types.h"
  33. #include "fribidi-bidi.h"
  34. #include "fribidi-joining-types.h"
  35. #include "fribidi-joining.h"
  36. #include "fribidi-mirroring.h"
  37. #include "fribidi-brackets.h"
  38. #include "fribidi-arabic.h"
  39. #include "fribidi-shape.h"
  40. #include "fribidi-char-sets.h"
  41. #include "fribidi-begindecls.h"
  42. /* fribidi_remove_bidi_marks - remove bidi marks out of an string
  43. *
  44. * This function removes the bidi and boundary-neutral marks out of an string
  45. * and the accompanying lists. It implements rule X9 of the Unicode
  46. * Bidirectional Algorithm available at
  47. * http://www.unicode.org/reports/tr9/#X9, with the exception that it removes
  48. * U+200E LEFT-TO-RIGHT MARK and U+200F RIGHT-TO-LEFT MARK too.
  49. *
  50. * If any of the input lists are NULL, the list is skipped. If str is the
  51. * visual string, then positions_to_this is positions_L_to_V and
  52. * position_from_this_list is positions_V_to_L; if str is the logical
  53. * string, the other way. Moreover, the position maps should be filled with
  54. * valid entries.
  55. *
  56. * A position map pointing to a removed character is filled with \-1. By the
  57. * way, you should not use embedding_levels if str is visual string.
  58. *
  59. * For best results this function should be run on a whole paragraph, not
  60. * lines; but feel free to do otherwise if you know what you are doing.
  61. *
  62. * Returns: New length of the string, or \-1 if an error occurred (memory
  63. * allocation failure most probably).
  64. */
  65. FRIBIDI_ENTRY FriBidiStrIndex
  66. fribidi_remove_bidi_marks (
  67. FriBidiChar *str, /* input string to clean */
  68. const FriBidiStrIndex len, /* input string length */
  69. FriBidiStrIndex *positions_to_this, /* list mapping positions to the
  70. order used in str */
  71. FriBidiStrIndex *position_from_this_list, /* list mapping positions from the
  72. order used in str */
  73. FriBidiLevel *embedding_levels /* list of embedding levels */
  74. );
  75. /* fribidi_log2vis - get visual string
  76. *
  77. * This function converts the logical input string to the visual output
  78. * strings as specified by the Unicode Bidirectional Algorithm. As a side
  79. * effect it also generates mapping lists between the two strings, and the
  80. * list of embedding levels as defined by the algorithm.
  81. *
  82. * If NULL is passed as any of the the lists, the list is ignored and not
  83. * filled.
  84. *
  85. * Note that this function handles one-line paragraphs. For multi-
  86. * paragraph texts it is necessary to first split the text into
  87. * separate paragraphs and then carry over the resolved pbase_dir
  88. * between the subsequent invocations.
  89. *
  90. * Returns: Maximum level found plus one, or zero if any error occurred
  91. * (memory allocation failure most probably).
  92. */
  93. FRIBIDI_ENTRY FriBidiLevel fribidi_log2vis (
  94. const FriBidiChar *str, /* input logical string */
  95. const FriBidiStrIndex len, /* input string length */
  96. FriBidiParType *pbase_dir, /* requested and resolved paragraph
  97. * base direction */
  98. FriBidiChar *visual_str, /* output visual string */
  99. FriBidiStrIndex *positions_L_to_V, /* output mapping from logical to
  100. * visual string positions */
  101. FriBidiStrIndex *positions_V_to_L, /* output mapping from visual string
  102. * back to the logical string
  103. * positions */
  104. FriBidiLevel *embedding_levels /* output list of embedding levels */
  105. );
  106. #ifdef FRIBIDI_NO_DEPRECATED
  107. #else
  108. # include "fribidi-deprecated.h"
  109. #endif /* !FRIBIDI_NO_DEPRECATED */
  110. /* An string containing the version information of the library. */
  111. FRIBIDI_ENTRY const char *fribidi_version_info;
  112. #include "fribidi-enddecls.h"
  113. #endif /* !_FRIBIDI_H */
  114. /* Editor directions:
  115. * vim:textwidth=78:tabstop=8:shiftwidth=2:autoindent:cindent
  116. */