- 2022.03.28 Monday
- スポンサーサイト
-
一定期間更新がないため広告を表示しています
- | スポンサードリンク | - | | - | - | pookmark |
- 2010.08.18 Wednesday
- FlashDevelopでフォント埋め込み
-
FlashDevelopでフォント埋め込み 検索すると沢山でてくるけど。
いろんなところのサンプルとか使ってもなぜか埋め込みできなかったので
ハマった。
でもやっとハマらないパターンをまたqfilmsの中で見つけた、
FontAsset;//これが意味がわからなかったけど
importしても classへの参照がないとコンパイル時に消えちゃうって事らしい。
※それ以外になぜか埋め込みできない状況になることがflexSDK4.1だとなぜかあって、
FlexSDKを3まで戻したら使えるように戻った。
埋め込みできた環境
FlashDevelop3.2.2RTM
ツール環境設定>AS3 Context Flex SDK Location
C:¥flex_sdk_3
プロジェクト設定>書き出し>プレーヤーバージョン設定
flashplayer9 -OK
flashplayer10 -OK
flashplayer10.1-なぜ出てくる? -OK
なんかちがうらしくて。
C:¥flex_sdk_4のときは
FlashPlayer 10 は新しいテキストエンジン (FTE/Flash Text Engine) が搭載された影響で
Embedの書き方が違うらしい。
http://blog.kaihatsubu.com/archives/001697.html
package { public class FontAsset { // if you want to embed font, add font to folder and out under line. //FlexSDK3 //[Embed(source="/assets/Bebas.ttf", fontName="myfont")] //FlexSDK4 [Embed(source="/assets/Bebas.ttf", fontName="myfont", embedAsCFF='false')] private var font:Class; public function FontAsset() { trace("----------FontAsset------------") // throw new Error("you cannot create FontAsset Class instance") } } }
package { import flash.display.Sprite; import flash.events.Event; import flash.text.AntiAliasType; import flash.text.TextField; import flash.text.TextFieldAutoSize; import flash.text.TextFormat; import FontAsset; /** * ... * @author */ public class Main extends Sprite { private var textField:TextField; public function Main():void { if (stage) init(); else addEventListener(Event.ADDED_TO_STAGE, init); } private function init(e:Event = null):void { removeEventListener(Event.ADDED_TO_STAGE, init); // entry point textField = new TextField(); textField.selectable = false; textField.mouseEnabled = false; textField.autoSize = TextFieldAutoSize.LEFT; // if you use embed font, please comment out textField.embedFonts = true; textField.x = 10; textField.y = 1; addChild(textField) var textFormat:TextFormat = new TextFormat(); textFormat.font = "myfont"; textFormat.bold = true; textFormat.size = 48; textField.antiAliasType = AntiAliasType.ADVANCED; textField.defaultTextFormat = textFormat; textField.text = "ABCDEF" var font:FontAsset=new FontAsset(); } } }
- | whaison | ActionScript3.0 | 21:05 | comments(1) | - | pookmark |
- Comment
-
-
ありがとう!!!!!
「embedAsCFF='false'」で表示できました。
- 感謝!!, 2014/12/24 11:34 PM
-
ありがとう!!!!!