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.

do{String optlist = "verticalalign=justify linespreadlimit=120%";p.begin_page_ext(0, 0, "width=a4.width height=a4.height");/* Fill the first column */result = p.fit_textflow(tf, llx1, lly1, urx1, ury1, optlist);/* Fill the second column if we have more text*/if (!result.equals("_stop"))result = p.fit_textflow(tf, llx2, lly2, urx2, ury2, optlist);p.end_page_ext("");/* "_boxfull" means we must continue because there is more text;* "_nextpage" is interpreted as "start new column"*/} while (result.equals("_boxfull") || result.equals("_nextpage"));/* Check for errors */if (!result.equals("_stop")){/* "_boxempty" happens if the box is very small and doesn't hold any text at all.*/if (result.equals( "_boxempty"))throw new Exception("Error: " + p.get_errmsg());else{/* Any other return value is a user exit caused by the "return" option;* this requires dedicated code to deal with.*/}}p.delete_textflow(tf);7.2.2 Paragraph Formatting OptionsIn the previous example we used default settings for the paragraphs. For example, thedefault alignment is left-justified, and the leading is 100% (which equals the font size).In order to fine-tune the paragraph formatting we can feed more options to PDF_add_textflow( ). For example, we can indent the text 15 units from the left and 10 unitsfrom the right margin. The first line of each paragraph should be indented by an additional20 units. The text should be justified against both margins, and the leading increasedto 140%. Finally, we’ll reduce the font size to 8 points. To achieve this, extendthe option list for PDF_add_textflow( ) as follows (see Figure 7.13):String optlist ="leftindent=15 rightindent=10 parindent=20 alignment=justify " +"leading=140% fontname=Helvetica fontsize=8 encoding=unicode";7.2.3 Inline Option Lists and MacrosThe text in Figure 7.13 is not yet perfect. The headline »Have a look at our new paperplane models!« should sit on a line of its own, should use a larger font, and should becentered. There are several ways to achieve this.7.2 Multi-Line Textflows 143

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

Saved successfully!

Ooh no, something went wrong!