Re: Again: textfield charset problems :(
[email protected] (Wolfgang Hamann) Tue, 4 Nov 2003 23:25:27 +0100 (CET)
| Newsgroups | gmane.comp.web.ming.general |
|---|---|
| Message-ID | <wolfgang-1031104232526.A0B15735@loopback> |
Hi
ming cvs supports utf in two ways: if you use a unicode font, the addutf8string()
functions treats its input as utf8 and uses it to access characters from the 16 bit
code table. The normal addstring() treats input as 8-bit (iso-latin-1) text with a unicode
font.
If you use old (8-bit) fonts, the same codepage is used as in your font, and text should
also be 8-bit (codepage)
With text fields, the behaviour is the same as in flash - unless you use set the System.codepage
actionscript thingy, input sent to a textfield should be utf8
Ming textfield functions with and without utf8 just copy bytes to the text field... they differ once
the characters are automatically embedded.
In order to get fonts embedded, you need to
- specify an existing font (i.e. a .fdb file)
- use the SWFTEXTFIELD_USEFONT flag for the text field
- have at least 1 character added either from an addstring() or addchars() call
For use with actionscripted textfields, rather than ones created at design time, you cannot
embed the font in the usual way - it rather has to be made into what macromedia describes
as a "font symbol". It is used similar to a library movie clip
$movie->addExport($movieclip, "myclip");
$fc = $movie->addFont($font);
$fc->addChars(" ABC abc 0123");
$movie->addExport($fc, "myfont");
(So you would use "myfont" to refer to the font from your text field)
BTW: you can save the library as a separate swf and import stuff from it
$myclip = $movie->importchar("library.swf", "myclip");
$font = $movie->importfont("library.swf", "myfont");
This feature was announced for flash 5 and never worked when testing (the font part,
clips are fine) and works sometimes with swf6 files
Imported fonts only work with text fields - it should be possible to use them with static
text but the code simply is not there.
While importing seems to be a good idea, it often is not that useful: trying to import
dynamically requires some server tricks (i.e. your movie statically asks for fontlib.swf,
while actionscript can name the required font at runtime. A php session makes it possible
to deliver a specific font to this request)
SWF6 brought forth a new font tag which is not yet used by ming. It is not entirely clear
whether it is really needed, or even useful
Wolfgang