List of usage examples for com.lowagie.text Font isItalic
public boolean isItalic()
From source file:org.apache.maven.doxia.module.itext.ITextFont.java
License:Apache License
/** * Return the font style// w w w .j a v a 2 s . c o m * * @return the font style */ public String getFontStyle() { Font font = getCurrentFont(); StringBuilder sb = new StringBuilder(); if (font.isBold()) { sb.append(BOLD); } if (font.isItalic()) { if (sb.length() == 0) { sb.append(ITALIC); } else { sb.append(","); sb.append(ITALIC); } } if (font.isUnderlined()) { if (sb.length() == 0) { sb.append(UNDERLINE); } else { sb.append(","); sb.append(UNDERLINE); } } if (sb.length() == 0) { return NORMAL; } return sb.toString(); }
From source file:org.pentaho.reporting.libraries.fonts.itext.BaseFontSupport.java
License:Open Source License
/** * Returns a BaseFont which can be used to represent the given AWT Font * * @param font the font to be converted/*from w ww .j a v a 2 s .c om*/ * @return a BaseFont which has similar properties to the provided Font */ public BaseFont awtToPdf(final Font font) { // this has to be defined in the element, an has to set as a default... final boolean embed = isEmbedFonts(); final String encoding = getDefaultEncoding(); try { return createBaseFont(font.getName(), font.isBold(), font.isItalic(), encoding, embed); } catch (Exception e) { // unable to handle font creation exceptions properly, all we can // do is throw a runtime exception and hope the best .. throw new BaseFontCreateException("Unable to create font: " + font, e); } }