Example usage for com.lowagie.text FontFactory registerDirectory

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

Introduction

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

Prototype

public static int registerDirectory(String dir, boolean scanSubdirectories) 

Source Link

Document

Register all the fonts in a directory and possibly its subdirectories.

Usage

From source file:org.mapfish.print.MapPrinter.java

License:Open Source License

/**
 * Register the user specified fonts in iText.
 *///from w w  w.j  ava 2s.  com
private void initFonts() {
    //we don't do that since it takes ages and that would hurt the perfs for
    //the python controller:
    //FontFactory.registerDirectories();

    FontFactory.defaultEmbedding = true;

    final TreeSet<String> fontPaths = config.getFonts();
    if (fontPaths != null) {
        for (String fontPath : fontPaths) {
            fontPath = fontPath.replaceAll("\\$\\{configDir\\}", configDir);
            File fontFile = new File(fontPath);
            if (fontFile.isDirectory()) {
                FontFactory.registerDirectory(fontPath, true);
            } else {
                FontFactory.register(fontPath);
            }
        }
    }
}