pdfDevice and memo with tabstops
Hello,
(RbPRo 15.03, Delphi XE4)
I have a TppMemo with TabStopPositions at 10, and 20 mm
The memotext is
1020
11020
The first line starts with a tab. When exported to pdf the first line of the
memo is placed too far to the right.
I think this code in procedure
TppPDFRendererWrappedText.CreateTabStoppedText is the cause:
{First line first word (Treated differently in PDF)}
..
{Tab at the beginning of the first line}
if (lTabStrings[liIndex] = '') then
begin
ldLeftOffset := GetTabPosition(0, aTabs);
ldCurrentLeft := FLeftOffset + ldLeftOffset;
end
else
GetTabPosition takes FLeftOffset into account, so its added twice to
ldCurrentLeft. That’s why the line is too far to the right. When I remove
that then the line is at the correct position but the first word is placed
at the second tab, the next tab position relative to ldCurrentLeft.
If I change the code to just
if (lTabStrings[liIndex] = '') then
begin
ldCurrentLeft := FLeftOffset;
end
it works fine. The next lines starting with tabs and lines starting with
multiple tabs are also OK.
Regards,
Max Paay
Quadrant Software bv.
The Netherlands.
(RbPRo 15.03, Delphi XE4)
I have a TppMemo with TabStopPositions at 10, and 20 mm
The memotext is
1020
11020
The first line starts with a tab. When exported to pdf the first line of the
memo is placed too far to the right.
I think this code in procedure
TppPDFRendererWrappedText.CreateTabStoppedText is the cause:
{First line first word (Treated differently in PDF)}
..
{Tab at the beginning of the first line}
if (lTabStrings[liIndex] = '') then
begin
ldLeftOffset := GetTabPosition(0, aTabs);
ldCurrentLeft := FLeftOffset + ldLeftOffset;
end
else
GetTabPosition takes FLeftOffset into account, so its added twice to
ldCurrentLeft. That’s why the line is too far to the right. When I remove
that then the line is at the correct position but the first word is placed
at the second tab, the next tab position relative to ldCurrentLeft.
If I change the code to just
if (lTabStrings[liIndex] = '') then
begin
ldCurrentLeft := FLeftOffset;
end
it works fine. The next lines starting with tabs and lines starting with
multiple tabs are also OK.
Regards,
Max Paay
Quadrant Software bv.
The Netherlands.
This discussion has been closed.
Comments
Thanks for pointing this out. The CreateTabStoppedText routine was
recently refactored and this special case was apparently overlooked.
There is now a patch available that makes this change for RB 15.03.
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com