Lazarus

Programming => Packages and Libraries => Topic started by: luca on March 16, 2015, 12:01:11 pm

Title: LazReport Barcode component
Post by: luca on March 16, 2015, 12:01:11 pm
I found a problem in printing a barcode rotated of 90 or 180 degree.
First line doesn't appear into the generated bitmap.
I fixed this problem by adding two rows in Barcode Unit.

Code: [Select]
unit Barcode;
...
...

procedure TBarcode.DrawBarcode(Canvas: TCanvas);   
...
begin
  xadd := 0;
  orgin.x := FLeft;
  orgin.y := FTop;
  if FAngle=90 then Dec(orgin.y); //<--- ADDED
  if FAngle=180 then Dec(orgin.x); //<--- ADDED
...

Hope this help.-

Regards.
Luca
Title: Re: LazReport Barcode component
Post by: jesusr on March 28, 2015, 05:29:15 am
what barcode type, any?, do you have a sample report? do you have a screenshot of the bad barcode compred with a good barcode?.
Title: Re: LazReport Barcode component
Post by: boznz on October 01, 2015, 09:32:28 am
Bit Late, but I Can confirm using code 128A and Ver 1.4 of lazarus the rotated barcodes do not work, the leading bar seems shorter as the poster suggested. Making the change fixed the Problem for me too.
Title: Re: LazReport Barcode component
Post by: mirce.vladimirov on January 15, 2021, 05:15:02 pm
Than you Luca, your trick helped me, added those two lines in that file and compiled my project, but not Lazarus.
Except, in my case the procedure was named TBarcode.DoLines(Data: string; Canvas: TCanvas);   
I use Lazarus 1.4.4 and the Lazreport that came with it.

Title: Re: LazReport Barcode component
Post by: sstvmaster on January 15, 2021, 05:27:46 pm
Lazarus is now at version 2.0.10!!! Yours is old. And i think it's maybe fixed meanwhile?
Title: Re: LazReport Barcode component
Post by: dseligo on January 15, 2021, 11:05:48 pm
Lazarus is now at version 2.0.10!!! Yours is old. And i think it's maybe fixed meanwhile?
It's not fixed, I just checked. And when it's rotated to 270 degree, barcode is correct but text isn't showing.
Title: Re: LazReport Barcode component
Post by: Jurassic Pork on January 16, 2021, 06:43:09 am
hello,
Lazarus is now at version 2.0.10!!! Yours is old. And i think it's maybe fixed meanwhile?
It's not fixed, I just checked. And when it's rotated to 270 degree, barcode is correct but text isn't showing.
i don't know why there is this code in the procedure TfrCustomBarCodeView.DrawLabel of the lr_barc.pas file of lazreport :
Code: Pascal  [Select][+][-]
  1.  
  2.           else  //  Param.cAngle = 270
  3.           begin
  4.             Brush.Color:=clWhite;
  5.             Brush.Style:=bsSolid;
  6.             Font.Orientation := 2700;
  7.             if (WidgetSet.LCLPlatform = lpGtk2) and IsPrinting then
  8.             TextOut(R.Left + fs, R.Top + (dy -TextWidth(FText)) div 2, FText)                                          
  9.           end;

with this code rotate barcode by 270°  works  on windows 10 :

Code: Pascal  [Select][+][-]
  1. else
  2.           begin
  3.             Brush.Color:=clWhite;
  4.             Brush.Style:=bsSolid;
  5.             Font.Orientation := 2700;
  6.             FillRect(Rect(R.Left,R.Top,R.Left + fs,R.Bottom));
  7.            TextOut(R.Left + fs, R.Top + (dy -TextWidth(FText)) div 2, FText);
  8.           end;
  9.  

Friendly, J.P
TinyPortal © 2005-2018