---
name: "unicode_grapheme_break"
section: "3"
platform: "linux"
package: "libcourier-unicode-dev"
version: "2.3.2-1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/unicode_grapheme_break"
---

# unicode\_grapheme\_break(3)

unicode grapheme cluster boundary rules

## NAME

unicode\_grapheme\_break, unicode\_grapheme\_break\_init, unicode\_grapheme\_break\_next, unicode\_grapheme\_break\_deinit - unicode grapheme cluster boundary rules

## SYNOPSIS

```
#include <courier-unicode.h>
```

**unicode\_grapheme\_break\_info\_t unicode\_grapheme\_break\_init(void);**

**int unicode\_grapheme\_next(unicode\_grapheme\_break\_info\_t** *handle***, char32\_t** *c***);**

**void unicode\_grapheme\_deinit(unicode\_grapheme\_break\_info\_t** *handle***);**

**int unicode\_grapheme\_break(char32\_t** *a***, char32\_t** *b***);**

## DESCRIPTION

These functions implement the unicode grapheme cluster breaking algorithm. Invoke **unicode\_grapheme\_break\_init**() to initialize the grapheme cluster breaking algorithm. **unicode\_grapheme\_break\_init**() returns an opaque handle. Each subsequent call to **unicode\_grapheme\_break\_next**() passes this handle, and the next character. **unicode\_grapheme\_break\_next**() returns a non-0 value if there's a grapheme break before the character, in a sequence of Unicode characters. **unicode\_grapheme\_break\_deinit**() releases all resources used by the grapheme breaking handle, and the unicode\_grapheme\_break\_info\_t handle is no longer valid after this call.

The first call to **unicode\_grapheme\_break\_next**() always returns non-0, as per the GB1 rule.

**unicode\_grapheme\_break**() is a simplified interface that returns non-zero if there is a grapheme break between two unicode characters *a* and *b*. This is is equivalent to calling **unicode\_grapheme\_break\_init**(), followed by two calls to  **unicode\_grapheme\_break\_next**(), and finally **unicode\_grapheme\_break\_deinit**(), then returning the result of the second call to **unicode\_grapheme\_break\_next**().

## SEE ALSO

**TR-29**\[1\], [**courier-unicode**(7)](/courier-unicode/7.md), [**unicode\_convert\_tocase**(3)](/unicode_convert_tocase/3.md), [**unicode\_line\_break**(3)](/unicode_line_break/3.md), [**unicode\_word\_break**(3)](/unicode_word_break/3.md).

## AUTHOR

**Sam Varshavchik**

Author

## NOTES

- 1\.

  TR-29

  https://www.unicode.org/reports/tr29/tr29-43.html
