View Issue Details

IDProjectCategoryView StatusLast Update
0035973LazarusLCLpublic2019-08-20 16:06
ReporterAndi FriessAssigned To 
PrioritynormalSeverityminorReproducibilityalways
Status newResolutionopen 
PlatformRasPi 3B+OSraspbian (arm-linux)OS Version wheezy
Product VersionProduct Build 
Target VersionFixed in Version 
Summary0035973: fpreport: Rendering Report to Printer on RasPi give empty memo content
DescriptionI have created a report with fpreport (in code) and it works on Windows (32-bit app) with Rendering to LCLCanvas, PDF and Printer without problems.

On a RasPi with rasbian (on Jessy, Wheezy the same) rendering to LCLCanvas and PDF works, but on printer it shows not the text. pictures are correct rendered. The text is not rendered or only some points, except the footerband.

I have dived a little into fpreport and found out, it must have to do with Canvas.Textout in TFPReportExportCanvas.RenderMemo.
The parameters of Canvas.TextOut are imho correct, but not the rendered result. If i change Canvas.TextOut to Canvas.TextRect (as in designmode) and use the same parameters, the text is written to the printer.

it looks like something goes wrong on arm-linux with Canvas.TextOut.

The error is in rendering, i attach the resulting PS file. I have created it, with the debuggingmodus of printers4lazarus. And in the file you see the Text "Hello world <Item xx>" is written correct, but ? overwritten.

see printjob.zip - is is the resulting ps file before sended to the printer.
Steps To Reproduceuse the extended the fpreport sample (from lazarus/examples/fpreport) and it shows the same issue on a RasPi.

use the attached extended samplecode.
Additional InformationIt is the sam if you compile native on a RasPi, or crosscompile from windows to raspi.

the issue is in fpc fixes3.2 with Lazarus fixes20 and trunk/trunk.
TagsNo tags attached.
Fixed in Revision
LazTarget-
Widgetset
Attached Files
  • fpreport (1).zip (23,755 bytes)
  • printjob.zip (21,186 bytes)
  • CCF16082019.pdf (977,819 bytes)
  • printjob_patched.ps (40,145 bytes)
  • PSfail.JPG (19,850 bytes)
    PSfail.JPG (19,850 bytes)
  • PSok.JPG (26,273 bytes)
    PSok.JPG (26,273 bytes)
  • fpreportlclexport.pas.patch (1,663 bytes)
    Index: components/fpreport/fpreportlclexport.pas
    ===================================================================
    --- components/fpreport/fpreportlclexport.pas	(revision 61673)
    +++ components/fpreport/fpreportlclexport.pas	(working copy)
    @@ -16,6 +16,14 @@
     
     {$mode objfpc}{$H+}
     { $DEFINE DEBUGRD}
    +// Workaround bug 0035973
    +{$IFDEF UNIX}
    +  {$IFDEF CPUARM}
    +    {$IFDEF LCLGtk2}
    +      {$DEFINE lclbugfixraspi}
    +    {$ENDIF}
    +  {$ENDIF}
    +{$ENDIF}
     
     interface
     
    @@ -530,16 +538,31 @@
         { LCL's Canvas.TextOut origin coordinate is Top-Left }
         if DrawMode=dmRender then
           begin
    +      {$IFDEF DEBUGRD}
    +      Writeln('dmRendering Memo [Font: ',Canvas.Font.Name,' Color',Canvas.Font.Color, ' Size', Canvas.Font.Size,'] (',R.Left,',',R.Top,',',R.right,',',R.Bottom,') ',txtblk.Text);
    +      {$ENDIF}
    +      {$iFDEF lclbugfixraspi}
    +      Canvas.TextRect(
    +          MR,
    +          HmmToPixels(lXPos) + FHorzOffset,
    +          VmmToPixels(lYPos) + FVertOffset,
    +          txtblk.Text
    +      );
    +      {$ElSE}
           Canvas.TextOut(
               HmmToPixels(lXPos) + FHorzOffset,
               VmmToPixels(lYPos) + FVertOffset,
               txtblk.Text
           );
    +      {$ENDIF}
           if Assigned(FHyperLinks) and (txtblk is TFPHTTPTextBlock) then
             FHyperLinks.AddLink(R,(txtblk as TFPHTTPTextBlock).URL);
           end
         else
           begin
    +      {$IFDEF DEBUGRD}
    +      Writeln('Rendering Memo [Font: ',Canvas.Font.Name,' Color',Canvas.Font.Color, ' Size', Canvas.Font.Size,'] (',R.Left,',',R.Top,',',R.right,',',R.Bottom,') ',txtblk.Text);
    +      {$ENDIF}
           Canvas.TextRect(
               MR,
               HmmToPixels(lXPos) + FHorzOffset,
    

Activities

Andi Friess

2019-08-16 09:34

reporter  

fpreport (1).zip (23,755 bytes)
printjob.zip (21,186 bytes)

Andi Friess

2019-08-16 09:40

reporter   ~0117697

I have build QT5 support on the RasPi and changed the widgetset from GTK2 to QT5. With QT5 it is correct rendered and shown on the print.

Attached a bad printout with gtk2. It does not depend on printertype. Eg. Brother Inkjet, Kyocera Laser produces the same bad printout.

CCF16082019.pdf (977,819 bytes)

Thaddy de Koning

2019-08-16 10:21

reporter   ~0117698

Looks like maybe a fontsize issue (1 or 0)

Andi Friess

2019-08-16 15:59

reporter   ~0117703

No Fontsize issue -> you can see a little from the correct header, but it is overwritten. Looks like the background is rendered after the foreground.

Thaddy de Koning

2019-08-16 20:11

reporter   ~0117710

But I see artifacts, which means it can not be that. You also wrote you see something like that.....

Andi Friess

2019-08-16 23:14

reporter  

printjob_patched.ps (40,145 bytes)
PSfail.JPG (19,850 bytes)
PSfail.JPG (19,850 bytes)

Andi Friess

2019-08-16 23:14

reporter   ~0117713

Last edited: 2019-08-16 23:15

View 2 revisions

I have disables some filled rectangles in the print job - see printjob_patched.ps - and the text is visible. The textsize and position is ok and correct.
So the renderer is inserting some unwanted or misplaced filled rectangles.

PSfail.jpg is the not correct rendered printout with original printjob.ps
PSok.jpg is the correct rendered printout wit the patched printjob_patched.ps

BTW the file is showable with Ghostscript an windows too.



PSok.JPG (26,273 bytes)
PSok.JPG (26,273 bytes)

Michael Van Canneyt

2019-08-17 12:43

administrator   ~0117715

Last edited: 2019-08-17 12:43

View 2 revisions

Since the problem only occurs for Gtk rendering on a printer, this is completely handled in the LCL. It's therefor a deeper LCL or even GTK error. I've move the issue to Lazarus/LCL.

Andi Friess

2019-08-20 16:06

reporter   ~0117744

This is not a bugfix, but a quick and dirty hotfix to make it possible to print on raspi.

fpreportlclexport.pas.patch (1,663 bytes)
Index: components/fpreport/fpreportlclexport.pas
===================================================================
--- components/fpreport/fpreportlclexport.pas	(revision 61673)
+++ components/fpreport/fpreportlclexport.pas	(working copy)
@@ -16,6 +16,14 @@
 
 {$mode objfpc}{$H+}
 { $DEFINE DEBUGRD}
+// Workaround bug 0035973
+{$IFDEF UNIX}
+  {$IFDEF CPUARM}
+    {$IFDEF LCLGtk2}
+      {$DEFINE lclbugfixraspi}
+    {$ENDIF}
+  {$ENDIF}
+{$ENDIF}
 
 interface
 
@@ -530,16 +538,31 @@
     { LCL's Canvas.TextOut origin coordinate is Top-Left }
     if DrawMode=dmRender then
       begin
+      {$IFDEF DEBUGRD}
+      Writeln('dmRendering Memo [Font: ',Canvas.Font.Name,' Color',Canvas.Font.Color, ' Size', Canvas.Font.Size,'] (',R.Left,',',R.Top,',',R.right,',',R.Bottom,') ',txtblk.Text);
+      {$ENDIF}
+      {$iFDEF lclbugfixraspi}
+      Canvas.TextRect(
+          MR,
+          HmmToPixels(lXPos) + FHorzOffset,
+          VmmToPixels(lYPos) + FVertOffset,
+          txtblk.Text
+      );
+      {$ElSE}
       Canvas.TextOut(
           HmmToPixels(lXPos) + FHorzOffset,
           VmmToPixels(lYPos) + FVertOffset,
           txtblk.Text
       );
+      {$ENDIF}
       if Assigned(FHyperLinks) and (txtblk is TFPHTTPTextBlock) then
         FHyperLinks.AddLink(R,(txtblk as TFPHTTPTextBlock).URL);
       end
     else
       begin
+      {$IFDEF DEBUGRD}
+      Writeln('Rendering Memo [Font: ',Canvas.Font.Name,' Color',Canvas.Font.Color, ' Size', Canvas.Font.Size,'] (',R.Left,',',R.Top,',',R.right,',',R.Bottom,') ',txtblk.Text);
+      {$ENDIF}
       Canvas.TextRect(
           MR,
           HmmToPixels(lXPos) + FHorzOffset,

Issue History

Date Modified Username Field Change
2019-08-16 09:34 Andi Friess New Issue
2019-08-16 09:34 Andi Friess File Added: fpreport (1).zip
2019-08-16 09:34 Andi Friess File Added: printjob.zip
2019-08-16 09:40 Andi Friess File Added: CCF16082019.pdf
2019-08-16 09:40 Andi Friess Note Added: 0117697
2019-08-16 10:21 Thaddy de Koning Note Added: 0117698
2019-08-16 15:59 Andi Friess Note Added: 0117703
2019-08-16 20:11 Thaddy de Koning Note Added: 0117710
2019-08-16 23:14 Andi Friess File Added: printjob_patched.ps
2019-08-16 23:14 Andi Friess File Added: PSfail.JPG
2019-08-16 23:14 Andi Friess File Added: PSok.JPG
2019-08-16 23:14 Andi Friess Note Added: 0117713
2019-08-16 23:15 Andi Friess Note Edited: 0117713 View Revisions
2019-08-17 12:42 Michael Van Canneyt Project FPC => Lazarus
2019-08-17 12:42 Michael Van Canneyt Category FCL => LCL
2019-08-17 12:42 Michael Van Canneyt Product Version 3.3.1 =>
2019-08-17 12:42 Michael Van Canneyt Description Updated View Revisions
2019-08-17 12:42 Michael Van Canneyt Steps to Reproduce Updated View Revisions
2019-08-17 12:42 Michael Van Canneyt Additional Information Updated View Revisions
2019-08-17 12:42 Michael Van Canneyt LazTarget => -
2019-08-17 12:43 Michael Van Canneyt Note Added: 0117715
2019-08-17 12:43 Michael Van Canneyt Note Edited: 0117715 View Revisions
2019-08-20 16:06 Andi Friess File Added: fpreportlclexport.pas.patch
2019-08-20 16:06 Andi Friess Note Added: 0117744