10.07.2015 Views

Download - Multivac!

Download - Multivac!

Download - Multivac!

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

The following command removes all soft hyphens:charmapping={shy {shy 0}}Each tab character will be replaced with four space characters:charmapping={hortab {space 4}}Each arbitrary long sequence of linefeed characters will be reduced to a single linefeedcharacter:charmapping={linefeed {linefeed -1}}Each sequence of CRLF combinations will be replaced with a single space:charmapping={CRLF {space -1}}We will take a closer look at the last example. Let’s assume you receive text where thelines have been separated with fixed line breaks by some other software, and thereforecannot be properly formatted. You want to replace the linebreaks with space charactersin order to achieve proper formatting within the fitbox. To achieve this we replace arbitrarilylong sequences of linebreaks with a single space character. The initial text looksas follows:To fold the famous rocket looper proceed as follows:Take a sheet of paper. Fold itlengthwise in the middle.Then, fold down the upper corners. Fold thelong sides inwardsthat the points A and B meet on the central fold.The following code fragment demonstrates how to replace the redundant linebreakcharacters and format the resulting text:/* assemble option list */String optlist ="fontname=Helvetica fontsize=9 encoding=winansi alignment=justify " +"charmapping {CRLF {space -1}}"/* place textflow in fitbox */textflow = p.add_textflow(-1, text, optlist);if (textflow == -1)throw new Exception("Error: " + p.get_errmsg());result = p.fit_textflow(textflow, left_x, left_y, right_x, right_y, "");if (!result.equals("_stop")){ /* ... */ }p.delete_textflow(textflow);Figure 7.18 shows Textflow output with the unmodified text and the improved versionwith the charmapping option.Symbol fonts in Textflows and the textlen option. Symbol fonts, more precisely: textin a font which is not Unicode-compatible according to Section 5.4.4, »Unicode-compatibleFonts«, page 111, deserves some special attention when used within Textflows:7.2 Multi-Line Textflows 149

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!