Font Block
The font
block can be used to adjust the font typeface, size, colour, and style of the text of another block. The structure of this block is summarised below.
Note
If font
is used in an experiment
block, the specified font settings are inherited by every following trial. If font
is used in an include
block of an include file, the specified font settings are inherited by every following trial within that include file only. Alternatively, font
can be used within a trial
block to only apply within the scope of the trial. Only the specified style aspects will be overwritten, other style aspects will be inherited.
Parameters
- face
-
Optional, defaults to
"Verdana, Helvetica, Arial, sans-serif"
.
String that specifies the typeface of the text used in the stimulus and textfield, if any. You can specify fallback fonts by separating the typefaces with a comma.Warning
Keep in mind that the font-face needs to be available on the participant's computer for correct display. Available fonts differ per operator system and we advice you to use common fonts only. However, if you control the computer used to access the experiment, you may install custom font-face on that computer and specify them in this parameter.
- size
- Optional, defaults to 14.
Integer that specifies the size of the text in points. - style
-
Optional, defaults to empty list.
Keyword or List of Keywords that specifies the style of the text. Available Keywords areBOLD
andITALIC
.Example of a single style:
style = BOLD
Example of two styles combined:style = [BOLD, ITALIC]
- color
-
Optional, defaults to
"black"
.
String from a list of options that specifies the colour of the text. Alternatively, a HEX RGB string such as '#FFFFFF' can be used from a look-up tool such as Google.A non-exhaustive list of options is
"black"
,"dark gray"
,"blue"
,"teal"
,"white"
,"cyan"
,"gray"
,"light gray"
,"red"
,"green"
,"olive"
,"purple"
,"magenta"
,"pink"
,"maroon"
,"dark red"
,"yellow"
,"orange"
, and"navy"
Example usage
experiment {
trial {
font {
face = "Arial"
size = 20
color = "red"
style = BOLDs
}
stimulus {
text = "This text is big, red and bold!"
}
response {
button
}
}
trial {
stimulus {
text = "This text is styled regularly."
}
response {
button
}
}
}
experiment {
font {
face = "Arial"
size = 20
color = "red"
style = BOLD
}
// For all trials that follow, the above block specifies the default font.
trial {
stimulus {
text = "This text is big, red and bold!"
}
response {
button
}
}
trial {
// This font block only overrides the color parameter, and only for this trial
font {
color = "blue"
}
stimulus {
text = "This text is still big and bold, but now it is blue."
}
response {
button
}
}
}