c# - Rich Text Format Line Spacing -
i try convert plain text in rtf-format. therefore, use richtextbox (winforms).
concerned method rtf-markup string.
now, want insert line spacing in markup. found there 2 parameters:
- \slx (space between lines in twips) - \slmultx (either 0 or 1)
if set \slmult0
, line spacing above line of text.
when set \slmult1
, line spacing below line of text.
i calculate spacing in following way:
(linespacing + fontsize)*20
when switched \slmult0
\slmult1
, determined, line distance little smaller \slmult0
.
does know reason behavior? have calculate formula?
if set \slmult0, line spacing above line of text. when set \slmult1, line spacing below line of text.
that not read in specs.
the way understand it, means \slmult0
says value of \sln
used directly distance in unit, whereas \slmult1
says n
in \sln
meant factor regular line spacing multiplied.
see last post here (some) more details! (but there note taking effect 1 line late..)
also note importance of sign of n
in \sln
! (this reason of comment above: effect of, \sl234
, depend on size of tallest character in line..!)
here nice discussion of things rtf; note units:
measurements in rtf in twips. twip twentieth of point, i.e., 1440th of inch. leads large numbers (like \li2160, set left indent inch , half)
and clear definition of spacing before , after paragraphs:
\sbn -- n twips of (vertical) space before paragraph (default: 0)
\san -- n twips of (vertical) space after paragraph (default: 0)
here more direct instructions:
to double-space paragraph, put code \sl480\slmult1 right after \pard. triple-space it, use \sl720\slmult1. have 1.5-spacing, use \sl360\slmult1. single-spaced paragraph default, , doesn’t need particular code. (the magic numbers 480, 720, , 360 don’t depend on point size of text in paragraph.)
Comments
Post a Comment