Hi Gordon,

I've found the submission patch at Adobe JIRA bug-base you've been
referring in a previous message:
http://bugs.adobe.com/jira/browse/SDK-16641

While I fully welcome this fix, it does not suit my needs precisely.

I've studied  source code of <mx:Text> private function
"measureUsingWidth(widthValue)" and that was closer to solve my task.

I've reused this method in my custom Text component to take into
account the values of "blockIndent" values specified to all TextFormat
applied to the textField under the question while measuring the width
for this component in override protected "measure" method.

To return the Array of all TextFormats applied to the textField I rely
on undocumented Flash Player API  - flash.text.TextRun
http://nondocs.blogspot.com/2007/05/flashtexttextrun.html - is it OK
to rely on undocumented Flash Player API in our projects?

Then, I calculate the maximum BLOCKINDENT value within all TextFormats
objects found for the textField and then I make sure in my "|measure"
method for my Text component to take this maximum BLOCKINDENT value
into the consideration, e.g

measuredWidth = Math.max(MIN_TEXT_HEIGHT,
Math.ceil(textField.textWidth) + UITextField.TEXT_WIDTH_PADDING +
maxParagraphIndentValue);


2008/11/4 Gordon Smith <[EMAIL PROTECTED]>:
> It sounds like a Player quirk that the Flex framework needs to work around.
> I think a fix went in to the measure() method of UITextFormat recently for a
> similar problem with 'indent'. You should file a bug. And if you file a
> patch, it is likely to get fixed sooner.
>
>
>
> - Gordon
>
>
>
> From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
> Behalf Of Andriy Panas
> Sent: Monday, November 03, 2008 2:38 PM
> To: flexcoders@yahoogroups.com
> Subject: [flexcoders] Does UIComponent.measureHTMLText(htmlText) method
> takes TextFormat.blockIndent value into the account when calculating width
> value of TextLineMetrics object?
>
>
>
> Hi all,
>
> Accordingly to my tests, method "textField.getLineMetrics(0)" that
> lays in the core of "UIComponent.measureHTMLText(htmlText)" returns
> TextLineMetrics object with the value for the "width" property that is
> calculated regardless from the value specified for
> "textFormat.blockIndent" value applied to the textField in question.
>
> Is that an intentional behavior?
> --
> Med venlig hilsen / Best regards
> Andriy Panas
> [EMAIL PROTECTED]
>
> 



-- 
--
Med venlig hilsen / Best regards
Andriy Panas
[EMAIL PROTECTED]

Reply via email to