- It doesn't use Tamarin ESC Compiler anymore.
- You can download the source code here.
Currently there are two usual ways to use embedded fonts in Flash/Flex:
- Embed the font in the application SWF.
- Or generate SWF files with the fonts, and then load them at runtime.
Click here to open an experiment I've made that does that.
What are the advantages?
- It's easy to use and share fonts between Flash/Flex applications.
- RIAs like text processors, image editors and others, can use this technique to allow users to use their own fonts.
- The font file (.ttf) is loaded and parsed.
- The glyphs are converted and a SWF file is generated in memory.
- Using the class flash.display.Loader, the in-memory SWF is loaded, and the font is registered.
- swfassist - A great work! It is a AS3 library to read and write SWF files. http://www.libspark.org/wiki/yossy/swfassist
- Tamarin ESC Compiler - Is a ES4 compiler written in ES4. The output is bytecodes to Tamarin VM (Flash Player 9 or higher). http://www.mozilla.org/projects/tamarin/
- FontReader - Library to read True Type Font files. It's an AS3 port of the java project TypeCast, made by Alessandro Crugnola. http://www.sephiroth.it/weblog/archives/2007/07/fontreader_convert_truetype_fonts_in.php
Atualmente, há duas maneiras usuais de utilizar fontes embutidas em uma aplicação Flash/Flex:
- Gerar o SWF da aplicação com a fonte embutida.
- Gerar arquivos SWF para as fontes, e carregá-los dinamicamente na aplicação.
Clique aqui para abrir um experimento que desenvolvi que faz isso.
Quais as vantagens?
- Maior facilidade na utilização de fontes compartilhadas em aplicações Flash/Flex.
- RIAs como processadores de texto, editores de imagens e outros, poderão utilizar o carregamento de fontes True Type para permitir aos usuários a utilização de suas próprias fontes.
- O arquivo da fonte (.ttf) é carregado e interpretado.
- Os caracteres da fonte são convertidos e um arquivo SWF é gerado na memória.
- Utilizando a classe flash.display.Loader é feito o carregamento desse SWF, e a fonte é registrada.
- swfassist - Um grande trabalho! É uma biblioteca em AS3 para leitura e escrita de arquivos SWF. http://www.libspark.org/wiki/yossy/swfassist
- Tamarin ESC Compiler - Compilador de ES4 escrito em ES4. Gera bytecodes para a máquina virtual Tamarin (Flash Player 9 ou superior). http://www.mozilla.org/projects/tamarin/
- FontReader - Biblioteca AS3 para a leitura de fontes True Type. Foi portada a partir do projeto em java TypeCast por Alessandro Crugnola. http://www.sephiroth.it/weblog/archives/2007/07/fontreader_convert_truetype_fonts_in.php