Seeing strange results with RichMemo and paragraph indentation, I decided to examine the RTF output. Long story short, RichMemo only makes the correct indents (HeadIndent -- \li , FirstLine indent -- \fi) when the font size of the TRichMemo control is set to 10. At least that is the case in Linux. I made a button toggle to switch between font size 10 and 12 to watch the correct and incorrect display. The RTF code for font size is `\fs20` for 10 and `\fs24` for 12. Setting up a TMemo and directing the RTF output from TRichMemo on a form you can see the RTF code display the `\fsxx` values correctly.
Here's some code I used to test this:
procedure TForm1.Button1Click(Sender: TObject);
var
pm: TParaMetric;
begin
RichMemo1.Clear;
RichMemo1.Lines.Add('1.' + #9 + 'To create a hanging indent for list items in RTF, you need to set the `\li` (left indent) to the desired indentation level for the list item, and the `\fi` (first line indent) to a negative value that pulls the first line back to the left, creating the hanging effect for the list sym');
RichMemo1.Lines.Add('2.' + #9 + 'If you want to set a specific line spacing, you would include `\sl` followed by the value and `\slmult1` in your RTF control words. If you want to use the default line spacing, you can simply omit these control words.');
RichMemo1.Lines.Add('3.' + #9 + 'In RTF, the `\fi` value is the indentation for the first line of a paragraph relative to the left margin, and the `\li` value is negative.');
pm.HeadIndent:=18;
pm.FirstLine:=-18;
RichMemo1.SetParaMetric(0, Length(RichMemo1.Text), pm);
end;
Here's the RTF output with font set to size 10:
{\rtf1\ansi\ansicp1252\deff0\deflan1033{\fonttbl{\f0\fcharset0 Ubuntu;}}{\colortbl;\red211\green211\blue211;}\f0\fs20\cf1 \pard\li360\fi-360\sl200\slmult1 1. To create a hanging indent for list items in RTF, you need to set the `\\li` (left indent) to the desired indentation level for the list item, and the `\\fi` (first line indent) to a negative value that pulls the first line back to the left, creating the hanging effect for the list sym\par \pard\li360\fi-360\sl200\slmult1 2. If you want to set a specific line spacing, you would include `\\sl` followed by the value and `\\slmult1` in your RTF control words. If you want to use the default line spacing, you can simply omit these control words.\par \pard\li360\fi-360\sl200\slmult1 3. In RTF, the `\\fi` value is the indentation for the first line of a paragraph relative to the left margin, and the `\\li` value is negative.\par }
And the RTF output with font set to size 12:
{\rtf1\ansi\ansicp1252\deff0\deflan1033{\fonttbl{\f0\fcharset0 Ubuntu;}}{\colortbl;\red211\green211\blue211;}\f0\fs24\cf1 \pard\li360\fi-360\sl200\slmult1 1. To create a hanging indent for list items in RTF, you need to set the `\\li` (left indent) to the desired indentation level for the list item, and the `\\fi` (first line indent) to a negative value that pulls the first line back to the left, creating the hanging effect for the list sym\par \pard\li360\fi-360\sl200\slmult1 2. If you want to set a specific line spacing, you would include `\\sl` followed by the value and `\\slmult1` in your RTF control words. If you want to use the default line spacing, you can simply omit these control words.\par \pard\li360\fi-360\sl200\slmult1 3. In RTF, the `\\fi` value is the indentation for the first line of a paragraph relative to the left margin, and the `\\li` value is negative.\par }
I decided to try and fool the TRichMemo control by changing the `\li360\fi-360`values to `\li432\fi-432` to see if that would fix the issue when the font size was set to 12 (12*2*18=432). It looked close but was slightly off. When I checked the RTF output from the TRichMemo control it had changed `\li432\fi-432` to `\li435\fi-435` which seems totally bizarre.
I only use Linux so I don't know if this happens in Windows or not.