libunibreak 5.1

Loading...
Searching...
No Matches
linebreak.h
Go to the documentation of this file.
1/* vim: set expandtab tabstop=4 softtabstop=4 shiftwidth=4: */
2
3/*
4 * Line breaking in a Unicode sequence. Designed to be used in a
5 * generic text renderer.
6 *
7 * Copyright (C) 2008-2020 Wu Yongwei <wuyongwei at gmail dot com>
8 *
9 * This software is provided 'as-is', without any express or implied
10 * warranty. In no event will the author be held liable for any damages
11 * arising from the use of this software.
12 *
13 * Permission is granted to anyone to use this software for any purpose,
14 * including commercial applications, and to alter it and redistribute
15 * it freely, subject to the following restrictions:
16 *
17 * 1. The origin of this software must not be misrepresented; you must
18 * not claim that you wrote the original software. If you use this
19 * software in a product, an acknowledgement in the product
20 * documentation would be appreciated but is not required.
21 * 2. Altered source versions must be plainly marked as such, and must
22 * not be misrepresented as being the original software.
23 * 3. This notice may not be removed or altered from any source
24 * distribution.
25 *
26 * The main reference is Unicode Standard Annex 14 (UAX #14):
27 * <URL:http://www.unicode.org/reports/tr14/>
28 *
29 * When this library was designed, this annex was at Revision 19, for
30 * Unicode 5.0.0:
31 * <URL:http://www.unicode.org/reports/tr14/tr14-19.html>
32 *
33 * This library has been updated according to Revision 45, for
34 * Unicode 13.0.0:
35 * <URL:http://www.unicode.org/reports/tr14/tr14-45.html>
36 *
37 * The Unicode Terms of Use are available at
38 * <URL:http://www.unicode.org/copyright.html>
39 */
40
49#ifndef LINEBREAK_H
50#define LINEBREAK_H
51
52#include <stddef.h>
53#include "unibreakbase.h"
54
55#ifdef __cplusplus
56 extern "C" {
57#endif
58
59#define LINEBREAK_MUSTBREAK 0
60#define LINEBREAK_ALLOWBREAK 1
61#define LINEBREAK_NOBREAK 2
62#define LINEBREAK_INSIDEACHAR 3
63#define LINEBREAK_INDETERMINATE 4
65 void init_linebreak(void);
66 void set_linebreaks_utf8(
67 const utf8_t *s, size_t len, const char *lang, char *brks);
68 void set_linebreaks_utf16(
69 const utf16_t *s, size_t len, const char *lang, char *brks);
70 void set_linebreaks_utf32(
71 const utf32_t *s, size_t len, const char *lang, char *brks);
72 size_t set_linebreaks_utf8_per_code_point(
73 const utf8_t *s, size_t len, const char *lang, char *brks);
74 size_t set_linebreaks_utf16_per_code_point(
75 const utf16_t *s, size_t len, const char *lang, char *brks);
76 int is_line_breakable(utf32_t char1, utf32_t char2, const char *lang);
77
78#ifdef __cplusplus
79}
80#endif
81
82#endif /* LINEBREAK_H */
set_linebreaks_utf16
void set_linebreaks_utf16(const utf16_t *s, size_t len, const char *lang, char *brks)
Sets the line breaking information for a UTF-16 input string.
Definition: linebreak.c:880
is_line_breakable
int is_line_breakable(utf32_t char1, utf32_t char2, const char *lang)
Tells whether a line break can occur between two Unicode characters.
Definition: linebreak.c:947
init_linebreak
void init_linebreak(void)
Does nothing.
Definition: linebreak.c:326
set_linebreaks_utf16_per_code_point
size_t set_linebreaks_utf16_per_code_point(const utf16_t *s, size_t len, const char *lang, char *brks)
Sets the line breaking information for a UTF-16 input string.
Definition: linebreak.c:903
set_linebreaks_utf32
void set_linebreaks_utf32(const utf32_t *s, size_t len, const char *lang, char *brks)
Sets the line breaking information for a UTF-32 input string.
Definition: linebreak.c:924
set_linebreaks_utf8_per_code_point
size_t set_linebreaks_utf8_per_code_point(const utf8_t *s, size_t len, const char *lang, char *brks)
Sets the line breaking information for a UTF-8 input string.
Definition: linebreak.c:859
set_linebreaks_utf8
void set_linebreaks_utf8(const utf8_t *s, size_t len, const char *lang, char *brks)
Sets the line breaking information for a UTF-8 input string.
Definition: linebreak.c:836
unibreakbase.h
Header file for common definitions in the libunibreak library.
utf16_t
unsigned short utf16_t
Type for UTF-16 data points.
Definition: unibreakbase.h:48
utf32_t
unsigned int utf32_t
Type for UTF-32 data points.
Definition: unibreakbase.h:49
utf8_t
unsigned char utf8_t
Type for UTF-8 data points.
Definition: unibreakbase.h:47