fribidi-brackets.h 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. /* fribidi-brackets.h - get bracket character property
  2. *
  3. * Copyright (C) 2004 Sharif FarsiWeb, Inc
  4. * Copyright (C) 2001, 2002, 2004 Behdad Esfahbod
  5. * Copyright (C) 1999, 2000, 2017 Dov Grobgeld
  6. *
  7. * This file is part of GNU FriBidi.
  8. *
  9. * GNU FriBidi is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU Lesser General Public License
  11. * as published by the Free Software Foundation; either version 2.1
  12. * of the License, or (at your option) any later version.
  13. *
  14. * GNU FriBidi 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
  17. * GNU 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 GNU FriBidi; if not, write to the Free Software
  21. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  22. *
  23. * For licensing issues, contact <fribidi.license@gmail.com> or write to
  24. * Sharif FarsiWeb, Inc., PO Box 13445-389, Tehran, Iran.
  25. *
  26. * Author(s):
  27. * Behdad Esfahbod, 2001, 2002, 2004
  28. * Dov Grobgeld, 1999, 2000, 2017
  29. */
  30. #ifndef _FRIBIDI_BRACKETS_H
  31. #define _FRIBIDI_BRACKETS_H
  32. #include "fribidi-common.h"
  33. #include "fribidi-types.h"
  34. #include "fribidi-bidi-types.h"
  35. #include "fribidi-begindecls.h"
  36. /* fribidi_get_bracket - get bracketed character
  37. *
  38. * This function finds the bracketed equivalent of a character as defined in
  39. * the file BidiBrackets.txt of the Unicode Character Database available at
  40. * http://www.unicode.org/Public/UNIDATA/BidiBrackets.txt.
  41. *
  42. * If the input character is a declared as a brackets character in the
  43. * Unicode standard and has a bracketed equivalent. The matching bracketed
  44. * character is put in the output, otherwise the input character itself is
  45. * put.
  46. *
  47. * Returns: The bracket type of the character. Use the
  48. * FRIBIDI_IS_BRACKET(FriBidiBracketType) to test if it is a valid
  49. * property.
  50. */
  51. FRIBIDI_ENTRY FriBidiBracketType fribidi_get_bracket (
  52. FriBidiChar ch /* input character */
  53. );
  54. /* fribidi_get_bracket_types - get bracketed characters
  55. *
  56. * This function finds the bracketed characters of an string of characters.
  57. * See fribidi_get_bracket() for more information about the bracketed
  58. * characters returned by this function.
  59. */
  60. FRIBIDI_ENTRY void
  61. fribidi_get_bracket_types (
  62. const FriBidiChar *str, /* input string */
  63. const FriBidiStrIndex len, /* input string length */
  64. const FriBidiCharType *types, /* input bidi types */
  65. FriBidiBracketType *btypes /* output bracketed characters */
  66. );
  67. #define FRIBIDI_BRACKET_OPEN_MASK 0x80000000
  68. #define FRIBIDI_BRACKET_ID_MASK 0x7fffffff
  69. #define FRIBIDI_IS_BRACKET_OPEN(bt) ((bt & FRIBIDI_BRACKET_OPEN_MASK)>0)
  70. #define FRIBIDI_BRACKET_ID(bt) ((bt & FRIBIDI_BRACKET_ID_MASK))
  71. #include "fribidi-enddecls.h"
  72. #endif /* !_FRIBIDI_BRACKETS_H */
  73. /* Editor directions:
  74. * Local Variables:
  75. * mode: c
  76. * c-basic-offset: 2
  77. * indent-tabs-mode: t
  78. * tab-width: 8
  79. * End:
  80. * vim: textwidth=78: autoindent: cindent: shiftwidth=2: tabstop=8:
  81. */