Re: Some discoveries about multilingual .swf's with ming 0.3a
SoftwareDave <[email protected]> Sat, 17 Jan 2004 12:09:23 -0800 (PST)
| Newsgroups | gmane.comp.web.ming.general |
|---|---|
| Message-ID | <[email protected]> |
This is a multi-part message in MIME format...
------------=_1074370163-28589-0
Content-Type: text/plain
Content-Disposition: inline
Content-Transfer-Encoding: 7bit
Hi,
Im not sure about the .c lib usage but try these with a filename instead of a file pointer for 0.3a. Also you state the top one works no problem and the bottom one no longer works but they are both the same.
Dave...
SWFFont f;
//works for english text no problem
//f = loadSWFFontFromFile(fopen("/home/david/devstuff/flashstuff/ming-examples/common/test.fdb","rb"));
//works for english text no problem
f = loadSWFFontFromFile(fopen ("/home/david/fdbfonts/fdb/CarminaLtBT.fdb","rb"));
.....
SWFTextField t;
SWFFont f;
//no longer seems to work in 0.3a, this only works in 0.2a for me
//for either english text or french text for that matter
//f = loadSWFFontFromFile(fopen("/home/david/devstuff/flashstuff/ming-examples/common/test.fdb","rb"));
------------=_1074370163-28589-0
Content-Type: text/plain; charset=iso-8859-1;
name="test2.c"
Content-Disposition: inline;
filename="test2.c"
Content-Transfer-Encoding: quoted-printable
X-MIME-Autoconverted: from 8bit to quoted-printable by opaque.net id i0HL80uF032465
#include <time.h>
#include <stdio.h>
#include <stdlib.h>
#include "../ming.h"
#define WIDTH 500
#define HEIGHT 200
void testEnglishSWFText(SWFMovie movie)
{
SWFFont f;
//works for english text no problem
//f =3D loadSWFFontFromFile(fopen("/home/david/devstuff/flashstuff/ming=
-examples/common/test.fdb","rb"));
=20
//works for english text no problem
f =3D loadSWFFontFromFile(fopen("/home/david/fdbfonts/fdb/CarminaLtBT.f=
db","rb"));
SWFText t =3D newSWFText();
SWFDisplayItem d;
if(f =3D=3D NULL)
{
printf("font def file not found!\n");
exit(1);
}
SWFText_setFont(t, f);
SWFText_setHeight(t, 14);
SWFText_setColor(t, 0, 0, 0, 0xff);
SWFText_setSpacing(t, 0);
SWFText_addString(t, "EnglishSWFText <<I love you Sayo;)>>", NULL);
d =3D SWFMovie_add(movie, (SWFCharacter)t);
SWFDisplayItem_move(d, 0, 14);
}
void testJapaneseSWFText(SWFMovie movie)
{
SWFFont f;
f =3D loadSWFFontFromFile(fopen("/home/david/devstuff/flashstuff/ming-ex=
amples/common/Kochi Mincho.fdb","rb"));
//f =3D loadSWFFontFromFile(fopen("/home/david/devstuff/flashstuff/ming=
-examples/common/test.fdb","rb"));
=20
//works for english text no problem
//f =3D loadSWFFontFromFile(fopen("/home/david/fdbfonts/fdb/CarminaLtBT=
.fdb","rb"));
SWFText t =3D newSWFText();
SWFDisplayItem d;
if(f =3D=3D NULL)
{
printf("font def file not found!\n");
exit(1);
}
SWFText_setFont(t, f);
SWFText_setHeight(t, 14);
SWFText_setColor(t, 0, 0, 0, 0xff);
SWFText_setSpacing(t, 0);
//SWFText_setBounds(t, 700, 14);
SWFText_addUTF8String(t, "JapaneseUTF8 SWFText <<=E3?*=E3,^=EF=BC? =E3,=
?=E3?Y=E3?-=E3?=AF =E3?,=E3?=AA=E3?Y=E3,? =E3?,=E3??=E3?-=E3?=A6=E3??=E3?=
=BE=E3??=E3?,>>", NULL);
d =3D SWFMovie_add(movie, (SWFCharacter)t);
SWFDisplayItem_move(d, 0, 28);
}
void testFrenchSWFText(SWFMovie movie)
{
//I haven't been successful here with a straight addstring
SWFFont f;
//cannot use browser font for SWFText
//f =3D newSWFBrowserFont("_sans");
//this one displays characters but the wrong accented characters
//could it be the character map in the .fdb file that's wrong?
//f =3D loadSWFFontFromFile(fopen("/home/david/devstuff/flashstuff/ming=
-examples/common/test.fdb","rb"));
f =3D loadSWFFontFromFile(fopen("/home/david/fdbfonts/fdb/CarminaLtBT.f=
db","rb"));
SWFText t =3D newSWFText();
SWFDisplayItem d;
if(f =3D=3D NULL)
{
printf("font def file not found!\n");
exit(1);
}
SWFText_setFont(t, f);
SWFText_setHeight(t, 12);
SWFText_setColor(t, 0, 0, 0, 0xff);
SWFText_setSpacing(t, 0);
//this one doesn't display the characters correctly
//so I am trying with this service instead
SWFText_addString(t, "<<FrenchSWFText =C3=A9=C3=A0i=C3=B4=C3=B6=C3=A7>>=
", NULL);
//this one still gave me the wrong accented characters
//I suspect the character maps aren't working maybe...
//SWFText_addUTF8String(t, "<<FrenchSWFText =C3=A9=C3=A0i=C3=B4=C3=B6=C3=
=A7>>", NULL);
d =3D SWFMovie_add(movie, (SWFCharacter)t);
SWFDisplayItem_move(d, 0, 100);
SWFDisplayItem_setName(d, "message2");
char myOnlyFrameAction[4000];
sprintf(myOnlyFrameAction, "message2 =3D \"<<FrenchSWFText =C3=A9=C3=A0=
i=C3=B4=C3=B6=C3=A7>>\"; ");
SWFMovie_add(movie, compileSWFActionCode(myOnlyFrameAction));
}
void testEnglishSWFTextField(SWFMovie movie)
{
SWFTextField t;
SWFFont f;
//no longer seems to work in 0.3a, this only works in 0.2a for me=20
//for either english text or french text for that matter
//f =3D loadSWFFontFromFile(fopen("/home/david/devstuff/flashstuff/ming=
-examples/common/test.fdb","rb"));
=20
//no longer seems to work in 0.3a, this only works in 0.2a for me=20
//for either english text or french text for that matter
//f =3D loadSWFFontFromFile(fopen("/home/david/fdbfonts/fdb/CarminaLtBT=
.fdb","rb"));
=20
//this works in 0.3a
//it seems only the default browser fonts work=20
//with SWFTextField at the moment.
f =3D newSWFBrowserFont("_sans");
t =3D newSWFTextField();
SWFTextField_setFont(t, f);
SWFTextField_setColor(t, 255, 0, 0, 255);
SWFTextField_setHeight(t, 12);
SWFTextField_setBounds(t, 300, 50);
SWFTextField_setAlignment(t, SWFTEXTFIELD_ALIGN_LEFT);
SWFTextField_setVariableName(t, "message");
//SWFTextField t =3D newSWFTextField();
SWFDisplayItem d;
if(f =3D=3D NULL)
{
printf("font def file not found!\n");
exit(1);
}
d =3D SWFMovie_add(movie, (SWFTextField)t);
SWFDisplayItem_move(d, 0, 100);
char myOnlyFrameAction[4000];
sprintf(myOnlyFrameAction, "message =3D \"EnglishSWFTextField\"; ");
SWFMovie_add(movie, compileSWFActionCode(myOnlyFrameAction));
SWFMovie_nextFrame(movie);
}
void testFrenchSWFTextField(SWFMovie movie)
{
SWFTextField t;
SWFFont f;
//font no longer displays in 0.3a, this only works in 0.2a for me=20
//f =3D loadSWFFontFromFile(fopen("/home/david/devstuff/flashstuff/ming=
-examples/common/test.fdb","rb"));
=20
//font no longer displays in 0.3a, this only works in 0.2a for me=20
//f =3D loadSWFFontFromFile(fopen("/home/david/fdbfonts/fdb/CarminaLtBT=
.fdb","rb"));
//shows nothing like mincho since they are for japanese characters.
//f =3D newSWFBrowserFont("Tohaba(Gothic Mono)");
//works with AddUTF8String to display french chars
//f =3D newSWFBrowserFont("_serif");
//displays characters but french accented ones only visible with=20
//AddUTFString or within actionscript which assumes utf8=20
//f =3D newSWFBrowserFont("_typewriter");
=20
//doesn't work. no characters visible accented or not accented.
//f =3D newSWFBrowserFont("Mincho");
=20
//this works in 0.3a
f =3D newSWFBrowserFont("_sans");
t =3D newSWFTextField();
SWFTextField_setFont(t, f);
SWFTextField_setColor(t, 255, 0, 0, 255);
SWFTextField_setHeight(t, 14);
SWFTextField_setBounds(t, 700, 14);
SWFTextField_setAlignment(t, SWFTEXTFIELD_ALIGN_LEFT);
SWFTextField_setVariableName(t, "message");
SWFTextField_addUTF8String(t, "FrenchUTF8 SWFTextField <<Sayo je t'aime=
en fran=C3=A7ais ;)=C3=A9=C3=A0i=C3=B6=C3=B4=C3?>>");
=20
SWFDisplayItem d;
if(f =3D=3D NULL)
{
printf("font def file not found!\n");
exit(1);
}
d =3D SWFMovie_add(movie, (SWFTextField)t);
SWFDisplayItem_move(d, 0, 28);
//this works for SWFTextField only(not SWFText)
//char myOnlyFrameAction[4000];
//sprintf(myOnlyFrameAction, "message =3D \"<<FrenchUTF8 SWFTextField =C3=
=A9=C3=A0i=C3=B4=C3=B6=C3=A7>>\"; ");
//SWFMovie_add(movie, compileSWFActionCode(myOnlyFrameAction));
//SWFMovie_nextFrame(movie);
}
void testJapaneseSWFTextField(SWFMovie movie)
{
SWFTextField t;
SWFFont f;
//f =3D loadSWFFontFromFile(fopen("/home/david/devstuff/flashstuff/ming=
-examples/common/Kochi Mincho.fdb","rb"));
//font no longer displays in 0.3a, this only works in 0.2a for me=20
//f =3D loadSWFFontFromFile(fopen("/home/david/devstuff/flashstuff/ming=
-examples/common/test.fdb","rb"));
=20
//font no longer displays in 0.3a, this only works in 0.2a for me=20
//f =3D loadSWFFontFromFile(fopen("/home/david/fdbfonts/fdb/CarminaLtBT=
.fdb","rb"));
//shows nothing like mincho since they are for japanese characters.
//f =3D newSWFBrowserFont("Tohaba(Gothic Mono)");
//works with AddUTF8String to display french chars
//f =3D newSWFBrowserFont("_serif");
//displays characters but french accented ones only visible with=20
//AddUTFString or within actionscript which assumes utf8=20
//f =3D newSWFBrowserFont("_typewriter");
=20
//doesn't work. no characters visible accented or not accented.
f =3D newSWFBrowserFont("Mincho");
=20
//this works in 0.3a
//f =3D newSWFBrowserFont("_sans");
t =3D newSWFTextField();
SWFTextField_setFont(t, f);
SWFTextField_setColor(t, 255, 0, 0, 255);
SWFTextField_setHeight(t, 12);
SWFTextField_setBounds(t, 400, 50);
SWFTextField_setAlignment(t, SWFTEXTFIELD_ALIGN_LEFT);
SWFTextField_setVariableName(t, "message");
SWFTextField_addUTF8String(t, "<<=E3??=E3??=E3??=E3??=E3??=E3?=AF=E3?=BD=
=E3?,>>");
=20
SWFDisplayItem d;
if(f =3D=3D NULL)
{
printf("font def file not found!\n");
exit(1);
}
d =3D SWFMovie_add(movie, (SWFTextField)t);
SWFDisplayItem_move(d, 0, 100);
//this works for SWFTextField only(not SWFText)
//char myOnlyFrameAction[4000];
//sprintf(myOnlyFrameAction, "message =3D \"<<FrenchSWFTextField =C3=A9=
=C3=A0i=C3=B4=C3=B6=C3=A7>>\"; ");
//SWFMovie_add(movie, compileSWFActionCode(myOnlyFrameAction));
//SWFMovie_nextFrame(movie);
}
//SWFDisplayItem_setName(d, "frmsg");
//SWFTextField_setFont(t, f);
//SWFTextField_setHeight(t, 24);
//SWFTextField_setColor(t, 0xff, 0, 0, 0xff);
// SWFTextField_setSpacing(t, 0);
//SWFTextField_setVariableName(t, "message");
//SWFTextField_addUTF8String(t, "<<FrenchSWFTextField =C3=A9=C3=A0i=C3=B4=
=C3=B6=C3=A7>>");
int main(int argc, char *argv[])
{
FILE *f;
SWFMovie m =3D newSWFMovieWithVersion(6);
int length;
Ming_init();
srand(time(NULL));
f =3D fopen("test.swf", "wb");
SWFMovie_setRate(m, 15.0);
SWFMovie_setDimension(m, WIDTH, HEIGHT);
SWFMovie_setNumberOfFrames(m, 40);
testEnglishSWFText(m);
//testEnglishSWFTextField(m);
//testFrenchSWFText(m);
testFrenchSWFTextField(m);
testJapaneseSWFText(m);
//testJapaneseSWFTextField(m);
length =3D SWFMovie_output(m, fileOutputMethod, f, -1);
destroySWFMovie(m);
printf("%i bytes written\n", length);
exit(0);
}
------------=_1074370163-28589-0
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Disposition: inline
Content-Transfer-Encoding: 7bit
_______________________________________________
ming-fun mailing list
[email protected]
http://www.opaque.net/mailman/listinfo/ming-fun
------------=_1074370163-28589-0
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Disposition: inline
Content-Transfer-Encoding: 7bit
_______________________________________________
ming-fun mailing list
[email protected]
http://www.opaque.net/mailman/listinfo/ming-fun
------------=_1074370163-28589-0--