/** * Get a font by index * * @param idx * 0-based index of the font * @return of an instance of <code>PPFont</code> or <code>null</code> if not * found */ public HSLFFontInfo getFont(int idx) { return getDocumentRecord().getEnvironment().getFontCollection().getFontInfo(idx); }
/** * Add font with the given FontInfo configuration to the font collection. * The returned FontInfo contains the HSLF specific details and the collection * uniquely contains fonts based on their typeface, i.e. calling the method with FontInfo * objects having the same name results in the same HSLFFontInfo reference. * * @param fontInfo the FontInfo configuration, can be a instance of {@link HSLFFontInfo}, * {@link HSLFFontInfoPredefined} or a custom implementation * @return the register HSLFFontInfo object */ public HSLFFontInfo addFont(FontInfo fontInfo) { HSLFFontInfo fi = getFontInfo(fontInfo.getTypeface()); if (fi != null) { return fi; } fi = new HSLFFontInfo(fontInfo); fi.setIndex(fonts.size()); fonts.put(fi.getTypeface(), fi); FontEntityAtom fnt = fi.createRecord(); // Append new child to the end appendChildRecord(fnt); // the added font is the last in the list return fi; }