efl

Форк
0
/
linebreakdef.c 
125 строк · 5.1 Кб
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-2018 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

27
/**
28
 * @file    linebreakdef.c
29
 *
30
 * Definition of language-specific data.
31
 *
32
 * @author  Wu Yongwei
33
 */
34

35
#include "linebreak.h"
36
#include "linebreakdef.h"
37

38
/**
39
 * English-specifc data over the default Unicode rules.
40
 */
41
static const struct LineBreakProperties lb_prop_English[] = {
42
    { 0x2018, 0x2018, LBP_OP }, /* Left single quotation mark: opening */
43
    { 0x201C, 0x201C, LBP_OP }, /* Left double quotation mark: opening */
44
    { 0x201D, 0x201D, LBP_CL }, /* Right double quotation mark: closing */
45
    { 0, 0, LBP_Undefined }
46
};
47

48
/**
49
 * German-specifc data over the default Unicode rules.
50
 */
51
static const struct LineBreakProperties lb_prop_German[] = {
52
    { 0x00AB, 0x00AB, LBP_CL }, /* Left double angle quotation mark: closing */
53
    { 0x00BB, 0x00BB, LBP_OP }, /* Right double angle quotation mark: opening */
54
    { 0x2018, 0x2018, LBP_CL }, /* Left single quotation mark: closing */
55
    { 0x2019, 0x2019, LBP_GL }, /* Right single quotation mark: glue */
56
    { 0x201C, 0x201C, LBP_CL }, /* Left double quotation mark: closing */
57
    { 0x2039, 0x2039, LBP_CL }, /* Left single angle quotation mark: closing */
58
    { 0x203A, 0x203A, LBP_OP }, /* Right single angle quotation mark: opening */
59
    { 0, 0, LBP_Undefined }
60
};
61

62
/**
63
 * Spanish-specifc data over the default Unicode rules.
64
 */
65
static const struct LineBreakProperties lb_prop_Spanish[] = {
66
    { 0x00AB, 0x00AB, LBP_OP }, /* Left double angle quotation mark: opening */
67
    { 0x00BB, 0x00BB, LBP_CL }, /* Right double angle quotation mark: closing */
68
    { 0x2018, 0x2018, LBP_OP }, /* Left single quotation mark: opening */
69
    { 0x201C, 0x201C, LBP_OP }, /* Left double quotation mark: opening */
70
    { 0x201D, 0x201D, LBP_CL }, /* Right double quotation mark: closing */
71
    { 0x2039, 0x2039, LBP_OP }, /* Left single angle quotation mark: opening */
72
    { 0x203A, 0x203A, LBP_CL }, /* Right single angle quotation mark: closing */
73
    { 0, 0, LBP_Undefined }
74
};
75

76
/**
77
 * French-specifc data over the default Unicode rules.
78
 */
79
static const struct LineBreakProperties lb_prop_French[] = {
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 }
88
};
89

90
/**
91
 * Russian-specifc data over the default Unicode rules.
92
 */
93
static const struct LineBreakProperties lb_prop_Russian[] = {
94
    { 0x00AB, 0x00AB, LBP_OP }, /* Left double angle quotation mark: opening */
95
    { 0x00BB, 0x00BB, LBP_CL }, /* Right double angle quotation mark: closing */
96
    { 0x201C, 0x201C, LBP_CL }, /* Left double quotation mark: closing */
97
    { 0, 0, LBP_Undefined }
98
};
99

100
/**
101
 * Chinese-specifc data over the default Unicode rules.
102
 */
103
static const struct LineBreakProperties lb_prop_Chinese[] = {
104
    { 0x2018, 0x2018, LBP_OP }, /* Left single quotation mark: opening */
105
    { 0x2019, 0x2019, LBP_CL }, /* Right single quotation mark: closing */
106
    { 0x201C, 0x201C, LBP_OP }, /* Left double quotation mark: opening */
107
    { 0x201D, 0x201D, LBP_CL }, /* Right double quotation mark: closing */
108
    { 0, 0, LBP_Undefined }
109
};
110

111
/**
112
 * Association data of language-specific line breaking properties with
113
 * language names.  This is the definition for the static data in this
114
 * file.  If you want more flexibility, or do not need the data here,
115
 * you may want to redefine \e lb_prop_lang_map in your C source file.
116
 */
117
const struct LineBreakPropertiesLang lb_prop_lang_map[] = {
118
    { "en", 2, lb_prop_English },
119
    { "de", 2, lb_prop_German },
120
    { "es", 2, lb_prop_Spanish },
121
    { "fr", 2, lb_prop_French },
122
    { "ru", 2, lb_prop_Russian },
123
    { "zh", 2, lb_prop_Chinese },
124
    { NULL, 0, NULL }
125
};
126

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.