Copy link to clipboard
Copied
I haven't spent any time digging into this, but I'm wondering, is there a valid reason that inline graphic elements seem to get positioned differently than text.
The example below (image of results and markup) was created using the online TLF Demo and is simply a bunch of '0's and 'g's with the Google logo inserting between some of the lines. In this particular example the only setting of note is that I set Leading too 100% to help illustrate the positioning "issue".
As you can see the image overlaps with the bottom of the previous line. I highlighted the image and the highlight actually shows where it thinks the image should be (and I agree).
Is this a bug (I have a hard time believing it's not), and if so is there some setting / attribute that could be applied to correct this, or is there some quick fix to put in place for quick positioning.
Thanks!
Bryon
Image capturing results:
Markup:
<?xml version="1.0" encoding="utf-8"?>
<flow:TextFlow whiteSpaceCollapse="preserve" xmlns:flow="http://ns.adobe.com/textLayout/2008"><flow:p><flow:span fontSize="100" lineHeight="100%">0g0g0g</flow:span></flow:p><flow:p><flow:span fontSize="100" lineHeight="100%">g0g0g0</flow:span></flow:p><flow:p><flow:span fontSize="100" lineHeight="100%">0g0g0g</flow:span></flow:p><flow:p><flow:span fontSize="100" lineHeight="100%">g0g0g0</flow:span></flow:p><flow:p><flow:img fontSize="100" lineHeight="100%" height="auto" width="auto" source="http://www.google.com/intl/en_ALL/images/srpr/logo1w.png"/><flow:span fontSize="100" lineHeight="100%"></flow:span></flow:p><flow:p><flow:span fontSize="100" lineHeight="100%">0g0g0g</flow:span></flow:p><flow:p><flow:span fontSize="100" lineHeight="100%">g0g0g0</flow:span></flow:p><flow:p><flow:span fontSize="100"></flow:span></flow:p></flow:TextFlow>
This is as designed. TLF uses baseline to baseline leading (typographic leading), and does not adjust the leading to avoid collisions. This model is the same as used in InDesign or Illustrator. When you set the lineHeight, that controls the space TLF will leave from one baseline to the next. The good part of this is that it gives very predictable line locations, so that using a superscript or subscript, for example, does not result in odd linespacing. But it does mean that you may have to incre
...Copy link to clipboard
Copied
Change all the fontSizes to a smaller value and you'll see that the size is applied. The issue is that unlike characters which extend below the baseline the ILG is positioned on the baseline and so is a bit taller. Add a baselineShiftt to push it lower.
Richard
Copy link to clipboard
Copied
So, this is actually working worse than I thought. Previously I thought that the IGEs were the only thing not properly accounting for the descent of the previous line, but now I realize that this is the case for text as well.
Here is some example text showing a 40pt font below a 200pt font.
Markup:
<?xml version="1.0" encoding="utf-8"?>
<flow:TextFlow whiteSpaceCollapse="preserve" xmlns:flow="http://ns.adobe.com/textLayout/2008"><flow:p><flow:span fontSize="200">gOgOgO</flow:span></flow:p><flow:p><flow:span fontSize="40">gOgOgO</flow:span></flow:p></flow:TextFlow>
I haven't stepped through everything yet, but it would seem that something like _lastLineDescent in BaseCompose would be used to keep track of the descent of the previously line in order to offset the next line so that there is no overlap. It doesn't, however, appear that this is happening, or at least happening properly.
Is the way this is currently working a bug or is this behavior intentional?
Thanks
Copy link to clipboard
Copied
This is as designed. TLF uses baseline to baseline leading (typographic leading), and does not adjust the leading to avoid collisions. This model is the same as used in InDesign or Illustrator. When you set the lineHeight, that controls the space TLF will leave from one baseline to the next. The good part of this is that it gives very predictable line locations, so that using a superscript or subscript, for example, does not result in odd linespacing. But it does mean that you may have to increase line leading in some situations such as what you've posted.
- robin
Copy link to clipboard
Copied
That helps clarify things. Thanks!