diff options
author | Graeme Geldenhuys <graeme@mastermaths.co.za> | 2012-11-22 11:48:47 +0000 |
---|---|---|
committer | Graeme Geldenhuys <graeme@mastermaths.co.za> | 2012-11-22 11:48:47 +0000 |
commit | af45f95f16cee22f8f012f706f4d0a42eaeb68fa (patch) | |
tree | c572c1cc6a7d3bb12874d8f9b9363312b275e328 /docview/components/richtext/RichTextPrintUnit.pas | |
parent | 9c62dfaf7217557f08a3d33b20bb302874960f87 (diff) | |
download | fpGUI-af45f95f16cee22f8f012f706f4d0a42eaeb68fa.tar.xz |
Fixes line ending issues
Diffstat (limited to 'docview/components/richtext/RichTextPrintUnit.pas')
-rw-r--r-- | docview/components/richtext/RichTextPrintUnit.pas | 150 |
1 files changed, 75 insertions, 75 deletions
diff --git a/docview/components/richtext/RichTextPrintUnit.pas b/docview/components/richtext/RichTextPrintUnit.pas index 01746c68..3f963a63 100644 --- a/docview/components/richtext/RichTextPrintUnit.pas +++ b/docview/components/richtext/RichTextPrintUnit.pas @@ -1,75 +1,75 @@ -Unit RichTextPrintUnit;
-
-Interface
-
-uses
- Graphics,
- RichTextStyleUnit;
-
-// Prints the specified rich text, starting at page position PageY.
-// Starts new pages as needed; when done, PageY is the final position used
-// on the final page.
-Procedure PrintRichText( Text: PChar;
- Images: TImageList;
- Settings: TRichTextSettings;
- var PageY: longint );
-
-Implementation
-
-uses
- Classes,
- Printers,
- CanvasFontManager,
- RichTextLayoutUnit, RichTextDisplayUnit, Forms
- ;
-
-Procedure PrintRichText( Text: PChar;
- Images: TImageList;
- Settings: TRichTextSettings;
- var PageY: longint );
-var
- Layout: TRichTextLayout;
- FontManager: TCanvasFontManager;
- LineIndex: longint;
- Y: longint;
- FinishLine: longint;
- FinishY: longint;
-Begin
- FontManager := TCanvasFontManager.Create( Printer.Canvas,
- false // don't allow bitmap fonts
- );
-
- Layout := TRichTextLayout.Create( Text,
- Images,
- Settings,
- FontManager,
- Printer.PageWidth );
-
- LineIndex := 0;
- Y := PageY;
- repeat
- PrintRichTextLayout( FontManager,
- Layout,
- LineIndex,
- FinishLine,
- Y,
- FinishY );
- LineIndex := FinishLine;
- Y := FinishY;
-
- if LineIndex < Layout.FNumLines then
- begin
- // didn't all fit on page, so new page
- Printer.NewPage;
- Y := Printer.PageHeight - 1;
- end;
-
- until LineIndex >= Layout.FNumLines;
-
- Layout.Destroy;
- FontManager.Destroy;
- PageY := Y;
-end;
-
-Initialization
-End.
+Unit RichTextPrintUnit; + +Interface + +uses + Graphics, + RichTextStyleUnit; + +// Prints the specified rich text, starting at page position PageY. +// Starts new pages as needed; when done, PageY is the final position used +// on the final page. +Procedure PrintRichText( Text: PChar; + Images: TImageList; + Settings: TRichTextSettings; + var PageY: longint ); + +Implementation + +uses + Classes, + Printers, + CanvasFontManager, + RichTextLayoutUnit, RichTextDisplayUnit, Forms + ; + +Procedure PrintRichText( Text: PChar; + Images: TImageList; + Settings: TRichTextSettings; + var PageY: longint ); +var + Layout: TRichTextLayout; + FontManager: TCanvasFontManager; + LineIndex: longint; + Y: longint; + FinishLine: longint; + FinishY: longint; +Begin + FontManager := TCanvasFontManager.Create( Printer.Canvas, + false // don't allow bitmap fonts + ); + + Layout := TRichTextLayout.Create( Text, + Images, + Settings, + FontManager, + Printer.PageWidth ); + + LineIndex := 0; + Y := PageY; + repeat + PrintRichTextLayout( FontManager, + Layout, + LineIndex, + FinishLine, + Y, + FinishY ); + LineIndex := FinishLine; + Y := FinishY; + + if LineIndex < Layout.FNumLines then + begin + // didn't all fit on page, so new page + Printer.NewPage; + Y := Printer.PageHeight - 1; + end; + + until LineIndex >= Layout.FNumLines; + + Layout.Destroy; + FontManager.Destroy; + PageY := Y; +end; + +Initialization +End. |