use of com.xenoage.zong.musicxml.types.MxlPageMargins in project Zong by Xenoage.
the class LayoutFormatReader method readPageLayout.
private void readPageLayout() {
MxlPageLayout mxlPageLayout = mxlLayout.getPageLayout();
if (mxlPageLayout == null)
return;
Size2f size = PageFormat.Companion.getDefaultValue().getSize();
// page-width and page-height
Size2f mxlPageSize = mxlPageLayout.getPageSize();
if (mxlPageSize != null)
size = new Size2f(tenthsMm * mxlPageSize.width, tenthsMm * mxlPageSize.height);
// page-margins
PageMargins pageMarginsLeft = PageMargins.Companion.getDefaultValue();
PageMargins pageMarginsRight = PageMargins.Companion.getDefaultValue();
for (MxlPageMargins mxlMargins : mxlPageLayout.getPageMargins()) {
PageMargins pageMargins = new PageMargins(tenthsMm * mxlMargins.getLeftMargin(), tenthsMm * mxlMargins.getRightMargin(), tenthsMm * mxlMargins.getTopMargin(), tenthsMm * mxlMargins.getBottomMargin());
// left, right page or both? default: both
switch(mxlMargins.getType()) {
case Both:
pageMarginsLeft = pageMargins;
pageMarginsRight = pageMargins;
break;
case Odd:
pageMarginsRight = pageMargins;
break;
case Even:
pageMarginsRight = pageMargins;
break;
}
}
layoutFormat = new LayoutFormat(new PageFormat(size, pageMarginsLeft), new PageFormat(size, pageMarginsRight));
}
Aggregations