[lazarus] PostscriptPrinter patch
olivier GUILBAUD
golivier at free.fr
Mon Nov 3 16:59:09 EST 2003
Hi,
i have corrected an little bug on PostscriptPrinter.pp .
The beginDoc clear all patterns but the NumPatterns variable it's not
initialized at zero.
? .directory
Index: lcl/postscriptprinter.pas
===================================================================
RCS file: /FPC/CVS/projects/lazarus/lcl/postscriptprinter.pas,v
retrieving revision 1.6
diff -u -r1.6 postscriptprinter.pas
--- lcl/postscriptprinter.pas 3 Nov 2003 16:57:47 -0000 1.6
+++ lcl/postscriptprinter.pas 3 Nov 2003 22:01:17 -0000
@@ -826,40 +826,41 @@
var
I: Integer;
begin
-
- FCanvas.Clear;
- FDocument.Clear;
+ FCanvas.Clear;
+ FDocument.Clear;
- // destroy the patterns
- if NumPatterns > 0 then begin
- for I := 0 to NuMPatterns-1 do begin
- Patterns[i].Free;
- end;
- end;
-
- // free the pattern pointer memory
- Reallocmem(Patterns, 0);
-
- FDocument.Add('%!PS-Adobe-3.0');
- FDocument.Add('%%BoundingBox: 0 0 612 792');
- FDocument.Add('%%Creator: '+Application.ExeName);
- FDocument.Add('%%Title: '+FTitle);
- FDocument.Add('%%Pages: (atend)');
- FDocument.Add('%%PageOrder: Ascend');
-
- // Choose a standard font in case the user doesn't
- FDocument.Add('/AvantGarde-Book findfont');
- FDocument.Add('10 scalefont');
- FDocument.Add('setfont');
-
- // start our first page
- FPageNumber := 1;
- FDocument.Add('%%Page: 1 1'); // I'm still not sure why u put the page # twice
- FDocument.Add('newpath');
-
- UpdateBoundingBox;
-
+ // destroy the patterns
+ if NumPatterns > 0 then
+ begin
+ for I := 0 to NuMPatterns-1 do
+ begin
+ Patterns[i].Free;
+ Patterns[i]:=nil;
+ end;
+ NumPatterns:=0;
+ end;
+
+ // free the pattern pointer memory
+ Reallocmem(Patterns, 0);
+
+ FDocument.Add('%!PS-Adobe-3.0');
+ FDocument.Add('%%BoundingBox: 0 0 612 792');
+ FDocument.Add('%%Creator: '+Application.ExeName);
+ FDocument.Add('%%Title: '+FTitle);
+ FDocument.Add('%%Pages: (atend)');
+ FDocument.Add('%%PageOrder: Ascend');
+
+ // Choose a standard font in case the user doesn't
+ FDocument.Add('/AvantGarde-Book findfont');
+ FDocument.Add('10 scalefont');
+ FDocument.Add('setfont');
+
+ // start our first page
+ FPageNumber := 1;
+ FDocument.Add('%%Page: 1 1'); // I'm still not sure why u put the page # twice
+ FDocument.Add('newpath');
+ UpdateBoundingBox;
end;
{ Copy current page into the postscript and start a new one }
More information about the Lazarus
mailing list