Hi LiuTao,

I couldn't resist to prove that my suggestion would work as expected... ;)

The attached patch works in edit mode as well as in paint mode.

I only did some quick test and verified the values in the debugger (for
lines w/o font changes, nAdjust must always be 0, in all modes).

NO manipulations of font align and NO addition to VCL's enum
needed/wanted. NO extra work in drawing layer needed, because everything
still is baseline.

Note: TOP will only look as expected when using upper case (or Chinese)
characters. Lower case characters will have some space above.

HTH,
Malte.


JiaXiang Liu wrote, On 12/10/09 04:28:
> 2009/12/9 Malte Timmermann <[email protected]>
> 
>>
>> JiaXiang Liu wrote, On 12/09/09 12:10:
>>  > Hi all
>>> 2009/12/9 Malte Timmermann <[email protected]>
>>>
>>>> JiaXiang Liu wrote, On 12/09/09 10:24:
>>>>> Hello all,
>>>>>
>>>>> 2009/12/8 Malte Timmermann <[email protected]>
>>>>>
>>>>>> I didn't review the patch, but just took a quick look.
>>>>>>
>>>>>> FontAlign is probably the wrong wording here at all.
>>>>>>
>>>>>> What you want to achieve is alignment of a text line.
>>>>>> You should probably better call it TextLineAlignment or something like
>>>>>> that.
>>>>>>
>>>>>>
>>>>> OK,I will modify it.
>>>>>
>>>>>> Again - all calculations need to be dome in some upper layer, eg.
>>>>>> EditEngine. Assuming that we really talk about text lign alignment,
>>>>>> there is no need/reason to add a new enum in VCL.
>>>>>>
>>>>> I only added a item in old enum in VCL. ALIGN_CENTER. you needn't to
>> care
>>>>> it. assume it is no use.
>>>> If it is of no use, it shouldn't be introduced. No one will accept to
>>>> have it in VCL then.
>>>>
>>>>>> As I said, do the implementation in impedit3.cxx.
>>>>>> Instead of the suggestion in my first email, don't use
>> ALIGN_TOP/BOTTOM
>>>>>> at all, but use the font metrics to calculate the correct position so
>>>>>> that the normal output with ALIGN_BASELINE works.
>>>>>>
>>>>>>
>>>>> I want to know where(which function?) can I use the font metrics to
>>>>> calculate the correct position? and
>>>>> how to use the font metrics to calculate?
>>>> Look in impedit3.cxx, CreateLines. There you can see how the Ascent and
>>>> Descent from the FormatterFontMetric is used.
>>>>
>>>> Since your alignment doesn't influent the line calculation, you don't
>>>> need to use the new attr in CreateLines(), but only in Paint().
>>>> In Paint, the x/y position is calculated, and the DrawText with
>>>> Align_Baseline is used.
>>>>
>>>>> why do not use
>>>>> ALIGN_TOP/BOTTOM?,the calculation is set in VCL.
>>>>> I think it should be called by some functions.
>>>> Because you have to adjust x/y in Paint() anyway.
>>>> TOP and BOTTOM could help you to not do ascent/descent calculations
>>>> yourself, but for CENTER you have to do it anyway.
>>>> If you adjust x/y for all cases (top/bottom/center/baseline) to
>>>> BASELINE, and don't use ALIGN_TOP/BOTTOM, all the rest should work
>>>> automatically. Edit Mode as well as repaint mode.
>>>>
>>>>
>>> what your mean about adjust x/y for all cases
>> (top/bottom/center/baseline)
>>> to
>>> BASELINE?
>>>
>>> do you mean that I should add some code in paint(...) function like this:
>>>
>>>      TextAlign eAlign = aTmpFont.GetAlign();
>>>      if ( eAlign == ALIGN_TOP )
>>>      {
>>>       aRealOutPos.Y() =......
>>>       aRealOutPos.X() =....
>>>      }
>>>      if ( eAlign == ALIGN_BOTTOM )
>>>      {
>>>       aRealOutPos.Y() =......
>>>       aRealOutPos.X() =....
>>>      }
>>>      if ( eAlign == ALIGN_BASELINE )
>>>      {
>>>       aRealOutPos.Y() =......
>>>       aRealOutPos.X() =....
>>>      }
>>>
>> First - use the current para attr, not GetAlign from the Font, because
>> you shouldn't manipulate the alignment from the font anymore.
>>
>> Then look at the loop for ( nLine < nLines ), first switch statement
>> covering text/field/hypenator. There you can manipulate y (or x in
>> vertical writing mode). aTmpPos, not aRealOutPos.
>>
>>
> 
> Hi, Malte
> 
> Do you mean I should modifiy the code like this:in the loop of (nLine <
> nLines )
> 
>      sal_uInt16 nAscent, nDescent;
>       FontMetric aMetric( pRefDev->GetFontMetric() );
>       nAscent = (sal_uInt16)aMetric.GetAscent();
> 
>      aTmpPos.X() += pLine->GetStartPosX();
>      aTmpPos.Y() += nAscent;
>      ... ... ...
> 
> I tried but in non-edit mode they can only change the line location but not
> the character location.
> 
> It is still can not set align in non-edit mode.
> 
> can you give me some test code to implement the alignment setting in
> non-edit mode?I really have no idea.
> 
> LiuTao
> 
> 
> 
>> Malte.
>>
>>> but I think this is still works in edit mode.but not in non-edit mode.
>>>
>>> so puzzled.I am afraid I will crash. ;-)
>>>
>>>> Malte.
>>>>
>>>>> Just like in editmode. in the function implEditEngine::print(...).this
>>>>> function call setAlign(ALIGN_TOP),Then the alignment of text is TOP.
>>>>> but it is in editmode.
>>>>> my problem is : I can not set Align in non-edit mode.
>>>>>
>>>>>
>>>>>> Then all the rest in the drawing layer should work automatically.
>>>>>>
>>>>>> And wrt. EE_PARA_FONTALIGN: If you decrease EE_ITEMS_START by one, and
>>>>>> insert the new ID at the beginning, you don't have to manipulate the
>>>>>> Version Maps, IIRC.
>>>>>>
>>>>>> The SvxFontAlignItem itself looks strange to me: Its bad design to use
>> 4
>>>>>> bool values instead of an enum, if only one value can be true, and
>>>>>> exactly one value needs to be true.
>>>>>>
>>>>>>
>>>>> I will improve.
>>>>>
>>>>>> Malte.
>>>>>>
>>>>>> JiaXiang Liu wrote, On 12/08/09 12:07:
>>>>>>> Hello All,
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> 2009/12/8 Armin Le Grand <[email protected]
>>>>>>> <mailto:[email protected]>>
>>>>>>>
>>>>>>>     JiaXiang Liu schrieb:
>>>>>>>
>>>>>>>         Hi All,
>>>>>>>
>>>>>>>         2009/12/7 Malte Timmermann <[email protected]
>>>>>>>         <mailto:[email protected]>
>>>>>>>         <mailto:[email protected] <mailto:
>>>>>> [email protected]>>>
>>>>>>>            Hi LiuTao,
>>>>>>>
>>>>>>  >            given Armins explanation about the text primitive stuff,
>>>> it
>>>>>>>         seems it
>>>>>>>            would be much easier to do the transformation to baseline
>> in
>>>>>>>            impedit3.cxx instead of manipulating the font alignment.
>>>>>>>
>>>>>>>         you mean I can only modify the impedit3.cxx to implement?
>>>>>>>
>>>>>>>     I do not know impedit3.cxx, but i would do the adaption (as
>>>>>>>     described) in
>> impTextBreakupHandler::impCreateTextPortionPrimitive.
>>>>>>>     Nonetheless, even for pure VCL usage it is not sure if all usages
>>>>>>>     can use the baseline when it is used. It looks like it was not
>> used
>>>>>>>     in editengine up to now, but maybe in SW. HDU should know.
>>>>>>>
>>>>>>>
>>>>>>> yes,I have tryed so many times but have no result.I think it is not
>> so
>>>>>>> much difficult,just like to set the paragraph adjust left.when we set
>>>> it
>>>>>>> in edit mode it is ok , when in non-edit mode it is still ok.I guess
>> if
>>>>>>> there are some message should be transfered.
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>            Then it would probably also work out-of-the-box in
>> non-edit
>>>>>> mode.
>>>>>>>         Still don't know how to do that. :-(
>>>>>>>
>>>>>>>     As described: You have a StartPosition (rInfo.mrStartPos) that
>>>>>>>     defines where to draw the text. You have the TextAlign. If
>>>> TextAlign
>>>>>>>     != ALIGN_BASELINE, adapt StartPosition (use a local copy, of
>>>> course)
>>>>>>>     as if it is ALIGN_BASELINE. This means to add offsets vertically
>>>> for
>>>>>>>     horizontal text and probably vice-versa. The offsets depend on
>>>>>>>     FontInfo information which You get with the VCL Font and an
>>>>>>>     OutputDevice.
>>>>>>>
>>>>>>>
>>>>>>> the font align is not a attribute of font.so it is painted in edit
>> mode
>>>>>>> in impleditengine::paint(...)
>>>>>>> how to draw the alignment is in VCL.(function setalign)
>>>>>>> I guess if there have a function called like : noeditview::paint(...)
>>>> to
>>>>>>> call the VCL to draw the alignment?
>>>>>>>
>>>>>>>
>>>>>>> @Herbert
>>>>>>>
>>>>>>> Hello , Armin said you maybe know this.I wish you can help me....
>>>>>>>
>>>>>>>
>>>>>>>            Malte.
>>>>>>>
>>>>>>>            Armin Le Grand wrote, On 12/07/09 12:33:
>>>>>>>            > JiaXiang Liu schrieb:
>>>>>>>            >> Hello Malte,Armin,
>>>>>>>            >>
>>>>>>>            >> Just Forward the email:
>>>>>>>            >>
>>>>>>>            >> 2009/12/7 JiaXiang Liu <[email protected]
>>>>>>>         <mailto:[email protected]>
>>>>>>>            <mailto:[email protected] <mailto:
>> [email protected]
>>>>>>>            >> <mailto:[email protected]
>>>>>>>         <mailto:[email protected]> <mailto:[email protected]
>>>>>>>         <mailto:[email protected]>>>>
>>>>>>>
>>>>>>>            >>
>>>>>>>            >> Hello Malte,Armin
>>>>>>>            >>
>>>>>>>            >> @Malte
>>>>>>>            >>
>>>>>>>            >> I test that.It is so difficult.
>>>>>>>            >>
>>>>>>>            >> I setted a break point in outliner.cxx
>>>>>>>            >> aDrawPortionHdl.Call(...).
>>>>>>>            >> Then I find the many information is collected but not
>>>>>>>         alignment.
>>>>>>>            >>
>>>>>>>            >> How to record the information about the currently used
>>>>>>>         alignment?
>>>>>>>            >> If I should add a Parameter in this area ?
>>>>>>>            >>
>>>>>>>            >> DrawPortionInfo aInfo( rStartPos, rText, nTextStart,
>>>>>> nTextLen,
>>>>>>>            >> rFont, nPara, nIndex, pDXArray, pWrongSpellVector,
>>>>>>>            >> pFieldData, pLocale, rOverlineColor, rTextLineColor,
>>>>>>>            >> nRightToLeft, bEndOfLine, bEndOfParagraph,
>> bEndOfBullet);
>>>>>>>            >>
>>>>>>>            >> BTW,
>>>>>>>            >> aDrawPortionHdl.Call(...). is called by
>>>>>>>            >> void ImpEditEngine::Paint( OutputDevice* pOutDev,
>>>> Rectangle
>>>>>>>            >> aClipRec, Point aStartPos, sal_Bool bStripOnly, short
>>>>>>>            nOrientation )
>>>>>>>            >>
>>>>>>>            >> and the pOutDev saved the alignment.
>>>>>>>            >>
>>>>>>>            >> This area is also not save paragraph adjust.I am so
>>>>>> puzzled.
>>>>>>>            >>
>>>>>>>            >>
>>>>>>>            >> @Armin
>>>>>>>            >>
>>>>>>>            >> Malte told me that you maybe know that I want to know.
>>>> :-)
>>>>>>>            >>
>>>>>>>            > Maybe; i am responsible for DrawingLayer, not for Text
>>>>>> engines;
>>>>>>>            i just
>>>>>>>            > have to work with TextEngines since no one really is
>>>>>>>         responsible for
>>>>>>>            > them currently; and Yes, they are somewhat complicated
>> and
>>>>>>>         grown
>>>>>>>            code.
>>>>>>>            > Malte once was responsible for them, thus in relation to
>>>>>>>            > EditEngine/Outliner he may know more than me. I can help
>>>>>> with
>>>>>>>            > DrawingLayer and usage of TextParameters in prmitives,
>>>>>> though.
>>>>>>>            >>
>>>>>>>            >> the question is :
>>>>>>>            >> I am developing a new feature called "fontalign" It can
>>>>>>>         set the
>>>>>>>            >> text align top,center,baseline and bottom.
>>>>>>>            >> In Impress,Create a new document, input some words in a
>>>>>>>         text box
>>>>>>>            >> in normal view.
>>>>>>>            >> I can set the alignment successful in edit mode.
>>>>>>>            >>
>>>>>>>            > Is this already possible in the working/current code?
>>>>>>>            > If Yes, where can i change those settings?
>>>>>>>            >
>>>>>>>            > If no (and it's a completely new feature) it has to be
>>>>>>>            implemented not
>>>>>>>            > only inside EditEngine/Outliner, evtl. new items there
>>>> (not
>>>>>>>         sure if
>>>>>>>            > holding font alignment at the font itself is sufficient
>> in
>>>>>> all
>>>>>>>            > situations) and in Paint/export/callbacks, but also in
>>>> text
>>>>>>>            primities,
>>>>>>>            > their decompositions, exports and paintings.
>>>>>>>            > I will set HDU on CC, he may now if holding alignment at
>>>> the
>>>>>>>            font will
>>>>>>>            > be enough (if You use that currently).
>>>>>>>            >
>>>>>>>            >> but it can not store the setting when left the edit
>> mode.
>>>>>>>            >> It is OK in outline view,bucause in outline view it is
>>>> also
>>>>>> in
>>>>>>>            >> edit mode.
>>>>>>>            >>
>>>>>>>            > That's right, that new feature has to be represented in
>>>>>>>            TextPrimitives
>>>>>>>            > and used by renderers for it.
>>>>>>>            >
>>>>>>>            > In short: DrawPortionInfo is the class which
>>>>>>>         EditEngine/Outliner
>>>>>>>            uses in
>>>>>>>            > callback mode to export it's data (You already located
>>>>>>>         that). The
>>>>>>>            > FontAlignment info will be (i guess) at the
>>>>>>>         DrawPortionInfo::mrFont
>>>>>>>            > member which is also a 'Font' (the VCL class).
>>>>>>>            >
>>>>>>>
>>>>>>>         yes,it can use the 'Font'(VCL class) member function like:
>>>>>>>         (mrFont).SetAlign(ALIGN_TOP/../../..)
>>>>>>>
>>>>>>>            > Primitives do not use a Font class (they are designed to
>>>> be
>>>>>>>            transported
>>>>>>>            > over an API later), so they use
>>>>>>>            > drawinglayer::primitive2d::FontAttributes where the font
>>>> is
>>>>>>>            described
>>>>>>>            > using FamilyName/StyleName/Weight and others. There is
>> no
>>>>>>>         alignment
>>>>>>>            > currently since it was not used yet. FontAttributes is
>>>> then
>>>>>>>         used in
>>>>>>>            > TextSimplePortionPrimitive2D. At render time, the helper
>>>>>>>            > getVclFontFromFontAttributes is used to re-create a VCL
>>>> Font
>>>>>>>            from the
>>>>>>>            > FontAttributes, but this is only ONE way to use/render
>>>> text
>>>>>>>         in the
>>>>>>>            > future with primitives; to use VCL again. This will
>>>>>>>         probably change.
>>>>>>>            >
>>>>>>>            > The point is that currently, font alignment is not part
>> of
>>>>>>>            > FontAttributes and is not transported. As can be seen in
>>>>>>>            > getVclFontFromFontAttributes, ALIGN_BASELINE is assumed.
>> I
>>>>>>>         would
>>>>>>>            not add
>>>>>>>            > a font alignment to FontAttributes to keep it minimal
>> (and
>>>>>>>         it is not
>>>>>>>            > necessary). The TextSimplePortionPrimitive2D (and it's
>>>>>>>            derivates) are
>>>>>>>            > low-level text portion holders and also have a implicit
>>>>>>>         TextPosition
>>>>>>>            > (part of the TextTransform), thus it would be best to
>>>> adapt
>>>>>> the
>>>>>>>            implicit
>>>>>>>            > TextStart position inside
>>>>>>>            > impTextBreakupHandler::impCreateTextPortionPrimitive to
>>>>>>>         always use
>>>>>>>            > ALIGN_BASELINE.
>>>>>>>            >
>>>>>>>            > This is always possible using the FontInfo class and the
>>>>>>>         offsets
>>>>>>>            of the
>>>>>>>            > font (bbaseline, height, etc...). This can be done in
>>>>>>>            > impTextBreakupHandler::impCreateTextPortionPrimitive,
>> see
>>>>>>>         'apply
>>>>>>>            local
>>>>>>>            > offset'. rInfo.mrStartPos.Y() would need to be
>>>>>>>         expanded/adapted when
>>>>>>>            > text alignment is != ALIGN_BASELINE.
>>>>>>>            >
>>>>>>>
>>>>>>>         If that means I would modify something in this area and do
>> some
>>>>>>>         expand?but how?
>>>>>>>         Still puzzled about that.
>>>>>>>
>>>>>>>         Wish you can give me more hint to modify and implement the
>>>>>>>         feature. :-)
>>>>>>>
>>>>>>>         I attach a patch.
>>>>>>>         The Patch is what I have done,It did not contain XMLOFF
>>>>>>>         module,outline view and vertical mode.
>>>>>>>         I have implemented that. only have the non-edit mode problem.
>>>>>>>
>>>>>>>            > HTH!
>>>>>>>            >
>>>>>>>            >> I wish you can help me to solve this problem. Thank
>> you.
>>>>>>>            >>
>>>>>>>            >> With Best Regards,
>>>>>>>            >> LiuTao
>>>>>>>            >>
>>>>>>>            >>
>>>>>>>            >> 2009/12/4 JiaXiang Liu <[email protected]
>>>>>>>         <mailto:[email protected]>
>>>>>>>            <mailto:[email protected] <mailto:
>> [email protected]
>>>>>>>            >> <mailto:[email protected]
>>>>>>>         <mailto:[email protected]> <mailto:[email protected]
>>>>>>  >         <mailto:[email protected]>>>>
>>>>>>>            >>
>>>>>>>            >> Hello Malte,
>>>>>>>            >>
>>>>>>>            >> Thank you very much for the information.
>>>>>>>            >>
>>>>>>>            >> It is too late today fo me.
>>>>>>>            >>
>>>>>>>            >> I will test in Monday morning. if it is not ok, I will
>>>> also
>>>>>>>            >> ask Armin for this.
>>>>>>>            >>
>>>>>>>            >> Have a nice weekend.
>>>>>>>            >>
>>>>>>>            >> With Best Regards,
>>>>>>>            >>
>>>>>>>            >> LiuTao
>>>>>>>            >>
>>>>>>>            >> 2009/12/4 Malte Timmermann <[email protected]
>>>>>>>         <mailto:[email protected]>
>>>>>>>            <mailto:[email protected]
>>>>>>>         <mailto:[email protected]>>
>>>>>>>            >> <mailto:[email protected]
>>>>>>>         <mailto:[email protected]>
>>>>>>>            <mailto:[email protected]
>>>>>>>         <mailto:[email protected]>>>>
>>>>>>>            >>
>>>>>>>            >> Hi LiuTao,
>>>>>>>            >>
>>>>>>>            >>
>>>>>>>            >> JiaXiang Liu wrote, On 12/04/09 10:30:
>>>>>>>            >> > Hello Malte,
>>>>>>>            >> >
>>>>>>>            >> > Thank you for your answer.
>>>>>>>            >> >
>>>>>>>            >> > What I puzzled now is:
>>>>>>>            >> >
>>>>>>>            >> > Why I can not set the new attribute in no edit mode?
>>>>>>>            >>
>>>>>>>            >> For redrawing the content, the metrics calculated from
>>>> the
>>>>>>>            >> EditEngine
>>>>>>>            >> are cached somewhere, and the drawing layer uses
>>>>>>>            >> DrawText() directly,
>>>>>>>            >> probably also with ALIGN_BASELINE.
>>>>>>>            >>
>>>>>>>            >> >
>>>>>>>            >> > This is the* biggest problem* now and I want to solve
>>>>>>>            >> it. Can you help
>>>>>>>            >> > me?you said it may be the drawing layer.but I can not
>>>> do
>>>>>>>            >> anything about
>>>>>>>            >> > that.
>>>>>>>            >>
>>>>>>>            >> Armin should know more about this...
>>>>>>>            >>
>>>>>>>            >> You might figure out by setting a break point in
>>>>>> outliner.cxx
>>>>>>>            >> aDrawPortionHdl.Call(...). Then you will at least be
>> able
>>>>>>>            >> to see how the
>>>>>>>            >> information is collected. You need to record the
>>>>>>>            >> information about the
>>>>>>>            >> currently used alignment, and also use that information
>>>> at
>>>>>>>            >> the place
>>>>>>>            >> where the drawtext() is done.
>>>>>>>            >>
>>>>>>>            >> >
>>>>>>>            >> > Do you know Are there somebody in OpenOffice team is
>>>>>>>            >> developing or will
>>>>>>>            >> > develop this feature?
>>>>>>>            >>
>>>>>>>            >> Don't know / think so.
>>>>>>>            >>
>>>>>>>            >> Malte.
>>>>>>>            >>
>>>>>>>            >>
>>>>>>>
>>>>>>>
>>>>>>  ---------------------------------------------------------------------
>>>>>>>            >> To unsubscribe, e-mail:
>>>> [email protected]
>>>>>>>         <mailto:[email protected]>
>>>>>>>            <mailto:[email protected]
>>>>>>>         <mailto:[email protected]>>
>>>>>>>            >> <mailto:[email protected]
>>>>>>>         <mailto:[email protected]>
>>>>>>>            <mailto:[email protected]
>>>>>>>         <mailto:[email protected]>>>
>>>>>>>            >> For additional commands, e-mail:
>>>>>>>            >> [email protected]
>>>>>>>         <mailto:[email protected]>
>>>>>>>         <mailto:[email protected]
>>>>>>>         <mailto:[email protected]>>
>>>>>>>            >> <mailto:[email protected]
>>>>>>>         <mailto:[email protected]>
>>>>>>>            <mailto:[email protected]
>>>>>>>         <mailto:[email protected]>>>
>>>>>>>            >>
>>>>>>>            >>
>>>>>>>            >>
>>>>>>>            >>
>>>>>>>            >
>>>>>>>
>>>>>>>         With Best Regards,
>>>>>>>
>>>>>>>         LiuTao
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>     --
>>>>>>>     Sitz der Gesellschaft: Sun Microsystems GmbH, Sonnenallee 1,
>>>>>>>     D-85551 Kirchheim-Heimstetten|Amtsgericht München: HRB 161028
>>>>>>>     Geschäftsführer: Thomas Schröder, Wolfgang Engels, Wolf Frenkel
>>>>>>>     Vorsitzender des Aufsichtsrates: Martin Häring
>>>>>>>
>>>>>>>     Regards, Armin Le Grand (AW)|Don't ask what OOo can do for You,
>>>>>>>     Armin.Le.Grand(at)sun.com <http://sun.com/>   |better ask what
>> You
>>>>>>>     can do for ooO!
>>>>>>>
>>>>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: [email protected]
>>>>  For additional commands, e-mail: [email protected]
>>>>
>>>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [email protected]
>> For additional commands, e-mail: [email protected]
>>
>>
> 
--- /cygdrive/o/ooo320/src.m7/svx/source/editeng/impedit3.cxx   2009-09-25 
13:22:28.000000000 +0200
+++ impedit3.cxx    2009-12-11 15:37:47.567886500 +0100
@@ -2994,6 +2994,40 @@
                             {
                                SeekCursor( pPortion->GetNode(), nIndex+1, 
aTmpFont, pOutDev );
 
+                               // For LineAdjustModes != baseline keep the 
baseline position, need to be restored later
+                               Point aTmpPosBaseline( aTmpPos );
+                               static int nTestLineAlignMode = 0;
+                               if ( nTestLineAlignMode )
+                               {
+                                   aTmpFont.SetPhysFont( GetRefDevice() );
+                                   FormatterFontMetric aFormatterMetrics;
+                                   RecalcFormatterFontMetrics( 
aFormatterMetrics, aTmpFont );
+                                   
+                                   long nAdjust = 0;
+                                   
+                                   if ( nTestLineAlignMode == 1 ) // TOP
+                                   {
+                                       nAdjust = -pLine->GetMaxAscent(); // 
TOP Most
+                                       nAdjust += 
aFormatterMetrics.nMaxAscent; // Now we have the baseline
+                                   }
+                                   else if ( nTestLineAlignMode == 2 ) // 
BOTTOM
+                                   {
+                                       nAdjust = -pLine->GetMaxAscent() + 
pLine->GetHeight(); // BOTTOM most
+                                       nAdjust -= 
aFormatterMetrics.nMaxDescent; // Now we have the baseline
+                                   }
+                                   else if ( nTestLineAlignMode == 3 ) // 
CENTER
+                                   {
+                                       long nGlypHeight = 
aFormatterMetrics.nMaxAscent + aFormatterMetrics.nMaxDescent;
+                                       nAdjust = -pLine->GetMaxAscent() + 
pLine->GetHeight() / 2 - nGlypHeight / 2; 
+                                       nAdjust += 
aFormatterMetrics.nMaxAscent; // Now we have the baseline
+                                   }
+
+                                   if ( !IsVertical() )
+                                       aTmpPos.Y() += nAdjust;
+                                   else
+                                       aTmpPos.X() += nAdjust;
+                               }
+
                                 BOOL bDrawFrame = FALSE;
 
                                 if ( ( pTextPortion->GetKind() == 
PORTIONKIND_FIELD ) && !aTmpFont.IsTransparent() &&
@@ -3464,6 +3498,7 @@
                                }
 
                                 pOutDev->Pop();
+                                aTmpPos = aTmpPosBaseline;
 
                                 if ( pTmpDXArray )
                                    delete[] pTmpDXArray;
 

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to