use of org.openxmlformats.schemas.drawingml.x2006.main.CTTextNormalAutofit in project poi by apache.
the class XSLFTextRun method getFontSize.
@Override
public Double getFontSize() {
double scale = 1;
CTTextNormalAutofit afit = getParentParagraph().getParentShape().getTextBodyPr().getNormAutofit();
if (afit != null)
scale = (double) afit.getFontScale() / 100000;
CharacterPropertyFetcher<Double> fetcher = new CharacterPropertyFetcher<Double>(_p.getIndentLevel()) {
public boolean fetch(CTTextCharacterProperties props) {
if (props != null && props.isSetSz()) {
setValue(props.getSz() * 0.01);
return true;
}
return false;
}
};
fetchCharacterProperty(fetcher);
return fetcher.getValue() == null ? null : fetcher.getValue() * scale;
}
use of org.openxmlformats.schemas.drawingml.x2006.main.CTTextNormalAutofit in project poi by apache.
the class XSLFTextParagraph method getLineSpacing.
@Override
public Double getLineSpacing() {
ParagraphPropertyFetcher<Double> fetcher = new ParagraphPropertyFetcher<Double>(getIndentLevel()) {
public boolean fetch(CTTextParagraphProperties props) {
if (props.isSetLnSpc()) {
CTTextSpacing spc = props.getLnSpc();
if (spc.isSetSpcPct())
setValue(spc.getSpcPct().getVal() * 0.001);
else if (spc.isSetSpcPts())
setValue(-spc.getSpcPts().getVal() * 0.01);
return true;
}
return false;
}
};
fetchParagraphProperty(fetcher);
Double lnSpc = fetcher.getValue();
if (lnSpc != null && lnSpc > 0) {
// check if the percentage value is scaled
CTTextNormalAutofit normAutofit = getParentShape().getTextBodyPr().getNormAutofit();
if (normAutofit != null) {
double scale = 1 - (double) normAutofit.getLnSpcReduction() / 100000;
lnSpc *= scale;
}
}
return lnSpc;
}
use of org.openxmlformats.schemas.drawingml.x2006.main.CTTextNormalAutofit in project poi by apache.
the class XSSFTextRun method getFontSize.
/**
* @return font size in points or -1 if font size is not set.
*/
public double getFontSize() {
double scale = 1;
// default font size
double size = XSSFFont.DEFAULT_FONT_SIZE;
CTTextNormalAutofit afit = getParentParagraph().getParentShape().getTxBody().getBodyPr().getNormAutofit();
if (afit != null)
scale = (double) afit.getFontScale() / 100000;
CTTextCharacterProperties rPr = getRPr();
if (rPr.isSetSz()) {
size = rPr.getSz() * 0.01;
}
return size * scale;
}
Aggregations