Lazarus

Programming => Packages and Libraries => LazReport => Topic started by: Wujek on January 04, 2019, 03:39:16 pm

Title: Problem with polish letter in wrapped text
Post by: Wujek on January 04, 2019, 03:39:16 pm
I have problem with wrapped text - see below. Insted of letter 'ó' there is letter '?'
Title: Re: Problem with polish letter in wrapped text
Post by: engkin on January 05, 2019, 04:25:44 am
Just took a quick look, the problem is in:
Lazarus\components\lazreport\source\lr_class.pas

go to:
procedure TfrCustomMemoView.WrapMemo

and replace every Copy with UTF8Copy inside this procedure
and do the same with Length , replace it with UTF8Length except the one that deals with b:
Code: Pascal  [Select]
  1.             if Length(b) > 0 then
leave this one as is.

Recompile LazReport package.
Title: Re: Problem with polish letter in wrapped text
Post by: Wujek on January 06, 2019, 04:24:34 pm
Thanks,
I will try it tomorrow.

Title: Re: Problem with polish letter in wrapped text
Post by: Wujek on January 07, 2019, 08:49:17 am
Hello,

After the changes, the above problem seems to be improved, however, there was a problem with the text from MEMO type fields. If it contains Polish characters, the first letter is truncated in the following paragraphs.

Title: Re: Problem with polish letter in wrapped text
Post by: Wujek on January 07, 2019, 09:24:10 am
Hello,

I also have a second problem which concerns exporting the report to PDF using TFrTNPDFExportFilter

 frReport2.ExportTo (TFrTNPDFExportFilter, 'file.pdf');

Polish letters are not exported except letter 'ó'
Title: Re: Problem with polish letter in wrapped text
Post by: engkin on January 07, 2019, 12:13:31 pm
The second problem is a simple one. It is using wrong Length somewhere.
The third problem is similar to the first one.
I'll try to find a solution when I get a chance.
Title: Re: Problem with polish letter in wrapped text
Post by: engkin on January 08, 2019, 03:37:02 am
I need a small application that shows the problem. That will make my life a little bit easier.

Edit:
I think I found one bug. Try to replace:
Code: Pascal  [Select]
  1.             // if space was found, advance to next no space char
  2.             while (s[last] = ' ') and (last < Len) do

with
Code: Pascal  [Select]
  1.             // if space was found, advance to next no space char
  2.             while (UTF8Copy(s,last,1) = ' ') and (last < Len) do

Variable Last should be counting UTF8Chars not Bytes.
Title: Re: Problem with polish letter in wrapped text
Post by: Wujek on January 08, 2019, 07:45:46 pm
Hello,

I found in lr_class.pas this:
// if space was found, advance to next no space char
            while (s[last] = ' ') and (last < Length(s)) do

and changed to:
            // if space was found, advance to next no space char
            while (UTF8Copy(s,last,1) = ' ') and (last < UTF8Length(s)) do
but it did not help

Title: Re: Problem with polish letter in wrapped text
Post by: engkin on January 08, 2019, 07:48:30 pm
Yes, that one. I had changed Length(s) to Len, where Len := UTF8Length(s);

Unlike Length, calling UTF8Length is slow. So call it once and replace every Length(s) with Len
Title: Re: Problem with polish letter in wrapped text
Post by: Wujek on January 08, 2019, 08:01:16 pm
could you send a modified .pas file
Title: Re: Problem with polish letter in wrapped text
Post by: engkin on January 08, 2019, 08:06:02 pm
Attached. I am on Laz1.8.2 so might not work on your side. Give it a try.
Title: Re: Problem with polish letter in wrapped text
Post by: Wujek on January 08, 2019, 09:08:52 pm
Failed to compile.

maybe just a modified procedure?
Title: Re: Problem with polish letter in wrapped text
Post by: Wujek on January 11, 2019, 08:53:23 pm
Lazreport is a total failure, I can not deal with Polish letters.

Is there any alternative for Lazreport where there is no problem with the Polish font?
Title: Re: Problem with polish letter in wrapped text
Post by: JuhaManninen on January 11, 2019, 11:35:12 pm
Is there any alternative for Lazreport where there is no problem with the Polish font?
FPC trunk and the 3.2 branch have packages/fcl-report/.
I have understood it has good design.
Title: Re: Problem with polish letter in wrapped text
Post by: Wujek on January 14, 2019, 01:23:53 pm
this is the effect of dividing a word containing Polish letters. The word: łłłłłłłłłłłłłłłłłłłłłłłłłłłłłłłłłłłłłłłłł

frReport1.ExportTo(TlrPdfExportFilter,
Title: Re: Problem with polish letter in wrapped text
Post by: paweld on January 14, 2019, 02:25:32 pm
https://bugs.freepascal.org/view.php?id=34871
Title: Re: Problem with polish letter in wrapped text
Post by: GAN on January 14, 2019, 10:53:57 pm
Lazreport is a total failure, I can not deal with Polish letters.

Is there any alternative for Lazreport where there is no problem with the Polish font?

You can buy Fast Report https://www.fast-report.com/en/product/fast-report-lazarus/ (ftp://www.fast-report.com/en/product/fast-report-lazarus/)