1 /* vim: set expandtab tabstop=4 softtabstop=4 shiftwidth=4: */
4 * Line breaking in a Unicode sequence. Designed to be used in a
5 * generic text renderer.
7 * Copyright (C) 2008-2015 Wu Yongwei <wuyongwei at gmail dot com>
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.
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:
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
26 * The main reference is Unicode Standard Annex 14 (UAX #14):
27 * <URL:http://www.unicode.org/reports/tr14/>
29 * When this library was designed, this annex was at Revision 19, for
31 * <URL:http://www.unicode.org/reports/tr14/tr14-19.html>
33 * This library has been updated according to Revision 33, for
35 * <URL:http://www.unicode.org/reports/tr14/tr14-33.html>
37 * The Unicode Terms of Use are available at
38 * <URL:http://www.unicode.org/copyright.html>
42 * @file linebreakdef.c
44 * Definition of language-specific data.
46 * @version 2.2, 2012/10/06
50 #include "linebreak.h"
51 #include "linebreakdef.h"
54 * English-specifc data over the default Unicode rules.
56 static struct LineBreakProperties lb_prop_English[] = {
57 { 0x2018, 0x2018, LBP_OP }, /* Left single quotation mark: opening */
58 { 0x201C, 0x201C, LBP_OP }, /* Left double quotation mark: opening */
59 { 0x201D, 0x201D, LBP_CL }, /* Right double quotation mark: closing */
60 { 0, 0, LBP_Undefined }
64 * German-specifc data over the default Unicode rules.
66 static struct LineBreakProperties lb_prop_German[] = {
67 { 0x00AB, 0x00AB, LBP_CL }, /* Left double angle quotation mark: closing */
68 { 0x00BB, 0x00BB, LBP_OP }, /* Right double angle quotation mark: opening */
69 { 0x2018, 0x2018, LBP_CL }, /* Left single quotation mark: closing */
70 { 0x201C, 0x201C, LBP_CL }, /* Left double quotation mark: closing */
71 { 0x2039, 0x2039, LBP_CL }, /* Left single angle quotation mark: closing */
72 { 0x203A, 0x203A, LBP_OP }, /* Right single angle quotation mark: opening */
73 { 0, 0, LBP_Undefined }
77 * Spanish-specifc data over the default Unicode rules.
79 static struct LineBreakProperties lb_prop_Spanish[] = {
80 { 0x00AB, 0x00AB, LBP_OP }, /* Left double angle quotation mark: opening */
81 { 0x00BB, 0x00BB, LBP_CL }, /* Right double angle quotation mark: closing */
82 { 0x2018, 0x2018, LBP_OP }, /* Left single quotation mark: opening */
83 { 0x201C, 0x201C, LBP_OP }, /* Left double quotation mark: opening */
84 { 0x201D, 0x201D, LBP_CL }, /* Right double quotation mark: closing */
85 { 0x2039, 0x2039, LBP_OP }, /* Left single angle quotation mark: opening */
86 { 0x203A, 0x203A, LBP_CL }, /* Right single angle quotation mark: closing */
87 { 0, 0, LBP_Undefined }
91 * French-specifc data over the default Unicode rules.
93 static struct LineBreakProperties lb_prop_French[] = {
94 { 0x00AB, 0x00AB, LBP_OP }, /* Left double angle quotation mark: opening */
95 { 0x00BB, 0x00BB, LBP_CL }, /* Right double angle quotation mark: closing */
96 { 0x2018, 0x2018, LBP_OP }, /* Left single quotation mark: opening */
97 { 0x201C, 0x201C, LBP_OP }, /* Left double quotation mark: opening */
98 { 0x201D, 0x201D, LBP_CL }, /* Right double quotation mark: closing */
99 { 0x2039, 0x2039, LBP_OP }, /* Left single angle quotation mark: opening */
100 { 0x203A, 0x203A, LBP_CL }, /* Right single angle quotation mark: closing */
101 { 0, 0, LBP_Undefined }
105 * Russian-specifc data over the default Unicode rules.
107 static struct LineBreakProperties lb_prop_Russian[] = {
108 { 0x00AB, 0x00AB, LBP_OP }, /* Left double angle quotation mark: opening */
109 { 0x00BB, 0x00BB, LBP_CL }, /* Right double angle quotation mark: closing */
110 { 0x201C, 0x201C, LBP_CL }, /* Left double quotation mark: closing */
111 { 0, 0, LBP_Undefined }
115 * Chinese-specifc data over the default Unicode rules.
117 static struct LineBreakProperties lb_prop_Chinese[] = {
118 { 0x2018, 0x2018, LBP_OP }, /* Left single quotation mark: opening */
119 { 0x2019, 0x2019, LBP_CL }, /* Right single quotation mark: closing */
120 { 0x201C, 0x201C, LBP_OP }, /* Left double quotation mark: opening */
121 { 0x201D, 0x201D, LBP_CL }, /* Right double quotation mark: closing */
122 { 0, 0, LBP_Undefined }
126 * Association data of language-specific line breaking properties with
127 * language names. This is the definition for the static data in this
128 * file. If you want more flexibility, or do not need the data here,
129 * you may want to redefine \e lb_prop_lang_map in your C source file.
131 struct LineBreakPropertiesLang lb_prop_lang_map[] = {
132 { "en", 2, lb_prop_English },
133 { "de", 2, lb_prop_German },
134 { "es", 2, lb_prop_Spanish },
135 { "fr", 2, lb_prop_French },
136 { "ru", 2, lb_prop_Russian },
137 { "zh", 2, lb_prop_Chinese },