Example usage for com.lowagie.text Font getFamilyIndex

List of usage examples for com.lowagie.text Font getFamilyIndex

Introduction

In this page you can find the example usage for com.lowagie.text Font getFamilyIndex.

Prototype

public static int getFamilyIndex(String family) 

Source Link

Document

Translates a String -value of a certain family into the index that is used for this family in this class.

Usage

From source file:is.idega.idegaweb.egov.printing.business.DocumentBusinessBean.java

License:Open Source License

private Font decodeFont(String fontstring, Font returnFont) {
    if (fontstring != null) {
        int family = -1;
        StringTokenizer tokener = new StringTokenizer(fontstring, "-");
        // family part
        if (tokener.hasMoreTokens()) {
            family = Font.getFamilyIndex(tokener.nextToken());
        }/*from   www  . j  a v a2  s.com*/
        if (family > -1) {
            Font font = new Font(family);
            // size part
            if (tokener.hasMoreTokens()) {
                float size = Float.parseFloat(tokener.nextToken());
                font.setSize(size);
            }
            // style part
            if (tokener.hasMoreTokens()) {
                font.setStyle(tokener.nextToken());
            }
            // color part
            if (tokener.hasMoreTokens()) {
                font.setColor(IWColor.getAWTColorFromHex(tokener.nextToken()));
            }
            return font;
        }
    }
    return returnFont;
}