A.12.1 Font

\abs-fontsize size (number) arg (markup)

Use size as the absolute font size (in points) to display arg. Adjusts baseline-skip and word-space accordingly.

\markup {
  default text font size
  \hspace #2
  \abs-fontsize #16 { text font size 16 }
  \hspace #2
  \abs-fontsize #12 { text font size 12 }
}

[image of music]

Used properties:

  • baseline-skip (3)
  • word-space (0.6)
\bold arg (markup)

Switch to bold font-series.

\markup {
  default
  \hspace #2
  \bold
  bold
}

[image of music]

\box arg (markup)

Draw a box round arg. Looks at thickness, box-padding and font-size properties to determine line thickness and padding around the markup.

\markup {
  \override #'(box-padding . 0.5)
  \box
  \line { V. S. }
}

[image of music]

Used properties:

  • box-padding (0.2)
  • font-size (0)
  • thickness (1)
\caps arg (markup)

Copy of the \smallCaps command.

\markup {
  default
  \hspace #2
  \caps {
    Text in small caps
  }
}

[image of music]

\dynamic arg (markup)

Use the dynamic font. This font only contains s, f, m, z, p, and r. When producing phrases, like ‘più f’, the normal words (like ‘più’) should be done in a different font. The recommended font for this is bold and italic.

\markup {
  \dynamic {
    sfzp
  }
}

[image of music]

\figured-bass arg (markup)

Set arg as small numbers for figured bass. Specially slashed digits can be achieved with a trailing backslashes (for numbers 6, 7, and 9) or a trailing plus (for numbers 2, 4, and 5).1

The use of a backslash is in analogy to \figuremode (see Entering figured bass). Note that to get a backslash character in markup it must be escaped by doubling it. Additionally, it must be put into double quotes.

\markup {
  \figured-bass {
    2 3 4+ 7 "9\\"
  }
}

[image of music]

\finger arg (markup)

Set arg as small numbers for fingering instructions.

\markup {
  \finger {
    1 2 3 4 5
  }
}

[image of music]

\fontCaps arg (markup)

Set font-shape to caps

Note: \fontCaps requires the installation and selection of fonts which support the caps font shape.

\fontsize increment (number) arg (markup)

Add increment to the font-size. Adjusts baseline-skip accordingly.

\markup {
  default
  \hspace #2
  \fontsize #-1.5
  smaller
}

[image of music]

Used properties:

  • baseline-skip (2)
  • word-space (1)
  • font-size (0)
\huge arg (markup)

Set font size to +2.

\markup {
  default
  \hspace #2
  \huge
  huge
}

[image of music]

\italic arg (markup)

Use italic font-shape for arg.

\markup {
  default
  \hspace #2
  \italic
  italic
}

[image of music]

\large arg (markup)

Set font size to +1.

\markup {
  default
  \hspace #2
  \large
  large
}

[image of music]

\larger arg (markup)

Increase the font size relative to the current setting.

\markup {
  default
  \hspace #2
  \larger
  larger
}

[image of music]

\magnify sz (number) arg (markup)

Set the font magnification for its argument. In the following example, the middle A is 10% larger:

A \magnify #1.1 { A } A

Note: Magnification only works if a font name is explicitly selected. Use \fontsize otherwise.

\markup {
  default
  \hspace #2
  \magnify #1.5 {
    50% larger
  }
}

[image of music]

\medium arg (markup)

Switch to medium font-series (in contrast to bold).

\markup {
  \bold {
    some bold text
    \hspace #2
    \medium {
      medium font series
    }
    \hspace #2
    bold again
  }
}

[image of music]

\normal-size-sub arg (markup)

Set arg in subscript with a normal font size.

\markup {
  default
  \normal-size-sub {
    subscript in standard size
  }
}

[image of music]

Used properties:

  • font-size (0)
\normal-size-super arg (markup)

Set arg in superscript with a normal font size.

\markup {
  default
  \normal-size-super {
    superscript in standard size
  }
}

[image of music]

Used properties:

  • font-size (0)
\normal-text arg (markup)

Set all font related properties (except the size) to get the default normal text font, no matter what font was used earlier.

\markup {
  \huge \bold \sans \caps {
    huge bold sans caps
    \hspace #2
    \normal-text {
      huge normal
    }
    \hspace #2
    as before
  }
}

[image of music]

\normalsize arg (markup)

Set font size to default.

\markup {
  \teeny {
    this is very small
    \hspace #2
    \normalsize {
      normal size
    }
    \hspace #2
    teeny again
  }
}

[image of music]

\number arg (markup)

Set font family to number, which yields the font used for digits. This font also contains some punctuation; it has no letters.

The appearance of digits in the Emmentaler font can be controlled with four OpenType features: ‘tnum’, ‘cv47’, ‘ss01’, and ‘kern’, which can be arbitrarily combined.

tnum

If off (which is the default), glyphs ‘zero’ to ‘nine’ have no left and right side bearings. If on, the glyphs all have the same advance width by making the bearings non-zero.

cv47

If on, glyphs ‘four’ and ‘seven’ have shorter vertical strokes. Default is off.

ss01

If on, glyphs ‘zero’ to ‘nine’ have a fatter design, making them more readable at small sizes. Default is off.

kern

If on (which is the default), provide pairwise kerning between (most) glyphs.

\markuplist
  \number
  \fontsize #5
  \override #'((padding . 2)
               (baseline-skip . 4)
               (box-padding . 0)
               (thickness . 0.1))
  \table #'(-1 -1 -1 -1) {
      0123456789 \box 147 \concat { \box 1 \box 4 \box 7 }
    \normal-text \normalsize "(time signatures)"
    \override #'(font-features .("cv47")) {
      0123456789 \box 147 \concat { \box 1 \box 4 \box 7 } }
    \normal-text \normalsize "(alternatives)"
    \override #'(font-features .("tnum" "cv47" "-kern")) {
      0123456789 \box 147 \concat { \box 1 \box 4 \box 7 } }
    \normal-text \normalsize "(fixed-width)"
    \override #'(font-features . ("tnum" "cv47" "ss01")) {
      0123456789 \box 147 \concat { \box 1 \box 4 \box 7 } }
    \normal-text \normalsize "(figured bass)"
    \override #'(font-features . ("cv47" "ss01")) {
      0123456789 \box 147 \concat { \box 1 \box 4 \box 7 } }
    \normal-text \normalsize "(fingering)"
  }

[image of music]

See also the markup commands \figured-bass and \finger, which set the font features accordingly.

\overtie arg (markup)

Overtie arg.

\markup \line {
  \overtie "overtied"
  \override #'((offset . 5) (thickness . 1))
  \overtie "overtied"
  \override #'((offset . 1) (thickness . 5))
  \overtie "overtied"
}

[image of music]

Used properties:

  • shorten-pair ((0 . 0))
  • height-limit (0.7)
  • direction (1)
  • offset (2)
  • thickness (1)
\replace replacements (list) arg (markup)

Used to automatically replace a string by another in the markup arg. Each pair of the alist replacements specifies what should be replaced. The key is the string to be replaced by the value markup. Note the quasiquoting syntax with a backquote in the second example.

\markup \replace #'(("2nd" . "Second"))
  "2nd time"
\markup \replace
  #`(("2nd" . ,#{ \markup \concat { 2 \super nd } #}))
  \center-column {
    \line { Play only }
    \line { the 2nd time }
  }

[image of music]

Used properties:

  • replacement-alist
\roman arg (markup)

Set font family to roman.

\markup {
  \sans \bold {
    sans serif, bold
    \hspace #2
    \roman {
      text in roman font family
    }
    \hspace #2
    return to sans
  }
}

[image of music]

\sans arg (markup)

Switch to the sans serif font family.

\markup {
  default
  \hspace #2
  \sans {
    sans serif
  }
}

[image of music]

\simple str (string)

A simple text string; \markup { foo } is equivalent with \markup { \simple #"foo" }.

Note: for creating standard text markup or defining new markup commands, the use of \simple is unnecessary.

\markup {
  \simple #"simple"
  \simple #"text"
  \simple #"strings"
}

[image of music]

\small arg (markup)

Set font size to -1.

\markup {
  default
  \hspace #2
  \small
  small
}

[image of music]

\smallCaps arg (markup)

Emit arg as small caps.

Note: \smallCaps does not support accented characters.

\markup {
  default
  \hspace #2
  \smallCaps {
    Text in small caps
  }
}

[image of music]

\smaller arg (markup)

Decrease the font size relative to the current setting.

\markup {
  \fontsize #3.5 {
    large text
    \hspace #2
    \smaller { smaller text }
    \hspace #2
    large text
  }
}

[image of music]

\sub arg (markup)

Set arg in subscript.

\markup {
  \concat {
    H
    \sub {
      2
    }
    O
  }
}

[image of music]

Used properties:

  • font-size (0)
\super arg (markup)

Set arg in superscript.

\markup {
  E =
  \concat {
    mc
    \super
    2
  }
}

[image of music]

Used properties:

  • font-size (0)
\teeny arg (markup)

Set font size to -3.

\markup {
  default
  \hspace #2
  \teeny
  teeny
}

[image of music]

\text arg (markup)

Use a text font instead of music symbol or music alphabet font.

\markup {
  \number {
    1, 2,
    \text {
      three, four,
    }
    5
  }
}

[image of music]

\tie arg (markup)

Adds a horizontal bow created with make-tie-stencil at bottom or top of arg. Looks at thickness to determine line thickness, and offset to determine y-offset. The added bow fits the extent of arg, shorten-pair may be used to modify this. direction may be set using an override or direction-modifiers or voiceOne, etc.

\markup {
  \override #'(direction . 1)
  \tie "above"
  \override #'(direction . -1)
  \tie "below"
}

[image of music]

Used properties:

  • shorten-pair ((0 . 0))
  • height-limit (0.7)
  • direction (1)
  • offset (2)
  • thickness (1)
\tiny arg (markup)

Set font size to -2.

\markup {
  default
  \hspace #2
  \tiny
  tiny
}

[image of music]

\typewriter arg (markup)

Use font-family typewriter for arg.

\markup {
  default
  \hspace #2
  \typewriter
  typewriter
}

[image of music]

\underline arg (markup)

Underline arg. Looks at thickness to determine line thickness, offset to determine line y-offset from arg and underline-skip to determine the distance of additional lines from the others. underline-shift is used to get subsequent calls correct. Overriding it makes little sense, it would end up adding the provided value to the one of offset.

\markup \justify-line {
  \underline "underlined"
  \override #'(offset . 5)
  \override #'(thickness . 1)
  \underline "underlined"
  \override #'(offset . 1)
  \override #'(thickness . 5)
  \underline "underlined"
  \override #'(offset . 5)
  \override #'(underline-skip . 4)
  \underline \underline \underline "multiple underlined"
}

[image of music]

Used properties:

  • underline-skip (2)
  • underline-shift (0)
  • offset (2)
  • thickness (1)
\undertie arg (markup)
\markup \line {
  \undertie "undertied"
  \override #'((offset . 5) (thickness . 1))
  \undertie "undertied"
  \override #'((offset . 1) (thickness . 5))
  \undertie "undertied"
}

[image of music]

Used properties:

  • shorten-pair ((0 . 0))
  • height-limit (0.7)
  • direction (1)
  • offset (2)
  • thickness (1)
\upright arg (markup)

Set font-shape to upright. This is the opposite of italic.

\markup {
  \italic {
    italic text
    \hspace #2
    \upright {
      upright text
    }
    \hspace #2
    italic again
  }
}

[image of music]

\with-string-transformer transformer (procedure) arg (markup)

Interpret the markup arg with a string transformer installed. Whenever a string is interpreted inside arg, the transformer is first called, and it is the result that is interpreted. The arguments passed to the transformer are the output definition, the property alist chain, and the string. See New markup command definition about the two first arguments.

\markup \with-string-transformer
  #(lambda (layout props str)
     (string-upcase str))
  "abc"

[image of music]


Footnotes

[1] Internally, this works by activating the ‘dlig’ OpenType feature of the Emmentaler font.


LilyPond — Notation Reference v2.23.82 (development-branch).