Recent

Author Topic: Problem with polish letter in wrapped text  (Read 11896 times)

Wujek

  • New Member
  • *
  • Posts: 10
Problem with polish letter in wrapped text
« on: January 04, 2019, 03:39:16 pm »
I have problem with wrapped text - see below. Insted of letter 'ó' there is letter '?'
« Last Edit: January 04, 2019, 03:45:35 pm by Wujek »

engkin

  • Hero Member
  • *****
  • Posts: 3112
Re: Problem with polish letter in wrapped text
« Reply #1 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.

Wujek

  • New Member
  • *
  • Posts: 10
Re: Problem with polish letter in wrapped text
« Reply #2 on: January 06, 2019, 04:24:34 pm »
Thanks,
I will try it tomorrow.


Wujek

  • New Member
  • *
  • Posts: 10
Re: Problem with polish letter in wrapped text
« Reply #3 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.


Wujek

  • New Member
  • *
  • Posts: 10
Re: Problem with polish letter in wrapped text
« Reply #4 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 'ó'
« Last Edit: January 07, 2019, 10:23:19 am by Wujek »

engkin

  • Hero Member
  • *****
  • Posts: 3112
Re: Problem with polish letter in wrapped text
« Reply #5 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.

engkin

  • Hero Member
  • *****
  • Posts: 3112
Re: Problem with polish letter in wrapped text
« Reply #6 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.
« Last Edit: January 08, 2019, 04:07:45 am by engkin »

Wujek

  • New Member
  • *
  • Posts: 10
Re: Problem with polish letter in wrapped text
« Reply #7 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

« Last Edit: January 08, 2019, 07:59:22 pm by Wujek »

engkin

  • Hero Member
  • *****
  • Posts: 3112
Re: Problem with polish letter in wrapped text
« Reply #8 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
« Last Edit: January 08, 2019, 07:50:25 pm by engkin »

Wujek

  • New Member
  • *
  • Posts: 10
Re: Problem with polish letter in wrapped text
« Reply #9 on: January 08, 2019, 08:01:16 pm »
could you send a modified .pas file

engkin

  • Hero Member
  • *****
  • Posts: 3112
Re: Problem with polish letter in wrapped text
« Reply #10 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.

Wujek

  • New Member
  • *
  • Posts: 10
Re: Problem with polish letter in wrapped text
« Reply #11 on: January 08, 2019, 09:08:52 pm »
Failed to compile.

maybe just a modified procedure?
« Last Edit: January 08, 2019, 09:10:41 pm by Wujek »

Wujek

  • New Member
  • *
  • Posts: 10
Re: Problem with polish letter in wrapped text
« Reply #12 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?

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4459
  • I like bugs.
Re: Problem with polish letter in wrapped text
« Reply #13 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.
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

Wujek

  • New Member
  • *
  • Posts: 10
Re: Problem with polish letter in wrapped text
« Reply #14 on: January 14, 2019, 01:23:53 pm »
this is the effect of dividing a word containing Polish letters. The word: łłłłłłłłłłłłłłłłłłłłłłłłłłłłłłłłłłłłłłłłł

frReport1.ExportTo(TlrPdfExportFilter,
« Last Edit: January 14, 2019, 01:26:08 pm by Wujek »

 

TinyPortal © 2005-2018