The method that was patched, looks like this:
/** Returns the FontMetrics object for the span. The properties of the 
FontMetrics object describe the * emBox, strikethrough position, strikethrough 
thickness, underline position, * and underline thickness for the specified 
font. ** @playerversion Flash 10* @playerversion AIR 1.5* @langversion 3.0** 
@see flash.text.engine.FontMetrics * @see 
flash.text.engine.ElementFormat#getFontMetrics()** @return font metrics 
associated with the span*/public function getComputedFontMetrics():FontMetrics{ 
       if (!_blockElement)             createContentElement();                  
        var ef:ElementFormat = _blockElement.elementFormat;             if 
(!ef) return null;           var fontMetrics:FontMetrics;        var 
tf:TextFlow = getTextFlow();
        if (tf && tf.flowComposer && tf.flowComposer.swfContext)            
fontMetrics = 
tf.flowComposer.swfContext.callInContext(ef.getFontMetrics,ef,null,true);
       if (fontMetrics==null)           fontMetrics = ef.getFontMetrics();
       fontMetrics.underlineOffset = 0;
       return fontMetrics;}
> From: miguel.cd.ferre...@hotmail.com
> To: users@flex.apache.org
> Subject: RE: Text flow underline
> Date: Mon, 1 Jul 2013 08:45:34 +0100
> 
> So the solution is monkey-patching that class.
> Also he have the tlf_internal method calculateUnderlineOffset that can be 
> useful.
> Once more again Alex, thank you for the information.
> @Justin: Thanks for the help and the reply.
> The solution is posted here, for future search.
> Thanks,Miguel
> PS: Flex can and will overcome everything! ;)
> 
> > From: miguel.cd.ferre...@hotmail.com
> > To: users@flex.apache.org
> > Subject: RE: Text flow underline
> > Date: Fri, 28 Jun 2013 18:17:13 +0000
> > 
> > Thanks for the valuable info as always.
> > 
> > I will give it  a try.
> > 
> > 
> > 
> > Sent from Windows Mail
> > 
> > 
> > From: Alex Harui
> > Sent: ‎28‎ ‎June‎ ‎2013 ‎20‎:‎06
> > To: users@flex.apache.org
> > Subject: Re: Text flow underline
> > 
> > 
> > 
> > Yeah, there doesn't appear to be a connection between the TLF
> > configuration and FontMetrics.  I haven't proven it in the debugger, but
> > it appears that underlines are handled in TLF in FlowLeafElement.as.
> > There is a method in there called getComputedFontMetrics.  You could try
> > monkey patching that.
> > 
> > If you don't like monkey-patching and are using embedded fonts, there
> > might be a way to intercept in the swfContext API.
> > 
> > -Alex 
> > 
> > On 6/28/13 8:29 AM, "Miguel Ferreira" <miguel.cd.ferre...@hotmail.com>
> > wrote:
> > 
> > >Hi Alex,
> > >Is truly rich, is a web to print solution Enterprise application that i
> > >join on the last 5 months.
> > >Why i wish a solution like this:To make what the user see on the web  and
> > >get it on the PDF.The PDF creator uses SVG embebed fonts and when the
> > >user set underline we have different results.
> > >I could draw the lines with the example of justin from the post:
> > >--------------------------------------------------------------------------
> > >------------From inside createTextLinesFromTextBlock method in
> > >FTETextField.                    // FTE doesn't render underlines,
> > >            // but it can tell us where to draw them.
> > >// You can't draw in a TextLine but it can have children,
> > >   // so we create a child Shape to draw them in.
> > >               var fontMetrics:FontMetrics;                    if
> > >(fontContext)                        fontMetrics =
> > >fontContext.callInContext(elementFormat.getFontMetrics, elementFormat,
> > >[]);                    else                        fontMetrics =
> > >elementFormat.getFontMetrics();
> > >var shape:Shape = new Shape();                    var g:Graphics =
> > >shape.graphics;   
> > >g.lineStyle(fontMetrics.underlineThickness,
> > >elementFormat.color, elementFormat.alpha);                    g.moveTo(0,
> > >fontMetrics.underlineOffset);
> > >g.lineTo(textLine.textWidth, fontMetrics.underlineOffset);
> > >--------------------------------------------------------------------------
> > >------------
> > >but i don't know on the RTE where i can override the TextBlock that
> > >creates the textlines/underline.
> > >In on component RTE all the text is underline i dont have parcial text
> > >underline.
> > >
> > >I have my extended RTE with just textValidation (if font have glyph) and
> > >font face validation.
> > >
> > >What looks easy to underline gap and thickness is not so easy i tough
> > >that i could add this to TLF configuration but not.What i read is that
> > >FontMetrics have the metrics of the embebed fonts as i said i tried to
> > >fake this class but also with no success..(maybe the wrong
> > >solution/perspective).
> > >
> > >
> > >
> > >
> > >> From: aha...@adobe.com
> > >> To: users@flex.apache.org
> > >> Date: Fri, 28 Jun 2013 08:14:11 -0700
> > >> Subject: Re: Text flow underline
> > >> 
> > >> Hi Miguel,
> > >> 
> > >> I think RET uses TLF to draw the underlines which relies on FontMetrics.
> > >> Is this text truly "rich" (different font families, sizes and styles) or
> > >> single font?
> > >> 
> > >> -Alex
> > >> 
> > >> On 6/28/13 7:57 AM, "Miguel Ferreira" <miguel.cd.ferre...@hotmail.com>
> > >> wrote:
> > >> 
> > >> >Hi Justin and Alex,
> > >> >I am using RichEditableText. (When i enter on this project that option
> > >> >was already taken).I tried to convince them to use a smaller component
> > >>to
> > >> >present the text and use a heavy one for edition, but without success.
> > >> >@Justin: i am checking now that link.
> > >> >If i have some good solution i will try to post it here.
> > >> >
> > >> >> From: aha...@adobe.com
> > >> >> To: users@flex.apache.org
> > >> >> Date: Fri, 28 Jun 2013 07:38:25 -0700
> > >> >> Subject: Re: Text flow underline
> > >> >> 
> > >> >> Are you using a Flex component like RichText or Label?  Or are you
> > >>just
> > >> >> using TLF or FTE directly?
> > >> >> 
> > >> >> On 6/28/13 4:10 AM, "Miguel Ferreira"
> > >><miguel.cd.ferre...@hotmail.com>
> > >> >> wrote:
> > >> >> 
> > >> >> >Hi Alex,
> > >> >> >Thank you for the help... you always have time to say something..
> > >>that
> > >> >>is
> > >> >> >admirable!
> > >> >> >The FontMetrics class have all the information about of the font on
> > >> >>this
> > >> >> >case:- underlineOffset- underlineThickness
> > >> >> >I tried to fake it (maybe wrongly)!
> > >> >> >I create a class with the same name and same package on the src,
> > >>hoping
> > >> >> >that the compiler will use my class instead the one on the sdk, with
> > >> >>this
> > >> >> >constructor, code example:
> > >> >> >public function FontMetrics(emBox:Rectangle,
> > >> >>strikethroughOffset:Number,
> > >> >> >strikethroughThickness:Number, underlineOffset:Number,
> > >> >> >underlineThickness:Number, subscriptOffset:Number,
> > >> >>subscriptScale:Number,
> > >> >> >superscriptOffset:Number, superscriptScale:Number)                {  
> > >> >> >                     this.emBox
> > >>=
> > >> >> >emBox;                                           
> > >> >> >this.strikethroughOffset =
> > >> >> >strikethroughOffset;                     this.strikethroughThickness 
> > >> >> >=
> > >> >> >strikethroughThickness;                                          
> > >> >> >this.subscriptOffset =
> > >> >> >subscriptOffset;                 this.subscriptScale =
> > >> >> >subscriptScale;                                          
> > >> >> >this.superscriptOffset =
> > >> >> >superscriptOffset;                       this.superscriptScale =
> > >> >> >superscriptScale;                                                
> > >> >> >this.underlineOffset =
> > >> >> >0;                       this.underlineThickness = 10;           }
> > >> >> >
> > >> >> >but when i trace the the underline properties i never the 0 and 10.
> > >> >> >Even if the compiler get the project class instead of the SDK i also
> > >> >> >don't know if the text line engine will use this values...
> > >> >> >If someone have some idea... they are welcome!
> > >> >> >Thank you,Miguel
> > >> >> >
> > >> >> >> From: aha...@adobe.com
> > >> >> >> To: users@flex.apache.org
> > >> >> >> Date: Thu, 27 Jun 2013 13:04:43 -0700
> > >> >> >> Subject: Re: Text flow underline
> > >> >> >> 
> > >> >> >> I don't know for sure, but you can try manipulating the
> > >>fontMetrics.
> > >> >> >>See
> > >> >> >> flash.text.engine.FontMetrics
> > >> >> >> 
> > >> >> >> On 6/27/13 7:30 AM, "Miguel Ferreira"
> > >> >><miguel.cd.ferre...@hotmail.com>
> > >> >> >> wrote:
> > >> >> >> 
> > >> >> >> >Hi guys,
> > >> >> >> >i have a question :)
> > >> >> >> >Can we set the padding between letter and the underline?
> > >> >> >> >maybe 2 questions!
> > >> >> >> >Can we set the thickness of the underline?
> > >> >> >> >
> > >> >> >> >Thanks!                                    
> > >> >> >> 
> > >> >> >                                
> > >> >> 
> > >> >                                   
> > >> 
> > >
>                                         
                                          

Reply via email to