Example usage for com.lowagie.text ExceptionConverter getException

List of usage examples for com.lowagie.text ExceptionConverter getException

Introduction

In this page you can find the example usage for com.lowagie.text ExceptionConverter getException.

Prototype

public Exception getException() 

Source Link

Document

and allow the user of ExceptionConverter to get a handle to it.

Usage

From source file:com.amphisoft.epub2pdf.content.TextFactory.java

License:Open Source License

public static boolean setDefaultFontByName(String fontName) {
    fontName = fontName.toLowerCase().trim();
    if (TextFactory.fontFamilyRegistered(fontName)) {
        Font newDefaultFont = null;
        try {//from ww  w .  j  a v  a2 s.c  o m
            newDefaultFont = FontFactory.getFont(fontName, BaseFont.IDENTITY_H, BaseFont.EMBEDDED);
        } catch (ExceptionConverter eC) {
            if (eC.getException() instanceof UnsupportedEncodingException) {
                newDefaultFont = FontFactory.getFont(fontName, FontFactory.defaultEncoding, BaseFont.EMBEDDED);
            } else {
                throw new RuntimeException(eC);
            }
        }
        newDefaultFont.setSize(_defaultFontSize);
        _defaultFont = newDefaultFont;
        return true;
    } else {
        return false;
    }
}