[CRT] spawn: define a unicode environment when needed
[reactos.git] / sdk / lib / 3rdparty / freetype / freetype_ros.diff
1 diff -prudN e:\freetype-2.6\src/autofit/afcjk.c e:\reactos\lib\3rdparty\freetype\src/autofit/afcjk.c
2 --- e:\freetype-2.6\src/autofit/afcjk.c 2015-04-20 21:52:41 +0100
3 +++ e:\reactos\lib\3rdparty\freetype\src/autofit/afcjk.c 2015-09-07 22:38:13 +0100
4 @@ -71,7 +71,11 @@
5 FT_Face face )
6 {
7 /* scan the array of segments in each direction */
8 +#ifdef __REACTOS__
9 + AF_GlyphHintsRec *hints = malloc(sizeof(AF_GlyphHintsRec));
10 +#else
11 AF_GlyphHintsRec hints[1];
12 +#endif
13
14
15 FT_TRACE5(( "\n"
16 @@ -90,7 +94,11 @@
17 FT_ULong glyph_index;
18 FT_Long y_offset;
19 int dim;
20 +#ifdef __REACTOS__
21 + AF_CJKMetricsRec *dummy = malloc(sizeof(AF_CJKMetricsRec));
22 +#else
23 AF_CJKMetricsRec dummy[1];
24 +#endif
25 AF_Scaler scaler = &dummy->root.scaler;
26
27 #ifdef FT_CONFIG_OPTION_PIC
28 @@ -243,11 +251,18 @@
29 }
30 #endif
31 }
32 +#ifdef __REACTOS__
33 + free(dummy);
34 +#endif
35 }
36
37 FT_TRACE5(( "\n" ));
38
39 af_glyph_hints_done( hints );
40 +
41 +#ifdef __REACTOS__
42 + free(hints);
43 +#endif
44 }
45
46
47 diff -prudN e:\freetype-2.6\src/autofit/aflatin.c e:\reactos\lib\3rdparty\freetype\src/autofit/aflatin.c
48 --- e:\freetype-2.6\src/autofit/aflatin.c 2015-04-20 21:52:58 +0100
49 +++ e:\reactos\lib\3rdparty\freetype\src/autofit/aflatin.c 2015-09-08 11:08:25 +0100
50 @@ -58,7 +58,11 @@
51 FT_Face face )
52 {
53 /* scan the array of segments in each direction */
54 +#ifdef __REACTOS__
55 + AF_GlyphHintsRec *hints = malloc(sizeof(AF_GlyphHintsRec));
56 +#else
57 AF_GlyphHintsRec hints[1];
58 +#endif
59
60
61 FT_TRACE5(( "\n"
62 @@ -77,7 +81,11 @@
63 FT_ULong glyph_index;
64 FT_Long y_offset;
65 int dim;
66 +#ifdef __REACTOS__
67 + AF_LatinMetricsRec *dummy = malloc(sizeof(AF_LatinMetricsRec));
68 +#else
69 AF_LatinMetricsRec dummy[1];
70 +#endif
71 AF_Scaler scaler = &dummy->root.scaler;
72
73 #ifdef FT_CONFIG_OPTION_PIC
74 @@ -243,11 +251,19 @@
75 }
76 #endif
77 }
78 +#ifdef __REACTOS__
79 + free(dummy);
80 +#endif
81 }
82
83 FT_TRACE5(( "\n" ));
84
85 af_glyph_hints_done( hints );
86 +
87 +#ifdef __REACTOS__
88 + free(hints);
89 +#endif
90 +
91 }
92
93
94 diff -prudN e:\freetype-2.6\src/autofit/afmodule.c e:\reactos\lib\3rdparty\freetype\src/autofit/afmodule.c
95 --- e:\freetype-2.6\src/autofit/afmodule.c 2015-06-07 05:44:38 +0100
96 +++ e:\reactos\lib\3rdparty\freetype\src/autofit/afmodule.c 2015-09-07 20:58:52 +0100
97 @@ -351,9 +351,13 @@
98 return error;
99
100 #else /* !FT_DEBUG_AUTOFIT */
101 -
102 +#ifdef __REACTOS__
103 + AF_GlyphHintsRec *hints = malloc(sizeof(AF_GlyphHintsRec));
104 + AF_LoaderRec *loader = malloc(sizeof(AF_LoaderRec));
105 +#else
106 AF_GlyphHintsRec hints[1];
107 AF_LoaderRec loader[1];
108 +#endif
109
110 FT_UNUSED( size );
111
112 @@ -367,6 +371,11 @@
113 af_loader_done( loader );
114 af_glyph_hints_done( hints );
115
116 +#ifdef __REACTOS__
117 + free(hints);
118 + free(loader);
119 +#endif
120 +
121 return error;
122
123 #endif /* !FT_DEBUG_AUTOFIT */
124 diff -prudN e:\freetype-2.6\src/base/ftbitmap.c e:\reactos\lib\3rdparty\freetype\src/base/ftbitmap.c
125 --- e:\freetype-2.6\src/base/ftbitmap.c 2015-03-11 06:47:11 +0100
126 +++ e:\reactos\lib\3rdparty\freetype\src/base/ftbitmap.c 2015-09-07 17:20:37 +0100
127 @@ -577,7 +577,16 @@
128 {
129 FT_Int val = ss[0]; /* avoid a byte->int cast on each line */
130
131 -
132 +#ifdef __REACTOS__
133 + tt[0] = (FT_Byte)( ( val & 0x80 ) ? 0xff : 0);
134 + tt[1] = (FT_Byte)( ( val & 0x40 ) ? 0xff : 0);
135 + tt[2] = (FT_Byte)( ( val & 0x20 ) ? 0xff : 0);
136 + tt[3] = (FT_Byte)( ( val & 0x10 ) ? 0xff : 0);
137 + tt[4] = (FT_Byte)( ( val & 0x08 ) ? 0xff : 0);
138 + tt[5] = (FT_Byte)( ( val & 0x04 ) ? 0xff : 0);
139 + tt[6] = (FT_Byte)( ( val & 0x02 ) ? 0xff : 0);
140 + tt[7] = (FT_Byte)( ( val & 0x01 ) ? 0xff : 0);
141 +#else
142 tt[0] = (FT_Byte)( ( val & 0x80 ) >> 7 );
143 tt[1] = (FT_Byte)( ( val & 0x40 ) >> 6 );
144 tt[2] = (FT_Byte)( ( val & 0x20 ) >> 5 );
145 @@ -586,6 +595,7 @@
146 tt[5] = (FT_Byte)( ( val & 0x04 ) >> 2 );
147 tt[6] = (FT_Byte)( ( val & 0x02 ) >> 1 );
148 tt[7] = (FT_Byte)( val & 0x01 );
149 +#endif
150
151 tt += 8;
152 ss += 1;
153 @@ -600,7 +610,11 @@
154
155 for ( ; j > 0; j-- )
156 {
157 +#ifdef __REACTOS__
158 + tt[0] = (FT_Byte)( ( val & 0x80 ) ? 0xff : 0);
159 +#else
160 tt[0] = (FT_Byte)( ( val & 0x80 ) >> 7);
161 +#endif
162 val <<= 1;
163 tt += 1;
164 }
165 diff -prudN e:\freetype-2.6\src/cff/cf2intrp.c e:\reactos\lib\3rdparty\freetype\src/cff/cf2intrp.c
166 --- e:\freetype-2.6\src/cff/cf2intrp.c 2015-05-12 06:22:36 +0100
167 +++ e:\reactos\lib\3rdparty\freetype\src/cff/cf2intrp.c 2015-09-08 10:46:46 +0100
168 @@ -463,7 +463,13 @@
169 CF2_ArrStackRec vStemHintArray;
170
171 CF2_HintMaskRec hintMask;
172 +#ifdef __REACTOS__
173 + CF2_GlyphPathRec *glyphPath = malloc(sizeof(CF2_GlyphPathRec));
174 +/* Ugly but it allows us to reduce the diff */
175 +#define glyphPath (*glyphPath)
176 +#else
177 CF2_GlyphPathRec glyphPath;
178 +#endif
179
180
181 /* initialize the remaining objects */
182 @@ -1197,7 +1203,13 @@
183 * discard `counterMask' and `counterHintMap'.
184 *
185 */
186 +#ifdef __REACTOS__
187 + CF2_HintMapRec *counterHintMap = malloc(sizeof(CF2_HintMapRec));
188 +/* Ugly but it allows us to reduce the diff */
189 +#define counterHintMap (*counterHintMap)
190 +#else
191 CF2_HintMapRec counterHintMap;
192 +#endif
193 CF2_HintMaskRec counterMask;
194
195
196 @@ -1218,6 +1230,9 @@
197 &counterMask,
198 0,
199 FALSE );
200 +#ifdef __REACTOS__
201 + free(&counterHintMap);
202 +#endif
203 }
204 break;
205
206 @@ -1564,6 +1579,12 @@
207
208 FT_TRACE4(( "\n" ));
209
210 +#ifdef __REACTOS__
211 + free(&glyphPath);
212 +#undef counterHintMap
213 +#undef glyphPath
214 +#endif
215 +
216 return;
217 }
218
219 diff -prudN e:\freetype-2.6\src/cid/cidgload.c e:\reactos\lib\3rdparty\freetype\src/cid/cidgload.c
220 --- e:\freetype-2.6\src/cid/cidgload.c 2015-04-16 06:02:23 +0100
221 +++ e:\reactos\lib\3rdparty\freetype\src/cid/cidgload.c 2015-09-08 10:59:15 +0100
222 @@ -273,7 +273,13 @@
223 {
224 CID_GlyphSlot glyph = (CID_GlyphSlot)cidglyph;
225 FT_Error error;
226 +#ifdef __REACTOS__
227 + T1_DecoderRec *decoder = malloc(sizeof(T1_DecoderRec));
228 +/* Ugly but it allows us to reduce the diff */
229 +#define decoder (*decoder)
230 +#else
231 T1_DecoderRec decoder;
232 +#endif
233 CID_Face face = (CID_Face)cidglyph->face;
234 FT_Bool hinting;
235
236 @@ -435,6 +441,10 @@
237 }
238
239 Exit:
240 +#ifdef __REACTOS__
241 + free(&decoder);
242 +#undef decoder
243 +#endif
244 return error;
245 }
246
247 diff -prudN e:\freetype-2.6\src/raster/ftraster.c e:\reactos\lib\3rdparty\freetype\src/raster/ftraster.c
248 --- e:\freetype-2.6\src/raster/ftraster.c 2015-06-02 10:21:17 +0100
249 +++ e:\reactos\lib\3rdparty\freetype\src/raster/ftraster.c 2015-09-08 11:09:33 +0100
250 @@ -3136,9 +3136,15 @@
251 const FT_Outline* outline = (const FT_Outline*)params->source;
252 const FT_Bitmap* target_map = params->target;
253
254 +#ifdef __REACTOS__
255 + FT_Error ret;
256 + black_TWorker *worker;
257 + Long *buffer;
258 +#else
259 black_TWorker worker[1];
260
261 Long buffer[FT_MAX( FT_RENDER_POOL_SIZE, 2048 ) / sizeof ( Long )];
262 +#endif
263
264
265 if ( !raster )
266 @@ -3175,13 +3181,29 @@
267 if ( !target_map->buffer )
268 return FT_THROW( Invalid );
269
270 +#ifdef __REACTOS__
271 + worker = malloc(sizeof(black_TWorker));
272 + buffer = malloc(FT_MAX(FT_RENDER_POOL_SIZE, 2048));
273 +#endif
274 +
275 ras.outline = *outline;
276 ras.target = *target_map;
277
278 worker->buff = buffer;
279 +#ifdef __REACTOS__
280 + worker->sizeBuff = buffer + (FT_MAX(FT_RENDER_POOL_SIZE, 2048) / sizeof(Long));
281 +#else
282 worker->sizeBuff = (&buffer)[1]; /* Points to right after buffer. */
283 +#endif
284
285 +#ifdef __REACTOS__
286 + ret = Render_Glyph(RAS_VAR);
287 + free(worker);
288 + free(buffer);
289 + return ret;
290 +#else
291 return Render_Glyph( RAS_VAR );
292 +#endif
293 }
294
295
296 diff -prudN e:\freetype-2.6\src/smooth/ftgrays.c e:\reactos\lib\3rdparty\freetype\src/smooth/ftgrays.c
297 --- e:\freetype-2.6\src/smooth/ftgrays.c 2015-03-11 06:47:11 +0100
298 +++ e:\reactos\lib\3rdparty\freetype\src/smooth/ftgrays.c 2015-09-08 09:57:56 +0100
299 @@ -1940,10 +1940,17 @@ typedef ptrdiff_t FT_PtrDist;
300 const FT_Outline* outline = (const FT_Outline*)params->source;
301 const FT_Bitmap* target_map = params->target;
302
303 +#ifdef __REACTOS__
304 + gray_TWorker *worker;
305 + int ret;
306 + TCell *buffer;
307 + long buffer_size = FT_MAX(FT_RENDER_POOL_SIZE, 2048);
308 +#else
309 gray_TWorker worker[1];
310
311 TCell buffer[FT_MAX( FT_RENDER_POOL_SIZE, 2048 ) / sizeof ( TCell )];
312 long buffer_size = sizeof ( buffer );
313 +#endif
314 int band_size = (int)( buffer_size /
315 (long)( sizeof ( TCell ) * 8 ) );
316
317 @@ -1983,6 +1990,10 @@ typedef ptrdiff_t FT_PtrDist;
318 if ( !( params->flags & FT_RASTER_FLAG_AA ) )
319 return FT_THROW( Invalid_Mode );
320
321 +#ifdef __REACTOS__
322 + worker = malloc(sizeof(gray_TWorker));
323 +#endif
324 +
325 /* compute clipping box */
326 if ( !( params->flags & FT_RASTER_FLAG_DIRECT ) )
327 {
328 @@ -2002,6 +2013,10 @@ typedef ptrdiff_t FT_PtrDist;
329 ras.clip_box.yMax = 32767L;
330 }
331
332 +#ifdef __REACTOS__
333 + buffer = malloc(buffer_size);
334 +#endif
335 +
336 gray_init_cells( RAS_VAR_ buffer, buffer_size );
337
338 ras.outline = *outline;
339 @@ -2023,7 +2038,14 @@ typedef ptrdiff_t FT_PtrDist;
340 ras.render_span_data = &ras;
341 }
342
343 +#ifdef __REACTOS__
344 + ret = gray_convert_glyph(RAS_VAR);
345 + free(worker);
346 + free(buffer);
347 + return ret;
348 +#else
349 return gray_convert_glyph( RAS_VAR );
350 +#endif
351 }
352
353
354 diff -prudN e:\freetype-2.6\src/type1/t1gload.c e:\reactos\lib\3rdparty\freetype\src/type1/t1gload.c
355 --- e:\freetype-2.6\src/type1/t1gload.c 2015-04-13 17:14:02 +0100
356 +++ e:\reactos\lib\3rdparty\freetype\src/type1/t1gload.c 2015-09-08 10:55:18 +0100
357 @@ -154,7 +154,13 @@
358 FT_Pos* max_advance )
359 {
360 FT_Error error;
361 +#ifdef __REACTOS__
362 + T1_DecoderRec *decoder = malloc(sizeof(T1_DecoderRec));
363 +/* Ugly but it allows us to reduce the diff */
364 +#define decoder (*decoder)
365 +#else
366 T1_DecoderRec decoder;
367 +#endif
368 FT_Int glyph_index;
369 T1_Font type1 = &face->type1;
370 PSAux_Service psaux = (PSAux_Service)face->psaux;
371 @@ -175,7 +181,14 @@
372 FT_RENDER_MODE_NORMAL,
373 T1_Parse_Glyph );
374 if ( error )
375 +#ifdef __REACTOS__
376 + {
377 + free(&decoder);
378 + return error;
379 + }
380 +#else
381 return error;
382 +#endif
383
384 decoder.builder.metrics_only = 1;
385 decoder.builder.load_points = 0;
386 @@ -202,7 +215,10 @@
387 }
388
389 psaux->t1_decoder_funcs->done( &decoder );
390 -
391 +#ifdef __REACTOS__
392 + free(&decoder);
393 +#undef decoder
394 +#endif
395 return FT_Err_Ok;
396 }
397
398 @@ -215,7 +231,13 @@
399 FT_Fixed* advances )
400 {
401 T1_Face face = (T1_Face)t1face;
402 +#ifdef __REACTOS__
403 + T1_DecoderRec *decoder = malloc(sizeof(T1_DecoderRec));
404 +/* Ugly but it allows us to reduce the diff */
405 +#define decoder (*decoder)
406 +#else
407 T1_DecoderRec decoder;
408 +#endif
409 T1_Font type1 = &face->type1;
410 PSAux_Service psaux = (PSAux_Service)face->psaux;
411 FT_UInt nn;
412 @@ -227,6 +249,9 @@
413 for ( nn = 0; nn < count; nn++ )
414 advances[nn] = 0;
415
416 +#ifdef __REACTOS__
417 + free(&decoder);
418 +#endif
419 return FT_Err_Ok;
420 }
421
422 @@ -240,7 +265,14 @@
423 FT_RENDER_MODE_NORMAL,
424 T1_Parse_Glyph );
425 if ( error )
426 +#ifdef __REACTOS__
427 + {
428 + free(&decoder);
429 + return error;
430 + }
431 +#else
432 return error;
433 +#endif
434
435 decoder.builder.metrics_only = 1;
436 decoder.builder.load_points = 0;
437 @@ -260,7 +292,10 @@
438 else
439 advances[nn] = 0;
440 }
441 -
442 +#ifdef __REACTOS__
443 + free(&decoder);
444 +#undef decoder
445 +#endif
446 return FT_Err_Ok;
447 }
448
449 @@ -273,7 +308,13 @@
450 {
451 T1_GlyphSlot glyph = (T1_GlyphSlot)t1glyph;
452 FT_Error error;
453 +#ifdef __REACTOS__
454 + T1_DecoderRec *decoder = malloc(sizeof(T1_DecoderRec));
455 +/* Ugly but it allows us to reduce the diff */
456 +#define decoder (*decoder)
457 +#else
458 T1_DecoderRec decoder;
459 +#endif
460 T1_Face face = (T1_Face)t1glyph->face;
461 FT_Bool hinting;
462 T1_Font type1 = &face->type1;
463 @@ -512,6 +553,10 @@
464 if ( must_finish_decoder )
465 decoder_funcs->done( &decoder );
466
467 +#ifdef __REACTOS__
468 + free(&decoder);
469 +#undef decoder
470 +#endif
471 return error;
472 }
473