From af45f95f16cee22f8f012f706f4d0a42eaeb68fa Mon Sep 17 00:00:00 2001 From: Graeme Geldenhuys Date: Thu, 22 Nov 2012 11:48:47 +0000 Subject: Fixes line ending issues --- docview/components/richtext/RichTextPrintUnit.pas | 150 +++++++++++----------- 1 file changed, 75 insertions(+), 75 deletions(-) (limited to 'docview/components/richtext/RichTextPrintUnit.pas') 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. -- cgit v1.2.3-54-g00ecf