본문 바로가기

Actionscript3.0

[AS3.0] EmbedFonts 관리 하기

embededFonts 를 사용한 TextField , TextArea , TextInput  폰트 관리 하는 방법 입니다.  

 
  1. var hyfont:Font = new HYKANG();            // 할 필요 없음
  2.  
  3. var format:TextFormat = new TextFormat();
  4. format.font = hyfont.fontName;                 // format.font = "폰트이름"; 으로 대체 가능
  5. format.bold = true;
  6. format.size = 15;
  7.  
  8. atxt.text = "플래시 액션스크립트 카페, 정기 스터디 모임, 우왕 굿";       // TextArea
  9. atxt.setStyle("antiAliasType", AntiAliasType.ADVANCED);
  10. atxt.setStyle("embedFonts", true);
  11. atxt.setStyle("textFormat",format);
  12.  
  13. itxt.text = "플래시 액션스크립트 카페, 정기 스터디 모임, 우왕 굿";       // TextInput
  14. itxt.setStyle("antiAliasType", AntiAliasType.ADVANCED);
  15. itxt.setStyle("embedFonts", true);
  16. itxt.setStyle("textFormat",format);
  17.  
  18. dtxt.text = "플래시액션스크립트 카페, 정기 스터디 모임, 우왕 굿";       // TextField
  19. dtxt.antiAliasType = AntiAliasType.ADVANCED;
  20. dtxt.embedFonts = true;
  21. dtxt.setTextFormat(format);
  22.  

 

보통 한글 폰트를 embed 없이 사용하면 깨짐 현상이 발생하는데 그 현상을 없애주는 방법 입니다. 

라이브러리 - > New Font - >

Name : 자신이 확인가능한 이름

Fonts : embed 하고 싶은 폰트  

이렇게 라이브 러리에 새로운 폰트를 만든후에 그 해당 폰트를 적용 시켜 주면 깨짐이 없이 컴파일이 됨니다.

Properties 창에 있는 Embed... 버튼으로 적용해 줄수 있지만, 동적으로 TextField 나 TextArea , TextInput 을 생성했을때는 위와 같은 방법으로 사용하여야 합니다.