Search in sources :

Example 1 with MxlFont

use of com.xenoage.zong.musicxml.types.attributes.MxlFont in project Zong by Xenoage.

the class MxlDefaults method read.

@MaybeNull
public static MxlDefaults read(XmlReader reader) {
    MxlScaling scaling = null;
    MxlLayout layout = new MxlLayout();
    MxlFont wordFont = null;
    MxlLyricFont lyricFont = null;
    while (reader.openNextChildElement()) {
        String n = reader.getElementName();
        if (n.equals(MxlScaling.elemName))
            scaling = MxlScaling.read(reader);
        else if (n.equals("word-font"))
            wordFont = MxlFont.read(reader);
        else if (// read only first
        n.equals(MxlLyricFont.elemName) && lyricFont == null)
            lyricFont = MxlLyricFont.read(reader);
        else
            layout.readElement(reader);
        reader.closeElement();
    }
    if (false == layout.isUsed())
        layout = null;
    if (scaling != null || layout != null || wordFont != null || lyricFont != null)
        return new MxlDefaults(scaling, layout, wordFont, lyricFont);
    else
        return null;
}
Also used : MxlLayout(com.xenoage.zong.musicxml.types.groups.MxlLayout) MxlFont(com.xenoage.zong.musicxml.types.attributes.MxlFont) MaybeNull(com.xenoage.utils.annotations.MaybeNull)

Example 2 with MxlFont

use of com.xenoage.zong.musicxml.types.attributes.MxlFont in project Zong by Xenoage.

the class MxlLyricFont method read.

@MaybeNull
public static MxlLyricFont read(XmlReader reader) {
    String number = reader.getAttribute("number");
    String name = reader.getAttribute("name");
    MxlFont font = MxlFont.read(reader);
    if (number != null || name != null || font != null)
        return new MxlLyricFont(number, name, font);
    else
        return null;
}
Also used : MxlFont(com.xenoage.zong.musicxml.types.attributes.MxlFont) MaybeNull(com.xenoage.utils.annotations.MaybeNull)

Example 3 with MxlFont

use of com.xenoage.zong.musicxml.types.attributes.MxlFont in project Zong by Xenoage.

the class FontInfoReader method read.

/**
 * Reads the font from the given element, if it is a {@link MxlPrintStyleContent} element
 * and contains font information. The returned font is based on the given default font.
 */
@MaybeNull
public static FontInfo read(Object printStyleElement, FontInfo defaultFont) {
    if (false == printStyleElement instanceof MxlPrintStyleContent)
        return null;
    MxlPrintStyle mxlPrintStyle = ((MxlPrintStyleContent) printStyleElement).getPrintStyle();
    MxlFont mxlFont = mxlPrintStyle.getFont();
    return new FontInfoReader(mxlFont, defaultFont).read();
}
Also used : MxlPrintStyleContent(com.xenoage.zong.musicxml.types.util.MxlPrintStyleContent) MxlFont(com.xenoage.zong.musicxml.types.attributes.MxlFont) MxlPrintStyle(com.xenoage.zong.musicxml.types.attributes.MxlPrintStyle) MaybeNull(com.xenoage.utils.annotations.MaybeNull)

Aggregations

MaybeNull (com.xenoage.utils.annotations.MaybeNull)3 MxlFont (com.xenoage.zong.musicxml.types.attributes.MxlFont)3 MxlPrintStyle (com.xenoage.zong.musicxml.types.attributes.MxlPrintStyle)1 MxlLayout (com.xenoage.zong.musicxml.types.groups.MxlLayout)1 MxlPrintStyleContent (com.xenoage.zong.musicxml.types.util.MxlPrintStyleContent)1