public BoundingBox GetSMuFLBoundingBoxPx(ISMuFLFontMetadata metadata, ScoreRendererSettings settings)
        {
            var bbox = GetSMuFLBoundingBox(metadata);

            return(new BoundingBox
            {
                BBoxNe = new double[] { bbox.BBoxNe[0] * settings.LineSpacing, bbox.BBoxNe[1] * settings.LineSpacing },
                BBoxSw = new double[] { bbox.BBoxSw[0] * settings.LineSpacing, bbox.BBoxSw[1] * settings.LineSpacing }
            });
        }
        private static BoundingBox GetSMuFLNoteheadBounds(Note note, ISMuFLFontMetadata metadata)
        {
            var duration = note.BaseDuration;

            switch (note.Size)
            {
            case NoteOrRestSize.Full:
                if (duration == RhythmicDuration.Whole)
                {
                    return(metadata.GlyphBBoxes.NoteheadWhole);
                }
                else if (duration == RhythmicDuration.Half)
                {
                    return(metadata.GlyphBBoxes.NoteheadHalf);
                }
                else
                {
                    return(metadata.GlyphBBoxes.NoteheadBlack);
                }

            case NoteOrRestSize.Cue:
                if (duration == RhythmicDuration.Whole)
                {
                    return(metadata.GlyphBBoxes.NoteheadWholeSmall);
                }
                else if (duration == RhythmicDuration.Half)
                {
                    return(metadata.GlyphBBoxes.NoteheadHalfSmall);
                }
                else
                {
                    return(metadata.GlyphBBoxes.NoteheadBlackSmall);
                }

            case NoteOrRestSize.Large:
                if (duration == RhythmicDuration.Whole)
                {
                    return(metadata.GlyphBBoxes.NoteheadWholeOversized);
                }
                else if (duration == RhythmicDuration.Half)
                {
                    return(metadata.GlyphBBoxes.NoteheadHalfOversized);
                }
                else
                {
                    return(metadata.GlyphBBoxes.NoteheadBlackOversized);
                }

            default:
                throw new Exception($"Note size {note.Size} not supported.");
            }
        }
 public BoundingBox GetSMuFLBoundingBox(ISMuFLFontMetadata metadata)
 {
     if (RepeatSign == RepeatSignType.Backward)
     {
         return(metadata.GlyphBBoxes.RepeatRight);
     }
     else if (RepeatSign == RepeatSignType.Forward)
     {
         return(metadata.GlyphBBoxes.RepeatLeft);
     }
     else
     {
         return(null);
     }
 }
 public BoundingBox GetSMuFLBoundingBox(ISMuFLFontMetadata metadata)
 {
     if (typeOfClef == ClefType.GClef)
     {
         return(metadata.GlyphBBoxes.GClef);
     }
     else if (typeOfClef == ClefType.FClef)
     {
         return(metadata.GlyphBBoxes.FClef);
     }
     else if (typeOfClef == ClefType.CClef)
     {
         return(metadata.GlyphBBoxes.CClef);
     }
     else if (typeOfClef == ClefType.Percussion)
     {
         return(metadata.GlyphBBoxes.SemipitchedPercussionClef1);
     }
     else
     {
         return(metadata.GlyphBBoxes.GClef);
     }
 }
示例#5
0
 internal SMuFLFontProfile(ISMuFLFontMetadata metadata)
 {
     this.metadata = metadata;
 }