Subversion Repositories Kolibri OS

Rev

Rev 6216 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 6216 Rev 6375
Line 99... Line 99...
99
//   TEXT
99
//   TEXT
100
//
100
//
Line 101... Line 101...
101
 
101
 
102
struct _text {
102
struct _text {
-
 
103
	dword start;
103
	dword start;
104
	char str[7];
-
 
105
	int x, y;
104
	int x, y;
106
	void fixSpecial();
105
};
107
};
-
 
108
 
-
 
109
// function to be called to fix the special symbols
-
 
110
void _text::fixSpecial() {
-
 
111
	get_char(start);
-
 
112
	clean_str();
-
 
113
}
-
 
114
 
-
 
115
// function that traverse the text in sarch for a special
-
 
116
// character starting with & 
-
 
117
// if found, try to look for the conversion 
-
 
118
void get_char(dword text) {
-
 
119
	byte ch;
-
 
120
	int i = 0, j = 0;
-
 
121
	dword text2 = text;
-
 
122
	loop () {
-
 
123
		ch = ESBYTE[text];
-
 
124
		if (!ch) return;
-
 
125
		if (ch=='&') {
-
 
126
			i = 0;
-
 
127
			text++;
-
 
128
			while ( i < 7)  {
-
 
129
				ch = ESBYTE[text];
-
 
130
				if (ch == ';') {
-
 
131
					ESBYTE[text2] = get_symbol();
-
 
132
					while (j < i) {
-
 
133
						j++;
-
 
134
						text2++;
-
 
135
						ESBYTE[text2] = 0;
-
 
136
					}
-
 
137
					//debugln(#str);
-
 
138
					break;
-
 
139
				}
-
 
140
				str[i] = ch;
-
 
141
				if (!ch) return;
-
 
142
				text++;
-
 
143
				i++;
-
 
144
			}
-
 
145
		}
-
 
146
		text++;
-
 
147
		text2++;
-
 
148
	}
-
 
149
}
-
 
150
 
-
 
151
// unicode conversion for special characters
-
 
152
char *unicode_tags[]={
-
 
153
"nbsp",  " ",
-
 
154
"#38",   " ",
-
 
155
"#160",  " ",
-
 
156
 
-
 
157
"ntilde", "ñ", // spanish n special ñ
-
 
158
"#224",  0xC3A0, 
-
 
159
"#241",  0xC3B1, // spanish a with grove accent 'à'
-
 
160
 
-
 
161
"copy",  "(c)",
-
 
162
"#169",  "(c)",
-
 
163
 
-
 
164
"trade", "[TM]",
-
 
165
 
-
 
166
"reg",   "(r)",
-
 
167
"#174",  "(r)",
-
 
168
 
-
 
169
"bdquo", ",,",
-
 
170
 
-
 
171
"amp",   "&",
-
 
172
"#38",   "&",
-
 
173
 
-
 
174
"lt",    "<",
-
 
175
"#60",   "<",
-
 
176
 
-
 
177
"gt",    ">",
-
 
178
"#62",   ">",
-
 
179
 
-
 
180
"minus", "-",
-
 
181
"ndash", "-",
-
 
182
"mdash", "-", //--
-
 
183
"#8722", "-",
-
 
184
"#8211", "-",
-
 
185
"#151",  "-",
-
 
186
"#149",  "-",
-
 
187
 
-
 
188
"rsquo", "'",
-
 
189
"#39",   "'",
-
 
190
"#96",   "'",
-
 
191
"#8217", "'",
-
 
192
 
-
 
193
"quot",  "\"",
-
 
194
"#34",   "\"",
-
 
195
"ldquo", "\"",
-
 
196
"rdquo", "\"",
-
 
197
"#8222", "\"",
-
 
198
"#8221", "\"",
-
 
199
 
-
 
200
"laquo", "<<",
-
 
201
"#171",  "<<",
-
 
202
"raquo", ">>",
-
 
203
"#187",  ">>",
-
 
204
 
-
 
205
"uarr",  "\24",
-
 
206
"darr",  "\25",
-
 
207
"rarr",  "\26",
-
 
208
"larr",  "\27", 
-
 
209
 
-
 
210
"#1028", "\242",
-
 
211
"#1030", "I",
-
 
212
"#1031", "\244",
-
 
213
 
-
 
214
"#8470", "N",
-
 
215
"bull",  "-", //âîîáùå çäåñü òî÷êà
-
 
216
"percnt","%",
-
 
217
 
-
 
218
0}; 
-
 
219
 
-
 
220
// function to look for the conversion od special characters
-
 
221
// if not found--> return 0
-
 
222
char get_symbol() {
-
 
223
	int i;
-
 
224
	debugln(#str);
-
 
225
	for (i=0; unicode_tags[i]!=0; i+=2) {}
-
 
226
		if (strcmp(#str, unicode_tags[i]) == 0) {
-
 
227
			//debugval("i: ", i);
-
 
228
			return unicode_tags[i+1]);
-
 
229
		}
-
 
230
	}	
-
 
231
	return 0;
-
 
232
}
-
 
233
 
-
 
234
// function to clean string str
-
 
235
void clean_str() {
-
 
236
	int i;
-
 
237
	for (i=0; i < 7; i++) {
-
 
238
		str[i] = 0;
-
 
239
	}
-
 
240
}
-
 
241
"raquo",>
-
 
242
"raquo",>