富文本格式行距

Rich Text Format Line Spacing

我尝试将纯文本转换为 RTF 格式。因此,我使用 RichTextBox (WinForms)。
相关方法RTF-Markup as string.

现在,我想在标记中插入行间距。我发现有2个参数:

 - \slX (Space between lines in twips)
 - \slmultX (either 0 or 1)

如果我设置 \slmult0,则行间距 高于 文本行。
当我设置 \slmult1 时,行距 低于 文本行。

我按以下方式计算间距:

(lineSpacing + fontSize)*20

当我从 \slmult0 切换到 \slmult1 时,我确定线距离比 \slmult0 小一点。

有人知道这种行为的原因吗?我必须用其他公式计算吗?

如果我设置\slmult0,行间距在文本行之上。 当我设置\slmult1时,行间距在文本行下方。

那不是我在 specs 上看到的内容。

我理解的意思是\slmult0表示\slN的值在某个单元中直接作为距离 ,而 \slmult1 表示 \slN 中的 N 表示 因子,常规行间距乘以该因子。

看最后一个posthere 有关(一些)更多详细信息! (但也有一个说明它生效太晚了..)

还要注意 \slNN 符号的重要性! (这就是我上面评论的原因:比如说 \sl234 的效果将取决于行中 最高 字符的大小..!)

Here 是对 RTF 一些事情的很好的讨论;关于单位的注释:

Measurements in RTF are generally in twips. A twip is a twentieth of a point, i.e., a 1440th of an inch. That leads to some large numbers sometimes (like \li2160, to set the left indent to an inch and a half)

以及段落前后额外间距的明确定义:

\sbN -- N twips of extra (vertical) space before this paragraph (default: 0)
\saN -- N twips of extra (vertical) space after this paragraph (default: 0)

Here更直接的说明:

To double-space a paragraph, put the code \sl480\slmult1 right after the \pard. To triple-space it, use \sl720\slmult1. To have just 1.5-spacing, use \sl360\slmult1. A single-spaced paragraph is the default, and doesn’t need any particular code. (The magic numbers 480, 720, and 360 don’t depend on the point size of the text in the paragraph.)