From 3764b375874bb11efab8dc7261875b60ad4acb0d Mon Sep 17 00:00:00 2001 From: skalogryz Date: Sun, 30 Nov 2014 08:14:17 +0000 Subject: [PATCH] richmemo: added constant for linespacing. corrected loading/saving of linespacing information git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@3812 8e941d3f-bd1b-0410-a28a-d453659cc2b4 --- components/richmemo/richmemo.pas | 6 +++++- components/richmemo/richmemortf.pas | 6 ++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/components/richmemo/richmemo.pas b/components/richmemo/richmemo.pas index c776b0b8e..ef956ad1f 100644 --- a/components/richmemo/richmemo.pas +++ b/components/richmemo/richmemo.pas @@ -48,7 +48,11 @@ type end; const - DefLineSpacing = 1.2; + DefLineSpacing = 1.2; + SingleLineSpacing = DefLineSpacing; + OneHalfLineSpacing = DefLineSpacing * 1.5; + DoubleLineSpacing = DefLineSpacing * 2.0; + type TParaNumStyle = (pnNone, pnBullet, pnNumber, pnLowLetter diff --git a/components/richmemo/richmemortf.pas b/components/richmemo/richmemortf.pas index 5b0e32991..5ed801280 100644 --- a/components/richmemo/richmemortf.pas +++ b/components/richmemo/richmemortf.pas @@ -363,7 +363,9 @@ begin rtfRightIndent: prm.pm.TailIndent := aparam / 20; rtfSpaceBefore: prm.pm.SpaceBefore := aparam / 20; rtfSpaceAfter: prm.pm.SpaceAfter := aparam / 20; - rtfSpaceBetween: prm.pm.LineSpacing := aparam / 240; + rtfSpaceBetween: prm.pm.LineSpacing := aparam / 200; + // \slN - surprise! the "line spacing" is actually a multiplier based on the FONT size, not linesize + // where linesize = fontsize * 1.2 rtfLanguage: begin lang:=rtfParam; langproc:=nil; @@ -547,7 +549,6 @@ function SaveStream(ARich: TcustomRichMemo; Dst: TStream): Boolean; var p : TSaveParams; begin - writeln('saving stream!'); FillChar(p, sizeof(p), 0); p.start:=-1; p.len:=-1; @@ -802,6 +803,7 @@ begin if pm.TailIndent<>0 then RtfOut('\ri'+IntToStr(round(pm.TailIndent*20))); if pm.SpaceAfter<>0 then RtfOut('\sa'+IntToStr(round(pm.SpaceAfter*20))); if pm.SpaceBefore<>0 then RtfOut('\sb'+IntToStr(round(pm.SpaceBefore*20))); + if pm.LineSpacing<>0 then RtfOut('\sl'+IntToStr(round(pm.LineSpacing*200))+'\slmult1'); RtfOut(' '); end; s:=GetRTFWriteText(u, i, isnewpara);