I'm not sure if Text Leading does not work or if I am misinterpreting how to use it. I have tried something like this:
blockComposer.ShowText("Text paragraph 1...several lines of wrapped text");
SizeF breakSize = new SizeF(0, 15); // Indentation (0pt) and top margin (15pt).
blockComposer.ShowText("Text paragraph 2...several lines of wrapped text");
But no matter what value I put into composer.SetTextLead(##); the line spacing is always the same (auto according to font size).
Short answer: PrimitiveComposer.SetTextLead(…) is a relic you should currently ignore (I'm going to decide about its suppression/enhancement in the upcoming 0.1.2 release) - use BlockComposer.LineSpace property instead (see the explanation below).
Comprehensive answer: in PDF format, some text parameters are "weak", somewhat like non-mandatory hints: they are typically applied only when particular circumstances occur (for example, word spacing is applied only to the occurrences of single-byte character code 32 (ASCII space), thus ignoring any space character differently mapped!). The same principle applies to the text leading, which works only when certain text-positioning operators are used; as a matter of fact, those operators are currently not used by PrimitiveComposer as they are considered redundant (it works with absolute positioning operators). Nonetheless, I may add ShowTextLine(…) methods to fill the gap.
As I mentioned above, BlockComposer.LineSpace property is the way to go for interline spacing. But… what's the difference between LineSpace and SetTextLead()?
Well, let's recap some concepts: text line height is composed by content height and interline space.
The traditional typographic concept of text leading (vertical distance between the baselines of adjacent lines of text) is related to text line height; it's quite clumsy, as it forces a fix distance without considering the actual height of its contents. On the other hand, interline spacing ensures the isolation of content height avoiding any potential overlap; this is the technique adopted by modern typographic descriptors like CSS.
PDF Clown's BlockComposer adopts the latter approach but, differently from CSS, it applies full-top leading instead of half-top/bottom leading. Here it is an example (note the adaptation to multiple font sizes):
You can see BlockComposer.LineSpace property in action in GraphicsSample (included in the downloadable distribution).
Log in to post a comment.
Sign up for the SourceForge newsletter:
You seem to have CSS turned off.
Please don't fill out this field.