本文整理匯總了Java中com.lowagie.text.Chunk.setFont方法的典型用法代碼示例。如果您正苦於以下問題:Java Chunk.setFont方法的具體用法?Java Chunk.setFont怎麽用?Java Chunk.setFont使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.lowagie.text.Chunk
的用法示例。
在下文中一共展示了Chunk.setFont方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: beforePropertyChange
import com.lowagie.text.Chunk; //導入方法依賴的package包/類
public void beforePropertyChange(String propertyName) {
// do we have any text to do anything with?
// if not, then just return without action.
if(this.buffer.length() == 0) return;
if(propertyName.startsWith(RtfProperty.CHARACTER)) {
// this is a character change,
// add a new chunk to the current paragraph using current character settings.
Chunk chunk = new Chunk();
chunk.append(this.buffer.toString());
this.buffer = new StringBuffer(255);
HashMap charProperties = this.rtfParser.getState().properties.getProperties(RtfProperty.CHARACTER);
String defFont = (String)charProperties.get(RtfProperty.CHARACTER_FONT);
if(defFont == null) defFont = "0";
RtfDestinationFontTable fontTable = (RtfDestinationFontTable)this.rtfParser.getDestination("fonttbl");
Font currFont = fontTable.getFont(defFont);
int fs = Font.NORMAL;
if(charProperties.containsKey(RtfProperty.CHARACTER_BOLD)) fs |= Font.BOLD;
if(charProperties.containsKey(RtfProperty.CHARACTER_ITALIC)) fs |= Font.ITALIC;
if(charProperties.containsKey(RtfProperty.CHARACTER_UNDERLINE)) fs |= Font.UNDERLINE;
Font useFont = FontFactory.getFont(currFont.getFamilyname(), 12, fs, new Color(0,0,0));
chunk.setFont(useFont);
if(iTextParagraph == null) this.iTextParagraph = new Paragraph();
this.iTextParagraph.add(chunk);
} else {
if(propertyName.startsWith(RtfProperty.PARAGRAPH)) {
// this is a paragraph change. what do we do?
} else {
if(propertyName.startsWith(RtfProperty.SECTION)) {
} else {
if(propertyName.startsWith(RtfProperty.DOCUMENT)) {
}
}
}
}
}
示例2: getChunk
import com.lowagie.text.Chunk; //導入方法依賴的package包/類
/**
* Creates a Chunk object based on a list of properties.
* @param attributes
* @return a Chunk
*/
public static Chunk getChunk(Properties attributes) {
Chunk chunk = new Chunk();
chunk.setFont(FontFactory.getFont(attributes));
String value;
value = attributes.getProperty(ElementTags.ITEXT);
if (value != null) {
chunk.append(value);
}
value = attributes.getProperty(ElementTags.LOCALGOTO);
if (value != null) {
chunk.setLocalGoto(value);
}
value = attributes.getProperty(ElementTags.REMOTEGOTO);
if (value != null) {
String page = attributes.getProperty(ElementTags.PAGE);
if (page != null) {
chunk.setRemoteGoto(value, Integer.parseInt(page));
} else {
String destination = attributes
.getProperty(ElementTags.DESTINATION);
if (destination != null) {
chunk.setRemoteGoto(value, destination);
}
}
}
value = attributes.getProperty(ElementTags.LOCALDESTINATION);
if (value != null) {
chunk.setLocalDestination(value);
}
value = attributes.getProperty(ElementTags.SUBSUPSCRIPT);
if (value != null) {
chunk.setTextRise(Float.parseFloat(value + "f"));
}
value = attributes.getProperty(Markup.CSS_KEY_VERTICALALIGN);
if (value != null && value.endsWith("%")) {
float p = Float.parseFloat(value.substring(0, value.length() - 1)
+ "f") / 100f;
chunk.setTextRise(p * chunk.getFont().getSize());
}
value = attributes.getProperty(ElementTags.GENERICTAG);
if (value != null) {
chunk.setGenericTag(value);
}
value = attributes.getProperty(ElementTags.BACKGROUNDCOLOR);
if (value != null) {
chunk.setBackground(Markup.decodeColor(value));
}
return chunk;
}
示例3: getNormalChunk
import com.lowagie.text.Chunk; //導入方法依賴的package包/類
protected Chunk getNormalChunk(String text) {
Chunk chunk = new Chunk(StringUtils.defaultIfEmpty(text, ""));
chunk.setFont(textFont);
return chunk;
}
示例4: getBoldChunk
import com.lowagie.text.Chunk; //導入方法依賴的package包/類
protected Chunk getBoldChunk(String text) {
Chunk chunk = new Chunk(StringUtils.defaultIfEmpty(text, ""));
chunk.setFont(boldFont);
return chunk;
}
示例5: getSmallFontChunk
import com.lowagie.text.Chunk; //導入方法依賴的package包/類
protected Chunk getSmallFontChunk(String text) {
Chunk chunk = new Chunk(StringUtils.defaultIfEmpty(text, ""));
chunk.setFont(smallFont);
return chunk;
}
示例6: getHeaderChunk
import com.lowagie.text.Chunk; //導入方法依賴的package包/類
protected Chunk getHeaderChunk(String text) {
Chunk chunk = new Chunk(StringUtils.defaultIfEmpty(text, ""));
chunk.setFont(headerFont);
return chunk;
}
示例7: createChunk
import com.lowagie.text.Chunk; //導入方法依賴的package包/類
/**
* This creates a new chunk with the given text and font.
*
* @param text
* The text.
* @param font
* The font. Can be null.
* @return an {@link Element}.
*/
public static Element createChunk(String text, Font font) {
Chunk chunk = new Chunk(text);
if (font != null) {
chunk.setFont(font);
}
return chunk;
}