use of com.xenoage.zong.core.text.Superscript in project Zong by Xenoage.
the class FormattedTextConverter method getStyleFromAttributeSet.
private static FormattedTextStyle getStyleFromAttributeSet(AttributeSet attr) {
if (attr == null) {
return FormattedTextStyle.Companion.getDefaultStyle();
}
// font style
FontStyle fontStyle = FontStyle.normal;
if (StyleConstants.isBold(attr)) {
fontStyle = fontStyle.with(FontStyle.Bold);
}
if (StyleConstants.isItalic(attr)) {
fontStyle = fontStyle.with(FontStyle.Italic);
}
if (StyleConstants.isUnderline(attr)) {
fontStyle = fontStyle.with(FontStyle.Underline);
}
if (StyleConstants.isStrikeThrough(attr)) {
fontStyle = fontStyle.with(FontStyle.Strikethrough);
}
// superscript
Superscript superscript = Superscript.Normal;
if (StyleConstants.isSuperscript(attr)) {
superscript = Superscript.Super;
}
if (StyleConstants.isSubscript(attr)) {
superscript = Superscript.Sub;
}
// font
FontInfo fontInfo = new FontInfo(StyleConstants.getFontFamily(attr), (float) StyleConstants.getFontSize(attr), fontStyle);
return new FormattedTextStyle(fontInfo, fromAwtColor(StyleConstants.getForeground(attr)), superscript);
}
Aggregations