Example usage for com.lowagie.text.pdf BaseField setFont

List of usage examples for com.lowagie.text.pdf BaseField setFont

Introduction

In this page you can find the example usage for com.lowagie.text.pdf BaseField setFont.

Prototype

public void setFont(BaseFont font) 

Source Link

Document

Sets the text font.

Usage

From source file:buckley.compile.TextModifier.java

License:Apache License

public void modify(BaseField iTextField, TextField field, Document document) {
    FontRegistry fontRegistry = document.getFontRegistry();

    BaseFont font = fontRegistry.getDefaultFont();
    float size = fontRegistry.getDefaultFontSize();

    if (field.getFontName() != null) {
        font = fontRegistry.getFont(field.getFontName());
    }//from w  w  w .  ja v a2s.  c o  m

    if (field.getFontSize() != null && field.getFontSize() > 0.0f) {
        size = field.getFontSize();
    }

    iTextField.setFont(font);
    iTextField.setFontSize(size);
}