Skip to main content
Participant
October 16, 2009
Question

Image and text collision with baselineShift

  • October 16, 2009
  • 1 reply
  • 991 views

Hi,

I want to add an image (in the example : a little equation) in a text using the TLF.

I have only ONE paragraph and my image need to be aligned, so I set the property baselineShift on the inlineGraphicElement.

But the problem is that there is a collision with the next text line (see obtained.jpg).

So I tried to set the lineHeight but in this case, no leadingDirection works (because I want space in direction up and in direction down).

I would like to obtain a space before and a space after (see expected.jpg), and I can't split my paragraph.

Is there any way to do this (like text wrap or ... ) ?

Thanks a lot,

Regards

Olivier

This topic has been closed for replies.

1 reply

Adobe Employee
October 16, 2009

A leading model that allowed half up & half down would solve your problem. We don't have that, as you have observed, although it is in our list of things we'd like to have. I'm not sure I have a good alternate solution that doesn't involve changing the lineHeight of the following line, assuming that it could be in the same paragraph; maybe someone else does.

- robin

ojuinAuthor
Participant
October 21, 2009

Thanks Robin for the information.

I solved my problem : in my eventlistener (event = CompositionCompletionEvent.COMPOSITION_COMPLETE), for each of my InlineGraphicElement, I do 2 steps :

- get the corresponding TextFlowLine and change its y property (decrement : moving the textFlowLine up)

- get the corresponding DisplayObject[child of the corresponding textLine] of my InlineGraphicElement and change its y property (increment : moving the graphic down)

increment = decrement = baselineshift(in percent) / 100 * InlineGraphicElement.actualHeight

and so, I obtain what I except

If it could help somebody ...

Inspiring
January 6, 2010

That is a good solution if you have one or images offset with the same amount in the line.  However it gets a lot more complicated with multiple offsets in one line. I want to throw in my vote for getting this included properly in TLF such that you can independently set separate vertical alignments on images.