Saturday, June 7, 2008

Drop caps

Last week saw the introduction of a brand new feature in KWord: crap drops. Er, I mean, drop caps. You can specify how many lines it should span, how many characters to drop, and even the extent of horizontal gap between the dropped chars and the rest of the paragraph (all only through the odf file, for now). But if if you ask me, I just like the plain old three-line single character drop char (thanks, Thomas, for the screenshot).

dropcaps screeny

Compared to Word 2007 and OpenOffice 2.3, it works pretty much the same usual way in, er, usual circumstances. But in subnormal scenarios, like for example, when the paragraph doesn't have as many lines as how many lines the drop cap spans, or in the case where the paragraph has a mix of quirkily extreme font sizes, all three word processors behave differently, and somehow, I can't point to any of them and say that's outright wrong. So, if you have any inputs on how KWord's drop caps behaves or should behave in certain situations, please leave a comment or mail me.

Now for the how-stuff-works part. What I've done is, create a separate new line for the set of dropped characters (setNumColumns), and increase their font size on the layout by the number of vertical lines they should span (setAdditionalFormats). Then it's only a matter of shifting out a few subsequent lines horizontally without changing their vertical positioning (setPosition) and reducing their width to accommodate the dropped characters abreast of these lines. That, in brief, is about it. Mostly.
Sample odts: dropCapsLines.odt, dropCapsLength.odt, dropCapsDistance.odt

No comments: