can't display jp, fr and en simultaneously with 0.2a or 0.3a
David Marceau <[email protected]> Thu, 15 Jan 2004 02:46:20 -0500
| Newsgroups | gmane.comp.web.ming.general |
|---|---|
| Message-ID | <[email protected]> |
Hi there,
I thought when I did these tests at first that I had succeeded with this.=
In
fact I don't seem to have to proper technique for doing this yet.
It's interesting because in ming 0.2a the jp fonts come out ok, but the f=
rench
characters don't when inside constants. If I set the text from within
actionscript for the french characters it seems to work. In ming 0.3a th=
e jp
fonts don't show up at all and the french characters in the constants bel=
ow
don't appear correctly either.
How can I do this stuff without having to resort to actionscript? The on=
ly I am
quite sure of is to save all my strings in UTF-8 format in order for all =
of the
different charsets to co-exist. If I have to resort to actionscript how =
should
I approach declaring different messages for different countries compiled
up-front in order to be displayed as quickly as possible in flash?
Yes I did ttf2fft -e 1 minchoblah.ttf
Then I did makefdb mincho.fft
which ultimately produced the wanted .fdb file referred in the source bel=
ow.
Thanks for any hints you may provide to me.
Cheers,
David Marceau
Here are the two header files:
//!-- UTF8
#define DJM_MSG_1 ("=A4=C9=A4=A6=A4=BE =A4=E8=A4=ED=A4=B7=A4=AF")
#define DJM_MSG_2 ("=A5=DE=A5=EB=A5=BD=A1=BC")
#define DJM_MSG_3 ("=A5=C7=A1=BC=A5=D3=A5=C3=A5=C9")
//!-- UTF8
#define DJM_MSG_4 "Je suis pr=E9sentement en train d'apprendre =E0 lire e=
t =E9crire le
japonais."
#define DJM_MSG_5 "I am in the process of learning how to read and write =
the
japanese language."
Here is the test source:
// #define COMPILE_WITH_0_DOT_2_A (1)
// #undef COMPILE_WITH_0_DOT_3_A
/*=20
this is when I compile with:
gcc -I ../../ming-0.2a/ -L ../../ming-0.2a/ jpfrenText.c -lming -lm =
-lz
-lungif -lpng
=20
/home/david/devstuff/flashstuff/gflashplayer/install_flash_player_6_linux=
_sa/gflashplayer
jpfrenText.swf &
*/
#define COMPILE_WITH_0_DOT_3_A (1)
#undef COMPILE_WITH_0_DOT_2_A
/*
this is when I compile with:
gcc -I ../../ming-0.3a/ming/ -L ../../ming-0.3a/ming jpfrenText.c -lm=
ing -lm
-lz -lungif -lpng
=20
/home/david/devstuff/flashstuff/gflashplayer/install_flash_player_6_linux=
_sa/gflashplayer
jpfrenText.swf &
*/
#include "ming.h"
#include "jpText.h"
#include "frText.h"
int main()
{
SWFFont fjp;
SWFFont ffr;
SWFFont fen;
#if COMPILE_WITH_0_DOT_2_A
SWFText t1;
SWFText t2;
SWFText t3;
#elif COMPILE_WITH_0_DOT_3_A
SWFTextField t1;
SWFTextField t2;
SWFTextField t3;
#endif
SWFDisplayItem di1;
SWFDisplayItem di2;
SWFDisplayItem di3;
SWFMovie m;
/* ok initialize the ming library */
Ming_init();
/* ok set the scale for ming */
Ming_setScale(10.0);
/* ok create a font object and call it f, from a font in an fdb file */
fjp =3D
loadSWFFontFromFile(fopen("/home/david/devstuff/flashstuff/ming-examples/=
common/Kochi
Mincho.fdb", "rb")); =20
ffr =3D loadSWFFontFromFile(fopen("/home/david/fdbfonts/fdb/CentSchbook=
BT.fdb",
"rb")); =20
fen =3D
loadSWFFontFromFile(fopen("/home/david/devstuff/flashstuff/ming-examples/=
common/Techno.fdb",
"rb")); =20
/* create a text object and call it t */
#if COMPILE_WITH_0_DOT_2_A
t1 =3D newSWFText2();
t2 =3D newSWFText2();
t3 =3D newSWFText2();
#elif COMPILE_WITH_0_DOT_3_A
t1 =3D newSWFTextField();
t2 =3D newSWFTextField();
t3 =3D newSWFTextField();
#endif
/* set the font object called f into the text object called t */
#if COMPILE_WITH_0_DOT_2_A
SWFText_setFont(t1, fjp);
SWFText_setFont(t2, ffr);
SWFText_setFont(t3, fen);
#elif COMPILE_WITH_0_DOT_3_A
SWFTextField_setFont(t1, fjp);
SWFTextField_setFont(t2, ffr);
SWFTextField_setFont(t3, fen);
#endif
/* set the text object t's color to red and opaque is the last 0xff for=
the
transparency(opaqueness) value */
#if COMPILE_WITH_0_DOT_2_A
SWFText_setColor(t1, 0xff, 0x00, 0x00, 0xff);
SWFText_setColor(t2, 0xff, 0xff, 0x00, 0xff);
SWFText_setColor(t3, 0x00, 0x00, 0xff, 0xff);
#elif COMPILE_WITH_0_DOT_3_A
SWFTextField_setColor(t1, 0xff, 0x00, 0x00, 0xff);
SWFTextField_setColor(t2, 0xff, 0xff, 0x00, 0xff);
SWFTextField_setColor(t3, 0x00, 0x00, 0xff, 0xff);
#endif
#if COMPILE_WITH_0_DOT_2_A
SWFText_setHeight(t1, 20);
SWFText_setHeight(t2, 20);
SWFText_setHeight(t3, 20);
#elif COMPILE_WITH_0_DOT_3_A
SWFTextField_setHeight(t1, 20);
SWFTextField_setHeight(t2, 20);
SWFTextField_setHeight(t3, 20);
#endif
=20
#if COMPILE_WITH_0_DOT_2_A
SWFText_addString(t1, DJM_MSG_1, NULL ); =20
SWFText_addString(t2, DJM_MSG_4, NULL );
SWFText_addString(t3, DJM_MSG_5, NULL );
#elif COMPILE_WITH_0_DOT_3_A
SWFTextField_addString(t1, DJM_MSG_1 ); =20
SWFTextField_addString(t2, DJM_MSG_4 );
SWFTextField_addString(t3, DJM_MSG_5 );
#endif
/* now create a movie called m */
m =3D newSWFMovie();
/* set the movie m's dimension to 5400, 3600 */
SWFMovie_setDimension(m, 640, 480); =20
/* set the movie m's background color to black */
SWFMovie_setBackground(m, 0x00, 0x00, 0x00);
/* add the text object t to the movie object m */
di1 =3D SWFMovie_add(m, t1);
di2 =3D SWFMovie_add(m, t2);
di3 =3D SWFMovie_add(m, t3);
/* move the text to an appropriate position */
int xpos =3D 20;
int ypos =3D 100;
SWFDisplayItem_moveTo(di1, xpos, ypos);
SWFDisplayItem_moveTo(di2, xpos, ypos+80);
SWFDisplayItem_moveTo(di3, xpos, ypos+160);
SWFMovie_nextFrame(m);
/* now write the flash output file .swf */
#ifdef COMPILE_WITH_0_DOT_2_A
SWFMovie_save(m, "jpfrenText.swf");
#elif COMPILE_WITH_0_DOT_3_A
SWFMovie_save(m, "jpfrenText.swf", 9);
#endif
exit(0);
}