use of org.openxmlformats.schemas.drawingml.x2006.main.CTTextFont in project poi by apache.
the class XSLFTextParagraph method setBulletFont.
public void setBulletFont(String typeface) {
CTTextParagraphProperties pr = _p.isSetPPr() ? _p.getPPr() : _p.addNewPPr();
CTTextFont font = pr.isSetBuFont() ? pr.getBuFont() : pr.addNewBuFont();
font.setTypeface(typeface);
}
use of org.openxmlformats.schemas.drawingml.x2006.main.CTTextFont in project poi by apache.
the class XSLFTextRun method getFontFamily.
@Override
public String getFontFamily() {
final XSLFTheme theme = _p.getParentShape().getSheet().getTheme();
CharacterPropertyFetcher<String> visitor = new CharacterPropertyFetcher<String>(_p.getIndentLevel()) {
public boolean fetch(CTTextCharacterProperties props) {
if (props != null) {
CTTextFont font = props.getLatin();
if (font != null) {
String typeface = font.getTypeface();
if ("+mj-lt".equals(typeface)) {
typeface = theme.getMajorFont();
} else if ("+mn-lt".equals(typeface)) {
typeface = theme.getMinorFont();
}
setValue(typeface);
return true;
}
}
return false;
}
};
fetchCharacterProperty(visitor);
return visitor.getValue();
}
use of org.openxmlformats.schemas.drawingml.x2006.main.CTTextFont in project poi by apache.
the class XSLFTextRun method setFontFamily.
public void setFontFamily(String typeface, byte charset, byte pictAndFamily, boolean isSymbol) {
CTTextCharacterProperties rPr = getRPr(true);
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);
}
}
}
use of org.openxmlformats.schemas.drawingml.x2006.main.CTTextFont in project poi by apache.
the class XSSFTextRun method getPitchAndFamily.
public byte getPitchAndFamily() {
CTTextCharacterProperties rPr = getRPr();
CTTextFont font = rPr.getLatin();
if (font != null) {
return font.getPitchFamily();
}
return 0;
}
use of org.openxmlformats.schemas.drawingml.x2006.main.CTTextFont in project poi by apache.
the class XSLFTextRun method getPitchAndFamily.
public byte getPitchAndFamily() {
// final XSLFTheme theme = _p.getParentShape().getSheet().getTheme();
CharacterPropertyFetcher<Byte> visitor = new CharacterPropertyFetcher<Byte>(_p.getIndentLevel()) {
public boolean fetch(CTTextCharacterProperties props) {
if (props != null) {
CTTextFont font = props.getLatin();
if (font != null) {
setValue(font.getPitchFamily());
return true;
}
}
return false;
}
};
fetchCharacterProperty(visitor);
return visitor.getValue() == null ? 0 : visitor.getValue();
}
Aggregations