xxxfont font_name [style/weight] [encoding] [size] [arguments]

Scope Available in
immediate abcm2ps

xxx is the music element type.


  Music element Default value
annotationfont annotation sans-serif 12
capofont capo sans-serif 12
composerfont composer field in tune header serifItalic 14
cstabfont chord symbol in tablature gchordfont with size / 1.6
footerfont page footer serif 16
gchordfont chord symbol sans-serif 12
gridfont grid serif 16
headerfont page header serif 16
historyfont history and other tune relative information serif 16
infofont info line (R: and A:) in tune header serifItalic 14
measurefont measure number serifItalic 10
partsfont parts (P:) serif 15
repeatfont repeat sequence number/text serif 13
setfont-n ancillary fonts (none) 12
subtitlefont subtitle serif 16
tempofont tempo (Q:) serifBold 15
textfont text serif 16
titlefont tune title serif 20
tupletfont text serifItalic 12
vocalfont lyrics under staff serifBold 13
voicefont voice name serifBold 13
wordsfont lyrics under tune serif 16

With abc2svg, the font 'text' is added before the default font. This permits a global font change. See below.
With abcm2ps, 'serif' is 'Times' and 'sans-serif' is 'Helvetica'.
The fonts capofont and gridfont do not exist in abcm2ps.

Font name

With abc2svg, the font name may be:

With abcm2ps, the font name may be:


The style and weight are optional and are used by abc2svg only.
When one of style or weight is present, the previous weight or style is not changed.
A common style is italic and a common weight is bold. The special word normal removes both style and weight.
The style and/or weight usually appear after the font name, separated by a hyphen or a space, or directly stuck.


The encoding is optional and used by abcm2ps only.
See types.xhtml for more information.


The size is optional.
When absent or defined by star ('*'), the size remains the same.
It is expressed in pixels.


The arguments are not available with abcm2ps.
box or nobox
Draw or not a box around the text
Set a class for CSS definitions
padding=number of pixels
Set more spacing around the texts.
When absent with a box, the default value is '1.5'
Define the length adjustment type:
don't adjust
adjust with spacing
adjust with spacing and glyphs
This argument is not used when abc2svg is run inside a web browser (that's why this document is statically generated).

Global change of the font name

With abc2svg, the default font name starts with the font 'text'. This font does not exist, but may be created by a @font-face.

Here is how all the texts may be displayed using an installed font 'MuseJazzText':

@font-face {
  font-family: text;
  src: local(MuseJazzText)


musicfont url(../js/abc2svg.ttf)
%%pagewidth 13cm
%%bgcolor white
%%leftmargin 20
%%rightmargin 20
%%titlefont sans-serif * box
%%historyfont sans-serifItalic 12
%%writefields HN 1
.green {color:green;fill:green}
.bbb {outline: 5px solid black;
    outline-offset: 5px;
    outline-color: blue}
%%setfont-1 sans-serifBold 12 class=green
%%setfont-2 music 24

T:Tune title in a box
H:Version 1.20.15: 'padding=' added
H:Version 1.18.3: 'wadj=' added
N:"$1wadj=$0" is usefull when the font
+:is replaced by an other one by the browser
N:Also, below, the computation of the length
+:with the font "$1monospace$0" is wrong
%%annotationfont * 16
"^bigger font"cc |\
%%gchordfont * 26
"G"GA"@-20,0$2\ue56d"[FB]2 | [Ec]4|]
%%vskip 1cm

%%textfont monospace * box
%%text text without length adjustment

%%textfont * * wadj=space
%%text text adjusted by spacing

%%textfont * * wadj=glyph
%%text text adjusted by spacing and glyph

%%textfont * * class=bbb padding=10
%%text text inside a big blue box

%%textfont bold
%%text bold text
%%textfont normal
%%text normal text
Tune title in a box  annotation bigger font G Notes: "wadj=" is usefull when the font is replaced by an other one by the browser Also, below, the computation of the length with the font "monospace" is wrong History: Version 1.20.15: 'padding=' added Version 1.18.3: 'wadj=' added
text without length adjustment text adjusted by spacing text adjusted by spacing and glyph text inside a big blue box bold text normal text
    font-family: ft1;
    src: url(../js/Bravura.woff2)
    font-family: ft2;
    src: url(../js/Petaluma.woff2)

T:with Bravura
%%musicfont ft1

T:with Petaluma
%%musicfont ft2

with Bravura 
with Petaluma 

abc2svg documentation source author - page hosted by Free