Class Factory

Factory implements a high level API around VexFlow.

Hierarchy

  • Factory

Constructors

  • Example:

    Create an SVG renderer and attach it to the DIV element named "boo" to render using 1200 and 600

    const vf: Factory = new Vex.Flow.Factory({renderer: { elementId: 'boo', width: 1200, height: 600 }});

    Parameters

    Returns Factory

Properties

DEBUG: boolean = false

To enable logging for this class. Set Vex.Flow.Factory.DEBUG to true.

TEXT_FONT: Required<FontInfo> = ...

Default text font.

Methods

  • Parameters

    • params: {
          type: string;
      }
      • type: string

    Returns Accidental

  • Parameters

    • Optional params: {
          betweenLines?: boolean;
          position?: string | number;
          type?: string;
      }
      • Optional betweenLines?: boolean
      • Optional position?: string | number
      • Optional type?: string

    Returns Articulation

  • Parameters

    • params: {
          notes: StemmableNote[];
          options?: {
              autoStem?: boolean;
              partialBeamDirections?: {
                  [noteIndex: number]: PartialBeamDirection;
              };
              secondaryBeamBreaks?: number[];
          };
      }
      • notes: StemmableNote[]
      • Optional options?: {
            autoStem?: boolean;
            partialBeamDirections?: {
                [noteIndex: number]: PartialBeamDirection;
            };
            secondaryBeamBreaks?: number[];
        }

    Returns Beam

  • Parameters

    • Optional params: {
          fontFamily?: string;
          fontSize?: number;
          fontWeight?: string;
          hJustify?: string;
          kerning?: boolean;
          reportWidth?: boolean;
          vJustify?: string;
      }
      • Optional fontFamily?: string
      • Optional fontSize?: number
      • Optional fontWeight?: string
      • Optional hJustify?: string
      • Optional kerning?: boolean
      • Optional reportWidth?: boolean
      • Optional vJustify?: string

    Returns ChordSymbol

  • Parameters

    • Optional params: {
          options?: {
              annotation?: string;
              size?: string;
          };
          type?: string;
      }
      • Optional options?: {
            annotation?: string;
            size?: string;
        }
        • Optional annotation?: string
        • Optional size?: string
      • Optional type?: string

    Returns ClefNote

  • Creates EasyScore. Normally the first step after constructing a Factory. For example:

    const vf: Factory = new Vex.Flow.Factory({renderer: { elementId: 'boo', width: 1200, height: 600 }});
    const score: EasyScore = vf.EasyScore();

    Parameters

    Returns EasyScore

  • Parameters

    • params: {
          number?: string;
          position?: string;
      }
      • Optional number?: string
      • Optional position?: string

    Returns FretHandFinger

  • Parameters

    • params: {
          alterKey?: string[];
          cancelKey?: string;
          key: string;
      }
      • Optional alterKey?: string[]
      • Optional cancelKey?: string
      • key: string

    Returns KeySigNote

  • Parameters

    • type: string
    • Optional params: {
          delayed?: boolean;
          lowerAccidental?: string;
          position?: string | number;
          upperAccidental?: string;
      }
      • Optional delayed?: boolean
      • Optional lowerAccidental?: string
      • Optional position?: string | number
      • Optional upperAccidental?: string

    Returns Ornament

  • Parameters

    • Optional params: {
          notes?: StaveNote[];
          options?: {
              style: string;
          };
      }
      • Optional notes?: StaveNote[]
      • Optional options?: {
            style: string;
        }
        • style: string

    Returns PedalMarking

  • Return pixels from current stave spacing.

    Parameters

    • Optional params: {
          options?: StaveOptions;
          width?: number;
          x?: number;
          y?: number;
      }
      • Optional options?: StaveOptions
      • Optional width?: number
      • Optional x?: number
      • Optional y?: number

    Returns Stave

  • Parameters

    • params: {
          first_indices: number[];
          from: StaveNote;
          last_indices: number[];
          options?: {
              font?: FontInfo;
              text?: string;
          };
          to: StaveNote;
      }
      • first_indices: number[]
      • from: StaveNote
      • last_indices: number[]
      • Optional options?: {
            font?: FontInfo;
            text?: string;
        }
        • Optional font?: FontInfo
        • Optional text?: string
      • to: StaveNote

    Returns StaveLine

  • Parameters

    • params: {
          first_indices?: number[];
          from?: null | Note;
          last_indices?: number[];
          options?: {
              direction?: number;
          };
          text?: string;
          to?: null | Note;
      }
      • Optional first_indices?: number[]
      • Optional from?: null | Note
      • Optional last_indices?: number[]
      • Optional options?: {
            direction?: number;
        }
        • Optional direction?: number
      • Optional text?: string
      • Optional to?: null | Note

    Returns StaveTie

  • Parameters

    • params: {
          number: string;
          position: string;
      }
      • number: string
      • position: string
    • drawCircle: boolean = true

    Returns StringNumber

  • Parameters

    • Optional params: {
          options?: StaveOptions;
          width?: number;
          x?: number;
          y?: number;
      }
      • Optional options?: StaveOptions
      • Optional width?: number
      • Optional x?: number
      • Optional y?: number

    Returns TabStave

  • Parameters

    • params: {
          from: Note;
          options: {
              font?: FontInfo;
              line?: number;
              position: string;
              superscript: string;
          };
          text: string;
          to: Note;
      }
      • from: Note
      • options: {
            font?: FontInfo;
            line?: number;
            position: string;
            superscript: string;
        }
        • Optional font?: FontInfo
        • Optional line?: number
        • position: string
        • superscript: string
      • text: string
      • to: Note

    Returns TextBracket

  • Parameters

    • Optional params: {
          dots?: number;
          duration?: string;
          line?: number;
          text?: string;
      }
      • Optional dots?: number
      • Optional duration?: string
      • Optional line?: number
      • Optional text?: string

    Returns TextDynamics

  • Parameters

    • Optional params: {
          time?: string;
      }
      • Optional time?: string

    Returns TimeSigNote

  • Parameters

    • params: {
          from: null | Note;
          options: {
              harsh?: boolean;
              line?: number;
          };
          to: null | Note;
      }
      • from: null | Note
      • options: {
            harsh?: boolean;
            line?: number;
        }
        • Optional harsh?: boolean
        • Optional line?: number
      • to: null | Note

    Returns VibratoBracket

  • Render the score.

    Returns void

  • Returns undefined | Stave

  • Returns void

  • Returns void

  • Parameters

    Returns void

  • Static simplified function to access constructor without providing FactoryOptions

    Example:

    Create an SVG renderer and attach it to the DIV element named "boo" to render using 1200 and 600

    const vf: Factory = Vex.Flow.Factory.newFromElementId('boo', 1200, 600 );

    Parameters

    • elementId: null | string
    • width: number = 500
    • height: number = 200

    Returns Factory