/// <summary> /// This virtual function writes the staff name and barnumber to the SVG file (if they are present). /// Overrides write the region info (if present). /// The barline itself is drawn when the system (and staff edges) is complete. /// </summary> public virtual void WriteDrawObjectsSVG(SvgWriter w) { if (StaffNameMetrics != null) { StaffNameMetrics.WriteSVG(w); } if (BarnumberMetrics != null) { BarnumberMetrics.WriteSVG(w); } }
protected void SetCommonMetrics(Graphics graphics, List <DrawObject> drawObjects) { StaffMetrics staffMetrics = Voice.Staff.Metrics; foreach (DrawObject drawObject in DrawObjects) { if (drawObject is StaffNameText staffNameText) { CSSObjectClass staffClass = CSSObjectClass.staffName; StaffNameMetrics = new StaffNameMetrics(staffClass, graphics, staffNameText.TextInfo); // move the staffname vertically to the middle of this staff double staffheight = staffMetrics.StafflinesBottom - staffMetrics.StafflinesTop; double dy = (staffheight * 0.5F) + (Gap * 0.8F); StaffNameMetrics.Move(0, dy); } if (drawObject is FramedBarNumberText framedBarNumberText) { BarnumberMetrics = new BarnumberMetrics(graphics, framedBarNumberText.TextInfo, framedBarNumberText.FrameInfo); // move the bar number to its default (=lowest) position above this staff. BarnumberMetrics.Move(0, staffMetrics.StafflinesTop - BarnumberMetrics.Bottom - (Gap * 3)); } } }