use of com.tom_roush.fontbox.ttf.TrueTypeCollection.TrueTypeFontProcessor in project PdfBox-Android by TomRoush.
the class FileSystemFontProvider method addTrueTypeCollection.
/**
* Adds a TTC or OTC to the file cache. To reduce memory, the parsed font is not cached.
*/
private void addTrueTypeCollection(final File ttcFile) throws IOException {
TrueTypeCollection ttc = null;
try {
ttc = new TrueTypeCollection(ttcFile);
ttc.processAllFonts(new TrueTypeFontProcessor() {
@Override
public void process(TrueTypeFont ttf) throws IOException {
addTrueTypeFontImpl(ttf, ttcFile);
}
});
} catch (// TTF parser is buggy
NullPointerException e) {
Log.e("PdfBox-Android", "Could not load font file: " + ttcFile, e);
} catch (IOException e) {
Log.e("PdfBox-Android", "Could not load font file: " + ttcFile, e);
} finally {
if (ttc != null) {
ttc.close();
}
}
}
Aggregations