1 #include <stdio.h>
2 #include <stdlib.h>
3 #include <errno.h>
4 #include <libming.h>
5 
6 /*
7  * Testcase for bug http://bugs.libming.org/show_bug.cgi?id=98
8  */
9 
main()10 int main()
11 {
12 	/*
13 	 * We must target SWF6 or higher or UTF-8 will not be supported
14 	 * by _player_ (no changes in SWF, player fails rendering UTF-8
15 	 * in TextField)
16 	 */
17 	SWFMovie m = newSWFMovieWithVersion(6);
18 
19 	SWFText text = newSWFText();
20 	SWFTextField textfield = newSWFTextField();
21 	const char *string = "Euro \xe2\x82\xac - Trademark \xe2\x84\xa2 - Ligatures \xef\xac\x81 and \xef\xac\x82 ";
22 
23 
24 	SWFFont font = newSWFFont_fromFile(MEDIADIR "/font-kerntest.fdb");
25 	if(font == NULL)
26 	{
27 		perror(MEDIADIR "/font-kerntest.fdb");
28 		exit(EXIT_FAILURE);
29 	}
30 
31 	SWFText_setFont(text, font);
32 	SWFText_setColor(text, 0, 0, 0, 0xff);
33 	SWFText_setHeight(text, 10);
34 	SWFText_moveTo(text, 0, 30);
35 	SWFText_addUTF8String(text, string, NULL);
36 	SWFMovie_add(m, text);
37 
38         SWFTextField_setFont(textfield, font);
39         SWFTextField_setFlags(textfield, SWFTEXTFIELD_NOEDIT);
40         SWFTextField_setColor(textfield, 0xff, 0, 0, 0xff);
41         SWFTextField_setHeight(textfield, 10);
42         SWFTextField_addUTF8String(textfield, string);
43 	SWFMovie_add(m, textfield);
44 
45 	SWFMovie_save(m, "test07.swf");
46 
47 	return 0;
48 }
49 
50