private void DrawOrnaments(ScoreRendererBase renderer, Note element, double notePositionY, FontProfile fontProfile)
        {
            foreach (Ornament ornament in element.Ornaments)
            {
                double yPosition;
                if (ornament.DefaultYPosition.HasValue)
                {
                    var yShift = renderer.TenthsToPixels(ornament.DefaultYPosition.Value);
                    yPosition = scoreService.CurrentLinePositions[0] + yShift;
                }
                else
                {
                    yPosition = notePositionY + (ornament.Placement == VerticalPlacement.Above ? -20 : 20);
                }

                yPosition = CorrectOrnamentYPositionToAvoidIntersection(renderer, ornament.Placement, renderer.LinespacesToPixels(1), yPosition, element, notePositionY);

                Mordent mordent = ornament as Mordent;
                if (mordent != null)
                {
                    if (renderer.IsSMuFLFont)
                    {
                        renderer.DrawCharacter(mordent.GetCharacter(fontProfile.MusicFont),
                                               MusicFontStyles.MusicFont, scoreService.CursorPositionX - element.GetNoteheadWidthPx(renderer) / 2,
                                               yPosition, element);
                    }
                    else
                    {
                        renderer.DrawCharacter(fontProfile.MusicFont.MordentShort, MusicFontStyles.GraceNoteFont, scoreService.CursorPositionX, yPosition, element);
                        renderer.DrawCharacter(fontProfile.MusicFont.Mordent, MusicFontStyles.GraceNoteFont, scoreService.CursorPositionX + 5.5, yPosition, element);
                    }
                }
            }
        }
Example #2
0
 private void DrawOrnaments(ScoreRendererBase renderer, Note element, double notePositionY)
 {
     foreach (Ornament ornament in element.Ornaments)
     {
         double  yPositionShift = ornament.DefaultYPosition.HasValue ? renderer.TenthsToPixels(ornament.DefaultYPosition.Value) * -1 : (ornament.Placement == VerticalPlacement.Above ? -20 : 20);
         Mordent mordent        = ornament as Mordent;
         if (mordent != null)
         {
             renderer.DrawString(renderer.Settings.CurrentFont.MordentShort, MusicFontStyles.GraceNoteFont, scoreService.CursorPositionX - 2, notePositionY + yPositionShift, element);
             renderer.DrawString(renderer.Settings.CurrentFont.Mordent, MusicFontStyles.GraceNoteFont, scoreService.CursorPositionX + 3.5, notePositionY + yPositionShift, element);
         }
     }
 }