use of com.xenoage.zong.musiclayout.stampings.FrameTextStamping in project Zong by Xenoage.
the class PartNameStamper method stamp.
@MaybeNull
public FrameTextStamping stamp(Part part, int firstStaffIndex, List<StaffStamping> systemStaves, Style style) {
StaffStamping firstStaff = systemStaves.get(firstStaffIndex);
StaffStamping lastStaff = systemStaves.get(firstStaffIndex + part.getStavesCount() - 1);
String name = (style == Style.Full ? part.getName() : part.getAbbreviation());
if (name == null || name.length() == 0)
return null;
// in the middle of the staves
float top = firstStaff.positionMm.y;
float bottom = lastStaff.positionMm.y + (lastStaff.linesCount - 1) * lastStaff.is;
FormattedText text = // TODO
Companion.fText(// TODO
name, // TODO
new FormattedTextStyle(firstStaff.is * 2.5f * 2.67f), Alignment.Right);
if (text.getParagraphs().size() == 0)
return null;
// TODO correction of baseline. /3 looks good.
float middle = (top + bottom) / 2 + text.getFirstParagraph().getMetrics().getAscent() / 3;
return new FrameTextStamping(text, new Point2f(firstStaff.positionMm.x - firstStaff.is * 2.5f, middle), // TODO
null);
}
Aggregations