home *** CD-ROM | disk | FTP | other *** search
/ 404 Jogos / CLJG.iso / Puzzle / filler.swf / scripts / mx / core / UITextFormat.as < prev   
Text File  |  2008-09-02  |  3KB  |  109 lines

  1. package mx.core
  2. {
  3.    import flash.text.TextField;
  4.    import flash.text.TextFormat;
  5.    import flash.text.TextLineMetrics;
  6.    import mx.managers.ISystemManager;
  7.    
  8.    use namespace mx_internal;
  9.    
  10.    public class UITextFormat extends TextFormat
  11.    {
  12.       
  13.       mx_internal static const VERSION:String = "2.0.1.0";
  14.       
  15.       private static var measurementTextField:TextField;
  16.        
  17.       
  18.       public var sharpness:Number;
  19.       
  20.       public var gridFitType:String;
  21.       
  22.       public var antiAliasType:String;
  23.       
  24.       public var thickness:Number;
  25.       
  26.       private var systemManager:ISystemManager;
  27.       
  28.       public function UITextFormat(param1:ISystemManager, param2:String = null, param3:Object = null, param4:Object = null, param5:Object = null, param6:Object = null, param7:Object = null, param8:String = null, param9:String = null, param10:String = null, param11:Object = null, param12:Object = null, param13:Object = null, param14:Object = null)
  29.       {
  30.          this.systemManager = param1;
  31.          super(param2,param3,param4,param5,param6,param7,param8,param9,param10,param11,param12,param13,param14);
  32.       }
  33.       
  34.       public function measureText(param1:String) : TextLineMetrics
  35.       {
  36.          return measure(param1,false);
  37.       }
  38.       
  39.       mx_internal function copyFrom(param1:TextFormat) : void
  40.       {
  41.          font = param1.font;
  42.          size = param1.size;
  43.          color = param1.color;
  44.          bold = param1.bold;
  45.          italic = param1.italic;
  46.          underline = param1.underline;
  47.          url = param1.url;
  48.          target = param1.target;
  49.          align = param1.align;
  50.          leftMargin = param1.leftMargin;
  51.          rightMargin = param1.rightMargin;
  52.          indent = param1.indent;
  53.          leading = param1.leading;
  54.       }
  55.       
  56.       public function measureHTMLText(param1:String) : TextLineMetrics
  57.       {
  58.          return measure(param1,true);
  59.       }
  60.       
  61.       private function measure(param1:String, param2:Boolean) : TextLineMetrics
  62.       {
  63.          var _loc3_:ISystemManager = null;
  64.          var _loc4_:TextLineMetrics = null;
  65.          if(!param1)
  66.          {
  67.             param1 = "";
  68.          }
  69.          if(!measurementTextField)
  70.          {
  71.             measurementTextField = new TextField();
  72.          }
  73.          if(param2)
  74.          {
  75.             measurementTextField.htmlText = "";
  76.          }
  77.          else
  78.          {
  79.             measurementTextField.text = "";
  80.          }
  81.          measurementTextField.defaultTextFormat = this;
  82.          _loc3_ = systemManager;
  83.          if(font)
  84.          {
  85.             measurementTextField.embedFonts = _loc3_ != null && _loc3_.isFontFaceEmbedded(this);
  86.          }
  87.          else
  88.          {
  89.             measurementTextField.embedFonts = false;
  90.          }
  91.          measurementTextField.antiAliasType = antiAliasType;
  92.          measurementTextField.gridFitType = gridFitType;
  93.          measurementTextField.sharpness = sharpness;
  94.          measurementTextField.thickness = thickness;
  95.          if(param2)
  96.          {
  97.             measurementTextField.htmlText = param1;
  98.          }
  99.          else
  100.          {
  101.             measurementTextField.text = param1;
  102.          }
  103.          (_loc4_ = measurementTextField.getLineMetrics(0)).width = Math.ceil(_loc4_.width);
  104.          _loc4_.height = Math.ceil(_loc4_.height);
  105.          return _loc4_;
  106.       }
  107.    }
  108. }
  109.