Example usage for org.apache.poi.xslf.usermodel XSLFTextRun isSubscript

List of usage examples for org.apache.poi.xslf.usermodel XSLFTextRun isSubscript

Introduction

In this page you can find the example usage for org.apache.poi.xslf.usermodel XSLFTextRun isSubscript.

Prototype

@Override
    public boolean isSubscript() 

Source Link

Usage

From source file:org.joeffice.presentation.ShapeComponent.java

License:Apache License

private AttributeSet getFontAttributes(XSLFTextRun textPart) {
    SimpleAttributeSet attributes = new SimpleAttributeSet();
    String fontFamily = textPart.getFontFamily();
    if (fontFamily != null) {
        StyleConstants.setFontFamily(attributes, fontFamily);
    }/*from   w  w w . j av  a 2s .  co  m*/
    Color textColor = textPart.getFontColor();
    if (textColor != null) {
        StyleConstants.setForeground(attributes, textColor);
    }
    double fontSize = textPart.getFontSize();
    if (fontSize > 0) {
        fontSize = fontSize * slideComponent.getScale();
        StyleConstants.setFontSize(attributes, (int) fontSize);
    }
    boolean italic = textPart.isItalic();
    if (italic) {
        StyleConstants.setItalic(attributes, true);
    }
    boolean bold = textPart.isBold();
    if (bold) {
        StyleConstants.setBold(attributes, true);
    }
    boolean underlined = textPart.isUnderline();
    if (underlined) {
        StyleConstants.setUnderline(attributes, true);
    }
    boolean strikeThrough = textPart.isStrikethrough();
    if (strikeThrough) {
        StyleConstants.setStrikeThrough(attributes, true);
    }
    boolean subScript = textPart.isSubscript();
    if (subScript) {
        StyleConstants.setSubscript(attributes, true);
    }
    boolean superScript = textPart.isSuperscript();
    if (superScript) {
        StyleConstants.setSuperscript(attributes, true);
    }
    return attributes;
}