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

Scope Available in
immediate abcm2ps
abc2svg

xxx is the music element type.

Commands

  Music element Default value
annotationfont annotation sans-serif 12
capofont capo sans-serif 12
composerfont composer field in tune header serifItalic 14
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
Note1: with abc2svg, the font 'text' is added before the default font. This permits a global font change. See below.
Note2: with abcm2ps, 'serif' is 'Times' and 'sans-serif' is 'Helvetica'.

Font name

With abc2svg, the font name may be:

With abcm2ps, the font name may be:

style/weight

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.

encoding

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

size

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

Arguments

The arguments are not available with abcm2ps.
box or nobox
Draw or not a box around the text
class=class_name
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'
wadj=type
Define the length adjustment type:
none
don't adjust
space
adjust with spacing
glyph
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 the installed font 'MuseJazzText':

%%beginml <style> @font-face {  font-family: text;  src: local(MuseJazzText) } </style> %%endml

Example

%abc-2.2
%%pagewidth 14cm
%%bgcolor white
%%leftmargin 10
%%titlefont * * box
%%historyfont sans-serifItalic 12
%%writefields HN 1
%%beginsvg
<style>
.green {color:green;fill:green}
.bbb {outline: 5px solid black;
    outline-offset: 5px;
    outline-color: blue}
</style>
%%endsvg
%%setfont-1 sans-serifBold 12 class=green
%%setfont-2 music 24

X:1
T:Tune title in a box
M:C
L:1/4
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
K:C
"^annotation"cc\
%%annotationfont * 16
"^bigger font"cc |\
%%gchordfont * 26
"G"GA"@-20,3$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

abc2svg documentation source author - page hosted by Free