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/README.txt | 160 +++++++++++----------- docview/components/richtext/RichTextPrintUnit.pas | 150 ++++++++++---------- 2 files changed, 155 insertions(+), 155 deletions(-) (limited to 'docview/components/richtext') diff --git a/docview/components/richtext/README.txt b/docview/components/richtext/README.txt index 04379657..fd2d3a03 100644 --- a/docview/components/richtext/README.txt +++ b/docview/components/richtext/README.txt @@ -1,81 +1,81 @@ -TRichTextView component -for fpGUI Toolkit - - -Summary -------- -This component displays 'rich' text, with various fonts, colors, -styles and alignment. - -The major features are: - Fast, accurate drawing of text - -Features to come... - Selection and copy - Built-in default popup menu - - -Using the component -------------------- -Put a component on your form. Adjust the properties as you see fit. -At runtime, load the text into the control using AddText, AddParagraph, -and Clear. - - -Formatting syntax ------------------ -This is a HTML-like set of tags. But note that tag pairs don't have to -match up. - -Implemented tags: - - bold on, off - underline on, off - italic on, off -

heading 1-3, set with Heading1Font etc - changes heading text back to normal text - fixed font - set text to the color xxx, where xxx is a convenience - color (red, green, blue, yellow, black, purple, cyan) or a - color value #RRGGBB like #008000 (which is a shade of - green). - sets text color to red (convenience tag) - sets text color to blue (convenience tag) - sets text color to green (convenience tag) - sets text color to black (convenience tag) - sets the background color of text to xxx - - default left text alignment - Same as above. Left text alignment - Centered text alignment - Right text alignment - Text will begin xx spaces from the left - - Start, End link. - The OnClickLink and OnOverLink events are called with linktext - Display image x from associated TImageList - No text wrapping will occur - Text wrapping is enabled again. - - Where "font name" is the name of the font, and x is the - point size of the font. - - -Not implemented yet: - full text justification - Text will begin xx spaces from the left - Set alignment back to the default RichTextSettings.DefaultAlignment - value - - -Example -------- -RichText.AddParagraph( '

This is a big heading' ); -RichText.AddParagraph( 'Here is some bold text' ); - - -Problems/limitations --------------------- -Yes, there probably are some. :) - +TRichTextView component +for fpGUI Toolkit + + +Summary +------- +This component displays 'rich' text, with various fonts, colors, +styles and alignment. + +The major features are: + Fast, accurate drawing of text + +Features to come... + Selection and copy + Built-in default popup menu + + +Using the component +------------------- +Put a component on your form. Adjust the properties as you see fit. +At runtime, load the text into the control using AddText, AddParagraph, +and Clear. + + +Formatting syntax +----------------- +This is a HTML-like set of tags. But note that tag pairs don't have to +match up. + +Implemented tags: + + bold on, off + underline on, off + italic on, off +

heading 1-3, set with Heading1Font etc + changes heading text back to normal text + fixed font + set text to the color xxx, where xxx is a convenience + color (red, green, blue, yellow, black, purple, cyan) or a + color value #RRGGBB like #008000 (which is a shade of + green). + sets text color to red (convenience tag) + sets text color to blue (convenience tag) + sets text color to green (convenience tag) + sets text color to black (convenience tag) + sets the background color of text to xxx + + default left text alignment + Same as above. Left text alignment + Centered text alignment + Right text alignment + Text will begin xx spaces from the left + + Start, End link. + The OnClickLink and OnOverLink events are called with linktext + Display image x from associated TImageList + No text wrapping will occur + Text wrapping is enabled again. + + Where "font name" is the name of the font, and x is the + point size of the font. + + +Not implemented yet: + full text justification + Text will begin xx spaces from the left + Set alignment back to the default RichTextSettings.DefaultAlignment + value + + +Example +------- +RichText.AddParagraph( '

This is a big heading' ); +RichText.AddParagraph( 'Here is some bold text' ); + + +Problems/limitations +-------------------- +Yes, there probably are some. :) + \ No newline at end of file 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-70-g09d2