From: Darren C. <da...@dc...> - 2004-11-18 01:14:34
|
> So, a question - does Ming supports wide code fonts? I've successfully built and used the KochiGothic font to display Japanese. It was quite a few months back and all I remember is I had to jump through lots of hoops. Looking in the subdirectories where I have the font, I seem to be using ttf2fft (its readme included below [1]). I think I was following instructions in the ming wiki? I'm also using the cvs version of ming; I don't know if wide-code support was added after 0.3 was released? [2] below shows the php script I used to test Japanese from both ming and from actionscript. The text.2.txt file was in UTF-8 encoding. Notice how I have to use the UTF8 versions of functions. Incidentally after a biggish project I came to the conclusion that fonts in ming is just too inflexible, and now always use actionscript to draw text if at all possible. Darren [1]: ttf2fft is a part of JGenerator. This product includes software developed by Dmitry Skavish (sk...@us..., http://www.flashgap.com/). See attached file 'LICENCE'. Original codes are fetched from CVS. cvs -d:pserver:ano...@cv...:/cvsroot/jgen login cvs -z3 -d:pserver:ano...@cv...:/cvsroot/jgen co jgen/ttf2fft Some modifications by goto <ha...@li...>: - makefile is attached. - ttf2fft.cxx is modified for freetype 2.10 or higher. Ref: * ttf2fft problem and patch http://sourceforge.net/tracker/index.php?func=detail&aid=830694&group_id=18365&atid=118365 or * ttf2fft-Kern0_Pair.patch http://www.momonga-linux.org/cvsweb/cvsweb.cgi/pkgs/jaming/ - ttf2fft.cxx is modified to fix a multibyte charmap bug. [2]: <?php $s=file_get_contents("text.2.txt"); if(!$s)exit; $w=600; $h=300; ming_useswfversion(6); $f = new SWFFont("kg.fdb"); $t = new SWFText(); $t->setFont($f); $t->setColor(0xff, 0xff, 0); $t->setHeight(60); $t->addUTF8String($s); $m = new SWFMovie(); $m->setDimension($w, $h); $i = $m->add($t); $i->moveTo(($w/2)-$t->getUTF8Width($s)/2, ($h/2)+$t->getAscent()/2); $code=''; $code.='this.createTextField("mytxt",1,0,0,200,200);'; $code.='this.mytxt.text="'.$s.'";'; $code.='stop();'; //No looping $m->add(new SWFAction($code)); $m->save("text.2.swf",9); //Compressed ?> |