1 /* Line breaking of Unicode strings.
2 Copyright (C) 2001-2003, 2005-2010 Free Software Foundation, Inc.
3 Written by Bruno Haible <bruno@clisp.org>, 2001.
5 This program is free software: you can redistribute it and/or modify it
6 under the terms of the GNU General Public License as published
7 by the Free Software Foundation; either version 3 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>. */
26 /* Get locale_charset() declaration. */
27 #include "localcharset.h"
35 /* These functions are locale dependent. The encoding argument identifies
36 the encoding (e.g. "ISO-8859-2" for Polish). */
50 /* Determine the line break points in S, and store the result at p[0..n-1].
51 p[i] = UC_BREAK_MANDATORY means that s[i] is a line break character.
52 p[i] = UC_BREAK_POSSIBLE means that a line break may be inserted between
54 p[i] = UC_BREAK_HYPHENATION means that a hyphen and a line break may be
55 inserted between s[i-1] and s[i]. But beware of language dependent
57 p[i] = UC_BREAK_PROHIBITED means that s[i-1] and s[i] must not be separated.
60 u8_possible_linebreaks (const uint8_t *s, size_t n,
61 const char *encoding, char *p);
63 u16_possible_linebreaks (const uint16_t *s, size_t n,
64 const char *encoding, char *p);
66 u32_possible_linebreaks (const uint32_t *s, size_t n,
67 const char *encoding, char *p);
69 ulc_possible_linebreaks (const char *s, size_t n,
70 const char *encoding, char *p);
72 /* Choose the best line breaks, assuming the uc_width function.
73 The string is s[0..n-1]. The maximum number of columns per line is given
74 as WIDTH. The starting column of the string is given as START_COLUMN.
75 If the algorithm shall keep room after the last piece, they can be given
77 o is an optional override; if o[i] != UC_BREAK_UNDEFINED, o[i] takes
78 precedence over p[i] as returned by the *_possible_linebreaks function.
79 The given ENCODING is used for disambiguating widths in uc_width.
80 Return the column after the end of the string, and store the result at
84 u8_width_linebreaks (const uint8_t *s, size_t n, int width,
85 int start_column, int at_end_columns,
86 const char *o, const char *encoding,
89 u16_width_linebreaks (const uint16_t *s, size_t n, int width,
90 int start_column, int at_end_columns,
91 const char *o, const char *encoding,
94 u32_width_linebreaks (const uint32_t *s, size_t n, int width,
95 int start_column, int at_end_columns,
96 const char *o, const char *encoding,
99 ulc_width_linebreaks (const char *s, size_t n, int width,
100 int start_column, int at_end_columns,
101 const char *o, const char *encoding,
110 #endif /* _UNILBRK_H */