当前位置: 首页>>代码示例>>Java>>正文


Java FontSelector类代码示例

本文整理汇总了Java中com.lowagie.text.pdf.FontSelector的典型用法代码示例。如果您正苦于以下问题:Java FontSelector类的具体用法?Java FontSelector怎么用?Java FontSelector使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


FontSelector类属于com.lowagie.text.pdf包,在下文中一共展示了FontSelector类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: main

import com.lowagie.text.pdf.FontSelector; //导入依赖的package包/类
/**
 * Using FontSelector.
 */
@Test
public void main() throws Exception {
	// step 1
	Document document = new Document();
	// step 2
	PdfWriter.getInstance(document, PdfTestBase.getOutputStream("fontselection.pdf"));
	// step 3
	document.open();
	// step 4
	String text = "This text is the first verse of \u275dThe Iliad\u275e. It's not polytonic as it should be "
			+ "with \u2798 and \u279a entoation variants but that's all we have for now.\n\n"
			+ "\u2766\u00a0\u00a0\u039c\u03b7\u03bd\u03b9\u03bd \u03b1\u03b5\u03b9\u03b4\u03b5, \u03b8\u03b5\u03b1, \u03a0\u03b7\u03bb\u03b7\u03b9\u03b1\u03b4\u03b5\u03c9 \u0391\u03c7\u03b9\u03bb\u03b7\u03bf\u03c2";
	FontSelector sel = new FontSelector();
	sel.addFont(new Font(Font.TIMES_ROMAN, 12));
	sel.addFont(new Font(Font.ZAPFDINGBATS, 12));
	sel.addFont(new Font(Font.SYMBOL, 12));
	Phrase ph = sel.process(text);
	document.add(new Paragraph(ph));
	// step 5
	document.close();

}
 
开发者ID:albfernandez,项目名称:itext2,代码行数:26,代码来源:FontSelectionTest.java

示例2: main

import com.lowagie.text.pdf.FontSelector; //导入依赖的package包/类
/**
 * Using FontSelector.
 * 
 * @param args
 *            no arguments needed
 */
public static void main(String[] args) {
	try {
		// step 1
		Document document = new Document();
		// step 2
		PdfWriter.getInstance(document, new FileOutputStream(android.os.Environment.getExternalStorageDirectory() + java.io.File.separator + "droidtext" + java.io.File.separator + "fontselection.pdf"));
		// step 3
		document.open();
		// step 4
		String text = "This text is the first verse of \u275dThe Iliad\u275e. It's not polytonic as it should be "
				+ "with \u2798 and \u279a entoation variants but that's all we have for now.\n\n"
				+ "\u2766\u00a0\u00a0\u039c\u03b7\u03bd\u03b9\u03bd \u03b1\u03b5\u03b9\u03b4\u03b5, \u03b8\u03b5\u03b1, \u03a0\u03b7\u03bb\u03b7\u03b9\u03b1\u03b4\u03b5\u03c9 \u0391\u03c7\u03b9\u03bb\u03b7\u03bf\u03c2";
		FontSelector sel = new FontSelector();
		sel.addFont(new Font(Font.TIMES_ROMAN, 12));
		sel.addFont(new Font(Font.ZAPFDINGBATS, 12));
		sel.addFont(new Font(Font.SYMBOL, 12));
		Phrase ph = sel.process(text);
		document.add(new Paragraph(ph));
		// step 5
		document.close();
	} catch (Exception de) {
		de.printStackTrace();
	}
}
 
开发者ID:fc-dream,项目名称:PDFTestForAndroid,代码行数:31,代码来源:FontSelection.java

示例3: getFontSelector

import com.lowagie.text.pdf.FontSelector; //导入依赖的package包/类
public static FontSelector getFontSelector(float size, int style, Color color) {
	FontSelector selector = new FontSelector();
	selector.addFont(getCourierFont(size, style, color));
	selector.addFont(getChineseFont(size, style, color));
	return selector;
}
 
开发者ID:linkeer8802,项目名称:api-resolver,代码行数:7,代码来源:ItextUtil.java


注:本文中的com.lowagie.text.pdf.FontSelector类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。