2012-02-07 3 views
1

TextLayoutクラス内のテキストの高さを見つける方法があるかどうか知りませんか?Find Text TextLayoutコンポーネントの高さ

私はそうのように私のTextLayoutオブジェクトを作っています:私は高さを見つけることを期待したい

 this._textFlow = new TextFlow(); 
     this._paragraphElement = new ParagraphElement(); 
     this._textFlow.addChild(this._paragraphElement); 

     this._span = new SpanElement(); 
     this._span.text = this._text; 
     this._paragraphElement.addChild(this._span); 
     if(this._textAlign != ''){ 
      this._paragraphElement.textAlign = this._textAlign; 
     } 

     var tempTextWidth:Number; 
     var tempTextHeight:Number; 
     if(this._textWidth > 0){ 
      tempTextWidth = this._textWidth; 
     } else { 
      tempTextWidth = NaN; 
     } 
     if(this._textHeight > 0){ 
      tempTextHeight = this._textHeight; 
     } else { 
      tempTextHeight = NaN; 
     } 

     this._containerController = new ContainerController(this, tempTextWidth, tempTextHeight); 
     this._textFlow.flowComposer.addController(this._containerController); 
     this._textFlow.flowComposer.updateAllControllers(); 

すべてのパブリックプロパティは、this._textFlow.lineHeightとして定義されていません。

おかげで、documentationによれば

+0

高さ関連のプロパティが値を取得する前に、一度表示する必要があります。 –

答えて

1

クリスは、lineHeightはデフォルトで定義されていない、不定の値は、行の高さは、文字の高さの120%であることを意味します。テキストの高さはfontSizeプロパティによって決まります。デフォルトでは定義されていません。つまり、テキストの高さは12です。

アプリケーションではどちらも定義されていないと仮定すると、各行の高さは1.2 * 12 = 14.4になります。免責事項:私は実際にText Layout Frameworkで作業したことがなく、この情報がどれほど信頼できるものか分かりません。

+0

チェックしてください。あなたが正しいです。 –

関連する問題