本文整理汇总了Java中com.lowagie.text.Phrase.setLeading方法的典型用法代码示例。如果您正苦于以下问题:Java Phrase.setLeading方法的具体用法?Java Phrase.setLeading怎么用?Java Phrase.setLeading使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.lowagie.text.Phrase
的用法示例。
在下文中一共展示了Phrase.setLeading方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getPhrase
import com.lowagie.text.Phrase; //导入方法依赖的package包/类
/**
* Creates a Phrase object based on a list of properties.
* @param attributes
* @return a Phrase
*/
public static Phrase getPhrase(Properties attributes) {
Phrase phrase = new Phrase();
phrase.setFont(FontFactory.getFont(attributes));
String value;
value = attributes.getProperty(ElementTags.LEADING);
if (value != null) {
phrase.setLeading(Float.parseFloat(value + "f"));
}
value = attributes.getProperty(Markup.CSS_KEY_LINEHEIGHT);
if (value != null) {
phrase.setLeading(Markup.parseLength(value,
Markup.DEFAULT_FONT_SIZE));
}
value = attributes.getProperty(ElementTags.ITEXT);
if (value != null) {
Chunk chunk = new Chunk(value);
if ((value = attributes.getProperty(ElementTags.GENERICTAG)) != null) {
chunk.setGenericTag(value);
}
phrase.add(chunk);
}
return phrase;
}
示例2: createParagraphElement
import com.lowagie.text.Phrase; //导入方法依赖的package包/类
Element createParagraphElement(String paragraphTitle, String iconName)
throws DocumentException, IOException {
final Paragraph paragraph = new Paragraph("", paragraphTitleFont);
paragraph.setSpacingBefore(5);
paragraph.setSpacingAfter(5);
if (iconName != null) {
paragraph.add(new Chunk(getParagraphImage(iconName), 0, -5));
}
final Phrase element = new Phrase(' ' + paragraphTitle, paragraphTitleFont);
element.setLeading(12);
paragraph.add(element);
// chapter pour avoir la liste des signets
final ChapterAutoNumber chapter = new ChapterAutoNumber(paragraph);
// sans numéro de chapitre
chapter.setNumberDepth(0);
chapter.setBookmarkOpen(false);
chapter.setTriggerNewPage(false);
return chapter;
}
示例3: retrievePhrase
import com.lowagie.text.Phrase; //导入方法依赖的package包/类
/**
* Retrieves a Phrase based on some style attributes.
* @param font
* @param styleattributes a Properties object containing keys and values
* @return an iText Phrase object
*/
public Element retrievePhrase(Font font, Properties styleattributes) {
Phrase p = new Phrase("", font);
if (styleattributes == null) return p;
String leading = styleattributes.getProperty(MarkupTags.CSS_KEY_LINEHEIGHT);
if (leading != null) {
if (leading.endsWith("%")) {
p.setLeading(p.font().size() * (parseLength(leading) / 100f));
}
else {
p.setLeading(parseLength(leading));
}
}
return p;
}