Hi all
There has been an oversight by in GetMultiLineTextAsLines() of PdfPainter.
To reproduce the bug:
PdfFont *font = doc->CreateFontSubset("Arial", false, false, false,
PdfEncodingFactory::GlobalIdentityEncodingInstance());
font->SetFontSize(72);
double x = 400;
double y = 300;;
double width = 36;
double height = 350;
PdfRect rect(x, y, width, height);
And after setting PdfPainter and font
painter.DrawMultiLineText(rect, " A
B",ePdfAlignment_Left,ePdfVerticalAlignment_Top);
This will make podofo crash.
The fix is in the following piece of code in GetMultiLineTextAsLines()
else
{
vecLines.push_back( PdfString( pszLineBegin,
pszCurrentCharacter - pszLineBegin ) );
// Skip all spaces at the end of the line
while (IsSpaceChar(*(pszCurrentCharacter + 1)))
pszCurrentCharacter++;
pszStartOfCurrentWord = pszCurrentCharacter + 1;
startOfWord = true;//This is what I missed
}
So the above test case has to be added to multiline text test cases.
I may send a proper fix with all the changes, but I am also OK if anyone else
does it.
I also believe there are some are areas where multiline text logic can be
improved, especially to avoid lines starting with whitespaces. The
GetMultiLineTextAsLines() code in my opinion is currently a little bit ugly.
May be some can make it more elgant
Regards
Ali
::DISCLAIMER::
----------------------------------------------------------------------------------------------------------------------------------------------------
The contents of this e-mail and any attachment(s) are confidential and intended
for the named recipient(s) only.
E-mail transmission is not guaranteed to be secure or error-free as information
could be intercepted, corrupted,
lost, destroyed, arrive late or incomplete, or may contain viruses in
transmission. The e mail and its contents
(with or without referred errors) shall therefore not attach any liability on
the originator or HCL or its affiliates.
Views or opinions, if any, presented in this email are solely those of the
author and may not necessarily reflect the
views or opinions of HCL or its affiliates. Any form of reproduction,
dissemination, copying, disclosure, modification,
distribution and / or publication of this message without the prior written
consent of authorized representative of
HCL is strictly prohibited. If you have received this email in error please
delete it and notify the sender immediately.
Before opening any email and/or attachments, please check them for viruses and
other defects.
----------------------------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today. http://sdm.link/xeonphi
_______________________________________________
Podofo-users mailing list
Podofo-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/podofo-users