Example usage for com.lowagie.text FontFactory getFont

List of usage examples for com.lowagie.text FontFactory getFont

Introduction

In this page you can find the example usage for com.lowagie.text FontFactory getFont.

Prototype


public static Font getFont(String fontname, String encoding, boolean embedded, float size, int style,
        Color color) 

Source Link

Document

Constructs a Font-object.

Usage

From source file:org.pz.platypus.plugin.pdf.PdfFontFactory.java

License:Open Source License

/**
 * Opens a font using the IDENTITY-H encoding.
 *
 * @param fontName  the name assigned to the font in the font list
 * @param size the size in points/*from  w ww. jav a  2s .c o  m*/
 * @param style bold, italic, etc.
 * @param color font color (RGB 0-255)
 * @return the Font if opened; null if the file could not be opened or an error occurred.
 */
Font getIdentityHFont(final String fontName, float size, int style, Color color) {
    Font font;
    try {
        font = FontFactory.getFont(fontName, BaseFont.IDENTITY_H, BaseFont.EMBEDDED, size, style, color);
    } catch (Exception ex) {
        font = null;
    }

    return (font);
}