2012-02-07 3 views
1

TextLayout 클래스 내에서 텍스트의 높이를 찾는 방법이 있는지 아는 사람 있습니까?텍스트 찾기 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 여야합니다. 면책 조항 : 저는 실제로 텍스트 레이아웃 프레임 워크를 사용한 적이 없으며이 정보가 얼마나 신뢰할 수 있는지 알지 못합니다.

+0

그것을 검사하십시오; 당신 말이 맞아요. –