/** * Add font with the specified name to the font collection. * If the font is already present return its index. * @param name of the font * @return zero based index of the font in the collection */ public int addFont(String name) { int idx = getFontIndex(name); if(idx != -1) return idx; return addFont(name, 0, 0, 4, 34); }
/** * Sets the font name to use */ public void setFontName(String fontName) { if (slideShow == null) { //we can't set font since slideshow is not assigned yet _fontname = fontName; } else { // Get the index for this font (adding if needed) int fontIdx = slideShow.getFontCollection().addFont(fontName); setCharTextPropVal("font.index", fontIdx); } }
/** * Add a font in this presentation * * @param fontInfo the font to add * @return the registered HSLFFontInfo - the font info object is unique based on the typeface */ public HSLFFontInfo addFont(FontInfo fontInfo) { return getDocumentRecord().getEnvironment().getFontCollection().addFont(fontInfo); }
/** * Add a font in this presentation * * @param font * the font to add * @return 0-based index of the font */ public int addFont(PPFont font) { FontCollection fonts = getDocumentRecord().getEnvironment().getFontCollection(); int idx = fonts.getFontIndex(font.getFontName()); if (idx == -1) { idx = fonts.addFont(font.getFontName(), font.getCharSet(), font.getFontFlags(), font .getFontType(), font.getPitchAndFamily()); } return idx; }