Search in sources :

Example 1 with MxlFontWeight

use of com.xenoage.zong.musicxml.types.enums.MxlFontWeight in project Zong by Xenoage.

the class MxlFont method read.

public static MxlFont read(XmlReader reader) {
    List<String> fontFamily = alist();
    String fontFamilies = reader.getAttribute("font-family");
    if (fontFamilies != null) {
        for (String s : fontFamilies.split(",")) {
            fontFamily.add(s.trim());
        }
    }
    MxlFontStyle fontStyle = MxlFontStyle.read(reader);
    MxlFontSize fontSize = MxlFontSize.read(reader);
    MxlFontWeight fontWeight = MxlFontWeight.read(reader);
    if (fontFamily.size() > 0 || fontStyle != MxlFontStyle.Unknown || fontSize != MxlFontSize.noFontSize || fontWeight != MxlFontWeight.Unknown)
        return new MxlFont(fontFamily, fontStyle, fontSize, fontWeight);
    else
        return noFont;
}
Also used : MxlFontWeight(com.xenoage.zong.musicxml.types.enums.MxlFontWeight) MxlFontStyle(com.xenoage.zong.musicxml.types.enums.MxlFontStyle)

Example 2 with MxlFontWeight

use of com.xenoage.zong.musicxml.types.enums.MxlFontWeight in project Zong by Xenoage.

the class FontInfoReader method readStyle.

private FontStyle readStyle() {
    FontStyle style = defaultFont.getStyleOrNull();
    // font style
    MxlFontStyle mxlStyle = mxlFont.getFontStyle();
    if (mxlStyle != MxlFontStyle.Unknown) {
        boolean isItalic = mxlStyle == MxlFontStyle.Italic;
        style = style.with(FontStyle.Italic, isItalic);
    }
    // font weight
    MxlFontWeight mxlWeight = mxlFont.getFontWeight();
    if (mxlWeight != null) {
        boolean isBold = mxlWeight == MxlFontWeight.Bold;
        style = style.with(FontStyle.Bold, isBold);
    }
    return style;
}
Also used : FontStyle(com.xenoage.utils.font.FontStyle) MxlFontStyle(com.xenoage.zong.musicxml.types.enums.MxlFontStyle) MxlFontWeight(com.xenoage.zong.musicxml.types.enums.MxlFontWeight) MxlFontStyle(com.xenoage.zong.musicxml.types.enums.MxlFontStyle)

Aggregations

MxlFontStyle (com.xenoage.zong.musicxml.types.enums.MxlFontStyle)2 MxlFontWeight (com.xenoage.zong.musicxml.types.enums.MxlFontWeight)2 FontStyle (com.xenoage.utils.font.FontStyle)1