Re: Some discoveries about multilingual .swf's with ming 0.3a
[email protected] (Wolfgang Hamann) Sat, 17 Jan 2004 00:08:06 +0100 (CET)
| Newsgroups | gmane.comp.web.ming.general |
|---|---|
| Message-ID | <wolfgang-1040117000805.A0122813@loopback> |
>>
>> SWFText
>> -------
>> version 0.3a
>> I can't use the default web browser fonts with the SWFText object...period.
I have seen a mention somewhere in some flash manual about using browser fonts with
static text / SWFText, but I have no idea how this is supposed to work
(and as far as I recall, when somebody tried it in flash, the result was a text field)
>> 1)I can't use any ttf2fft/makefdb generated .fdb files with this. They don't
>> appear...period.
>> 2)I can however use the default web browser fonts such as _sans, _serif,
>> _typewriter, ...
>> 3)the French characters display correctly when using addUTF8String but not
>> addString.
french characters probably are encoded as iso-latin-1 while flash now prefers unicode
You could try to place actionscript
System.useCodePage
on first frame - if the special codes work, the fonts are isolatin
On the other side this would mean that we need some way to reencode codepage fonts as
unicode.... Oops - did not see code example first; the bitstream fonts are definitely codepage,
and your french example is unicode
Wolfgang
>> 4)the Japanese characters don't display at all since I can't seem to find the
>> right name for the "Mincho" font. In my mind, this should work, since all
>> Japanese fonts are installed on my machine.
>>
>> Actionscript works with SWFTextField. I set a name for the SWFTextField and it
>> worked for English and French. Being that I couldn't use the japanese font, I
>> couldn't get to see this working with japanese strings yet.
>>
>> Conclusion:
>> -----------
>> To display stuff and animate stuff though, ming is definitely there.
>> For inputting typed data with either japanese/french/english at the same time
>> through ming/.swf however, IMHO it's not there yet on my machine.
>>
>> I think we should be able to achieve this considering there are built-in web
>> browser fonts that we should be able to access but I haven't succeeded yet for
>> jp mincho. Any suggestions or ideas for this? The Flash format spec v7.0
>> clearly shows the mincho font as one of the default web browser fonts available.
>>
>> I have attached a test2.c file demonstrating some of my observations.
>>
>> Tangent...I noticed in the v7.0 spec that the actionscript stack doesn't use
>> boundaries when describing an action. I also noticed that some of the string
>> objects are still using null-terminated strings instead of providing boundaries
>> i.e. begin and end with a string length. Something tells me it would be safer.
>> It's not a ming issue as such but a Flash Player issue I think.
>>
>> Cheers,
>> David Marceau
>> --------------5013F75382CA82F07EC76E38
>> Content-Type: text/plain; charset=iso-8859-1;
>> name="test2.c"
>> Content-Transfer-Encoding: 8bit
>> Content-Disposition: inline;
>> filename="test2.c"
>>
>> #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 = 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"));
>> SWFText t = newSWFText();
>> SWFDisplayItem d;
>>
>> if(f == 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 = SWFMovie_add(movie, (SWFCharacter)t);
>> SWFDisplayItem_move(d, 0, 14);
>> }
>>
>> void testJapaneseSWFText(SWFMovie movie)
>> {
>> SWFFont f;
>>
>> f = loadSWFFontFromFile(fopen("/home/david/devstuff/flashstuff/ming-examples/common/Kochi Mincho.fdb","rb"));
>> //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"));
>> SWFText t = newSWFText();
>> SWFDisplayItem d;
>>
>> if(f == 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 <<ã?*ã,^ï¼? ã,?ã?Yã?-ã?¯ ã?,ã?ªã?Yã,? ã?,ã??ã?-ã?¦ã??ã?¾ã??ã?,>>", NULL);
>>
>> d = 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 = 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 = loadSWFFontFromFile(fopen("/home/david/devstuff/flashstuff/ming-examples/common/test.fdb","rb"));
>> f = loadSWFFontFromFile(fopen("/home/david/fdbfonts/fdb/CarminaLtBT.fdb","rb"));
>> SWFText t = newSWFText();
>> SWFDisplayItem d;
>>
>> if(f == 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 éà iôöç>>", NULL);
>>
>> //this one still gave me the wrong accented characters
>> //I suspect the character maps aren't working maybe...
>> //SWFText_addUTF8String(t, "<<FrenchSWFText éà iôöç>>", NULL);
>>
>> d = SWFMovie_add(movie, (SWFCharacter)t);
>> SWFDisplayItem_move(d, 0, 100);
>> SWFDisplayItem_setName(d, "message2");
>> char myOnlyFrameAction[4000];
>> sprintf(myOnlyFrameAction, "message2 = \"<<FrenchSWFText éà iôöç>>\"; ");
>> 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
>> //for either english text or french text for that matter
>> //f = loadSWFFontFromFile(fopen("/home/david/devstuff/flashstuff/ming-examples/common/test.fdb","rb"));
>>
>> //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/fdbfonts/fdb/CarminaLtBT.fdb","rb"));
>>
>> //this works in 0.3a
>> //it seems only the default browser fonts work
>> //with SWFTextField at the moment.
>> f = newSWFBrowserFont("_sans");
>> t = 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 = newSWFTextField();
>> SWFDisplayItem d;
>>
>> if(f == NULL)
>> {
>> printf("font def file not found!\n");
>> exit(1);
>> }
>>
>> d = SWFMovie_add(movie, (SWFTextField)t);
>> SWFDisplayItem_move(d, 0, 100);
>>
>> char myOnlyFrameAction[4000];
>> sprintf(myOnlyFrameAction, "message = \"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
>> //f = loadSWFFontFromFile(fopen("/home/david/devstuff/flashstuff/ming-examples/common/test.fdb","rb"));
>>
>> //font no longer displays in 0.3a, this only works in 0.2a for me
>> //f = loadSWFFontFromFile(fopen("/home/david/fdbfonts/fdb/CarminaLtBT.fdb","rb"));
>>
>> //shows nothing like mincho since they are for japanese characters.
>> //f = newSWFBrowserFont("Tohaba(Gothic Mono)");
>>
>> //works with AddUTF8String to display french chars
>> //f = newSWFBrowserFont("_serif");
>>
>> //displays characters but french accented ones only visible with
>> //AddUTFString or within actionscript which assumes utf8
>> //f = newSWFBrowserFont("_typewriter");
>>
>>
>> //doesn't work. no characters visible accented or not accented.
>> //f = newSWFBrowserFont("Mincho");
>>
>> //this works in 0.3a
>> f = newSWFBrowserFont("_sans");
>>
>> t = 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çais ;)éà iöô�>>");
>>
>> SWFDisplayItem d;
>>
>> if(f == NULL)
>> {
>> printf("font def file not found!\n");
>> exit(1);
>> }
>>
>> d = SWFMovie_add(movie, (SWFTextField)t);
>> SWFDisplayItem_move(d, 0, 28);
>>
>> //this works for SWFTextField only(not SWFText)
>> //char myOnlyFrameAction[4000];
>> //sprintf(myOnlyFrameAction, "message = \"<<FrenchUTF8 SWFTextField éà iôöç>>\"; ");
>> //SWFMovie_add(movie, compileSWFActionCode(myOnlyFrameAction));
>> //SWFMovie_nextFrame(movie);
>> }
>>
>> void testJapaneseSWFTextField(SWFMovie movie)
>> {
>> SWFTextField t;
>> SWFFont f;
>>
>>
>> //f = 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
>> //f = loadSWFFontFromFile(fopen("/home/david/devstuff/flashstuff/ming-examples/common/test.fdb","rb"));
>>
>> //font no longer displays in 0.3a, this only works in 0.2a for me
>> //f = loadSWFFontFromFile(fopen("/home/david/fdbfonts/fdb/CarminaLtBT.fdb","rb"));
>>
>> //shows nothing like mincho since they are for japanese characters.
>> //f = newSWFBrowserFont("Tohaba(Gothic Mono)");
>>
>> //works with AddUTF8String to display french chars
>> //f = newSWFBrowserFont("_serif");
>>
>> //displays characters but french accented ones only visible with
>> //AddUTFString or within actionscript which assumes utf8
>> //f = newSWFBrowserFont("_typewriter");
>>
>>
>> //doesn't work. no characters visible accented or not accented.
>> f = newSWFBrowserFont("Mincho");
>>
>> //this works in 0.3a
>> //f = newSWFBrowserFont("_sans");
>>
>> t = 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, "<<ã??ã??ã??ã??ã??ã?¯ã?½ã?,>>");
>>
>> SWFDisplayItem d;
>>
>> if(f == NULL)
>> {
>> printf("font def file not found!\n");
>> exit(1);
>> }
>>
>> d = SWFMovie_add(movie, (SWFTextField)t);
>> SWFDisplayItem_move(d, 0, 100);
>>
>> //this works for SWFTextField only(not SWFText)
>> //char myOnlyFrameAction[4000];
>> //sprintf(myOnlyFrameAction, "message = \"<<FrenchSWFTextField éà iôöç>>\"; ");
>> //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 éà iôöç>>");
>>
>>
>> int main(int argc, char *argv[])
>> {
>> FILE *f;
>> SWFMovie m = newSWFMovieWithVersion(6);
>> int length;
>>
>> Ming_init();
>>
>> srand(time(NULL));
>>
>> f = 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 = SWFMovie_output(m, fileOutputMethod, f, -1);
>> destroySWFMovie(m);
>>
>> printf("%i bytes written\n", length);
>>
>> exit(0);
>> }
>>
>> --------------5013F75382CA82F07EC76E38
>> Content-Type: text/plain; charset="us-ascii"
>> MIME-Version: 1.0
>> Content-Transfer-Encoding: 7bit
>> Content-Disposition: inline
>>
>> _______________________________________________
>> ming-fun mailing list
>> [email protected]
>> http://www.opaque.net/mailman/listinfo/ming-fun
>>
>> --------------5013F75382CA82F07EC76E38--
>>
>>