本文整理汇总了Java中com.lowagie.text.FontFactory.isRegistered方法的典型用法代码示例。如果您正苦于以下问题:Java FontFactory.isRegistered方法的具体用法?Java FontFactory.isRegistered怎么用?Java FontFactory.isRegistered使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.lowagie.text.FontFactory
的用法示例。
在下文中一共展示了FontFactory.isRegistered方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initFont
import com.lowagie.text.FontFactory; //导入方法依赖的package包/类
private static void initFont() {
String fontName = ServerConfigurationService.getString("pdf.default.font");
if (StringUtils.isNotBlank(fontName)) {
FontFactory.registerDirectories();
if (FontFactory.isRegistered(fontName)) {
font = FontFactory.getFont(fontName, BaseFont.IDENTITY_H, BaseFont.EMBEDDED);
boldFont = FontFactory.getFont(fontName, BaseFont.IDENTITY_H, BaseFont.EMBEDDED, 10, Font.BOLD);
} else {
log.warn("Can not find font: " + fontName);
}
}
if (font == null) {
font = new Font();
boldFont = new Font(Font.COURIER, 10, Font.BOLD);
}
}
示例2: HTMLWorker
import com.lowagie.text.FontFactory; //导入方法依赖的package包/类
/** Creates a new instance of HTMLWorker */
public HTMLWorker(DocListener document) {
this.document = document;
cprops = new ChainedProperties();
String fontName = ServerConfigurationService.getString("pdf.default.font");
if (StringUtils.isNotBlank(fontName)) {
FontFactory.registerDirectories();
if (FontFactory.isRegistered(fontName)) {
HashMap fontProps = new HashMap();
fontProps.put(ElementTags.FACE, fontName);
fontProps.put("encoding", BaseFont.IDENTITY_H);
cprops.addToChain("face", fontProps);
}
}
}
示例3: retrieveFont
import com.lowagie.text.FontFactory; //导入方法依赖的package包/类
/**
* Retrieves a font from the FontFactory based on some style attributes.
* Looks for the font-family, font-size, font-weight, font-style and color.
* Takes the default encoding and embedded value.
* @param styleAttributes a Properties object containing keys and values
* @return an iText Font object
*/
public Font retrieveFont(Properties styleAttributes) {
String fontname = null;
String encoding = FontFactory.defaultEncoding;
boolean embedded = FontFactory.defaultEmbedding;
float size = Font.UNDEFINED;
int style = Font.NORMAL;
Color color = null;
String value = (String)styleAttributes.get(MarkupTags.CSS_KEY_FONTFAMILY);
if (value != null) {
if (value.indexOf(",") == -1) {
fontname = value.trim();
}
else {
String tmp;
while (value.indexOf(",") != -1) {
tmp = value.substring(0, value.indexOf(",")).trim();
if (FontFactory.isRegistered(tmp)) {
fontname = tmp;
break;
}
else {
value = value.substring(value.indexOf(",") + 1);
}
}
}
}
if ((value = (String)styleAttributes.get(MarkupTags.CSS_KEY_FONTSIZE)) != null) {
size = MarkupParser.parseLength(value);
}
if ((value = (String)styleAttributes.get(MarkupTags.CSS_KEY_FONTWEIGHT)) != null) {
style |= Font.getStyleValue(value);
}
if ((value = (String)styleAttributes.get(MarkupTags.CSS_KEY_FONTSTYLE)) != null) {
style |= Font.getStyleValue(value);
}
if ((value = (String)styleAttributes.get(MarkupTags.CSS_KEY_COLOR)) != null) {
color = MarkupParser.decodeColor(value);
}
return FontFactory.getFont(fontname, encoding, embedded, size, style, color);
}