當前位置: 首頁>>代碼示例>>Java>>正文


Java Chunk.setFont方法代碼示例

本文整理匯總了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)) {

				}
			}
		}
	}		
}
 
開發者ID:albfernandez,項目名稱:itext2,代碼行數:42,代碼來源:RtfDestinationDocument.java

示例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;
}
 
開發者ID:albfernandez,項目名稱:itext2,代碼行數:57,代碼來源:ElementFactory.java

示例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;
}
 
開發者ID:Biblivre,項目名稱:Biblivre-3,代碼行數:6,代碼來源:BaseBiblivreReport.java

示例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;
}
 
開發者ID:Biblivre,項目名稱:Biblivre-3,代碼行數:6,代碼來源:BaseBiblivreReport.java

示例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;
}
 
開發者ID:Biblivre,項目名稱:Biblivre-3,代碼行數:6,代碼來源:BaseBiblivreReport.java

示例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;
}
 
開發者ID:Biblivre,項目名稱:Biblivre-3,代碼行數:6,代碼來源:BaseBiblivreReport.java

示例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;
}
 
開發者ID:Communote,項目名稱:communote-server,代碼行數:17,代碼來源:RtfElementFactory.java


注:本文中的com.lowagie.text.Chunk.setFont方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。