/** * @return font family or null if not set */ public String getFontFamily(){ CTTextCharacterProperties rPr = getRPr(); CTTextFont font = rPr.getLatin(); if(font != null){ return font.getTypeface(); } return XSSFFont.DEFAULT_FONT_NAME; }
@Override public void setFamily(FontFamily family) { CTTextFont tf = getXmlObject(true); if (tf == null || (family == null && !tf.isSetPitchFamily())) { return; } FontPitch pitch = (tf.isSetPitchFamily()) ? FontPitch.valueOfPitchFamily(tf.getPitchFamily()) : FontPitch.VARIABLE; byte pitchFamily = FontPitch.getNativeId(pitch, family != null ? family : FontFamily.FF_SWISS); tf.setPitchFamily(pitchFamily); }
public XDDFFont(FontGroup group, String typeface, Byte charset, Byte pitch, byte[] panose) { this(group, CTTextFont.Factory.newInstance()); if (typeface == null) { if (font.isSetTypeface()) { font.unsetTypeface(); font.setTypeface(typeface); if (font.isSetCharset()) { font.unsetCharset(); font.setCharset(charset); if (font.isSetPitchFamily()) { font.unsetPitchFamily(); font.setPitchFamily(pitch); if (font.isSetPanose()) { font.unsetPanose(); font.setPanose(panose);
public Byte getCharset() { if (font.isSetCharset()) { return font.getCharset(); } else { return null; } }
public String getTypeface() { if (font.isSetTypeface()) { return font.getTypeface(); } else { return null; } }
public Byte getPitchFamily() { if (font.isSetPitchFamily()) { return font.getPitchFamily(); } else { return null; } }
public void setFontFamily(String typeface, byte charset, byte pictAndFamily, boolean isSymbol){ CTTextCharacterProperties rPr = getRPr(); if(typeface == null){ if(rPr.isSetLatin()) rPr.unsetLatin(); if(rPr.isSetCs()) rPr.unsetCs(); if(rPr.isSetSym()) rPr.unsetSym(); } else { if(isSymbol){ CTTextFont font = rPr.isSetSym() ? rPr.getSym() : rPr.addNewSym(); font.setTypeface(typeface); } else { CTTextFont latin = rPr.isSetLatin() ? rPr.getLatin() : rPr.addNewLatin(); latin.setTypeface(typeface); if(charset != -1) latin.setCharset(charset); if(pictAndFamily != -1) latin.setPitchFamily(pictAndFamily); } } }
public void setBulletFont(String typeface){ CTTextParagraphProperties pr = _p.isSetPPr() ? _p.getPPr() : _p.addNewPPr(); CTTextFont font = pr.isSetBuFont() ? pr.getBuFont() : pr.addNewBuFont(); font.setTypeface(typeface); }
@Override public void setCharset(FontCharset charset) { CTTextFont tf = getXmlObject(true); if (tf == null) { return; } if (charset != null) { tf.setCharset((byte)charset.getNativeId()); } else { if (tf.isSetCharset()) { tf.unsetCharset(); } } }
public byte[] getPanose() { if (font.isSetPanose()) { return font.getPanose(); } else { return null; } } }
void copyFrom(FontInfo fontInfo) { CTTextFont tf = getXmlObject(true); if (tf == null) { return; } setTypeface(fontInfo.getTypeface()); setCharset(fontInfo.getCharset()); FontPitch pitch = fontInfo.getPitch(); FontFamily family = fontInfo.getFamily(); if (pitch == null && family == null) { if (tf.isSetPitchFamily()) { tf.unsetPitchFamily(); } } else { setPitch(pitch); setFamily(family); } }
public byte getPitchAndFamily(){ CTTextCharacterProperties rPr = getRPr(); CTTextFont font = rPr.getLatin(); if(font != null){ return font.getPitchFamily(); } return 0; }
@Override public String getTypeface() { CTTextFont tf = getXmlObject(false); return (tf != null && tf.isSetTypeface()) ? tf.getTypeface() : null; }
public void setFontFamily(String typeface, byte charset, byte pictAndFamily, boolean isSymbol){ CTTextCharacterProperties rPr = getRPr(); if(typeface == null){ if(rPr.isSetLatin()) rPr.unsetLatin(); if(rPr.isSetCs()) rPr.unsetCs(); if(rPr.isSetSym()) rPr.unsetSym(); } else { if(isSymbol){ CTTextFont font = rPr.isSetSym() ? rPr.getSym() : rPr.addNewSym(); font.setTypeface(typeface); } else { CTTextFont latin = rPr.isSetLatin() ? rPr.getLatin() : rPr.addNewLatin(); latin.setTypeface(typeface); if(charset != -1) latin.setCharset(charset); if(pictAndFamily != -1) latin.setPitchFamily(pictAndFamily); } } }
@SuppressWarnings("WeakerAccess") public void setBulletFont(String typeface){ CTTextParagraphProperties pr = _p.isSetPPr() ? _p.getPPr() : _p.addNewPPr(); CTTextFont font = pr.isSetBuFont() ? pr.getBuFont() : pr.addNewBuFont(); font.setTypeface(typeface); }
@Override public FontFamily getFamily() { CTTextFont tf = getXmlObject(false); return (tf != null && tf.isSetPitchFamily()) ? FontFamily.valueOfPitchFamily(tf.getPitchFamily()) : null; }
@Override public void setCharset(FontCharset charset) { CTTextFont tf = getXmlObject(true); if (tf == null) { return; } if (charset != null) { tf.setCharset((byte)charset.getNativeId()); } else { if (tf.isSetCharset()) { tf.unsetCharset(); } } }
@Override public FontCharset getCharset() { CTTextFont tf = getXmlObject(false); return (tf != null && tf.isSetCharset()) ? FontCharset.valueOf(tf.getCharset()&0xFF) : null; }
public byte[] getPanose() { if (font.isSetPanose()) { return font.getPanose(); } else { return null; } } }
void copyFrom(FontInfo fontInfo) { CTTextFont tf = getXmlObject(true); if (tf == null) { return; } setTypeface(fontInfo.getTypeface()); setCharset(fontInfo.getCharset()); FontPitch pitch = fontInfo.getPitch(); FontFamily family = fontInfo.getFamily(); if (pitch == null && family == null) { if (tf.isSetPitchFamily()) { tf.unsetPitchFamily(); } } else { setPitch(pitch); setFamily(family); } }