text

 element objects

Text from a variable or text file. Also optionally a box behind it.

Generally this text cannot change while it is showing. However, it is dynamic enough to be able to show values it can obtain at experiment startup, e.g. trial number for the trial it will run in (useful if you want to show trial number during the experiment).

Psychtoolbox text renderer

By default Psychtoolbox uses its own text renderer plugin. If this fails, it falls back to a more basic text renderer in your operating system and reports so in its messages at experiment startup. In this case you may see problems with text quality, alignment, or boundaries. See Psychtoolbox Screen('DrawText') for general information on text renderers, and DrawTextPlugin help for troubleshooting.

▸ Object ends on its own?

"Ends on its own" means ends automatically at that point. If an element can end on its own, you don't need to set end conditions for it in property end (unless you want it to maybe end earlier).

No—runs until any condition you set in property end.

Input properties
Record properties
text
elements (see below)

text
fileName
wrapWidth
fontName
fontSize
style
color
alignment
lineSpacing
boxSize
margin
boxColor
vertAlignment

All visual elements
position
depth

nn_eyes
rotation
flipHorz
flipVert

colorMask
alpha
intensity
contrastMult
convolution
shader
filterOrder
filterGrayscale
filterResolutionMult
filterGamma

channelResolution
backColor
addDisplay

All visual elements
position

All adjuster elements have
adjust

All elements
start
end

startBuffer
endBuffer

vary
staircase

All objects
info
report

text
fileName

Default: no text

Set one of text OR fileName:

text is a string that is text to show. Or for multiple lines you can use an array of strings. You can also use <cds><n><cds> or character code <cd>10<cd> in the text (see also property wrapWidth below). For convenience you can also use just a number or row vector to show that as text.

fileName is a string that is name of text file to show. Include path if the file is not in the MATLAB current folder or search path (or not the first file with that name on the search path).

Either way you can include the following anywhere in the text for line breaks and formatting changes:

<cd><b>           <cd> – bold
<cd><i>           <cd> – italic
<cd><u>           <cd> – underline (only on some systems and text renderers)
<cd><r>           <cd> – regular (end bold/italic/underline)
<cd><font = name> <cd> – font name, e.g. <cd><font = Arial><cd>
<cd><size = n>    <cd> – font size, e.g. <cd><size = 0.8><cd>. Units are whatever you use for property fontSize below (default deg).
<cd><color = RGB> <cd> – color. RGB = a 1×3 RGB vector with numbers between 0–1, e.g. <cd><color = [1 0 0]><cd>.

You can also include <cd><pb:trial.n><cd> to tell it to show trial number for the trial the text will run in—useful if you want to show trial number during the experiment.

wrapWidth

Default: don't wrap lines

Number of characters to wrap lines at. <cd>inf<cd> = don't wrap, but you can still use an array of strings, <cd><n><cd>, or <cd>char(10)<cd> to wrap lines manually.

fontName

Default: Arial

A string setting font. See Psychtoolbox Screen('TextFont') for more information on font names.

fontSize

Default: 1 deg

This sets font height (deg). Specifically it sets height of the "em box" for the font. Typically upper case characters are a little smaller than this. If you need more information, see Wikipedia https://en.wikipedia.org/wiki/Point_(typography) for a starting point.

style

Default: regular

A string <cds>"r"<cds> = regular, <cds>"b"<cds> = bold, <cds>"i"<cds> = italic, or <cds>"u"<cds> = underline.

color

Default: white

A 1×3 RGB vector with numbers between 0–1 setting font color.

alignment

Default: center text horizontally

A string <cds>"l"<cds> = left or <cds>"c"<cds> = center to horizontally align lines.

lineSpacing

Default: 1.3-spaced

A number: 1 = single-spaced, 2 = double, 1.5 = 1 & 1/2, etc. This multiplies line height without affecting font size (set in fontSize above). 1 = each line's baseline is precisely fontSize distance from the next line's baseline.

boxSize
margin
boxColor
vertAlignment

Default: boxSize = no text box
Default: margin = 0.5 deg
Default: boxColor = 90% white
Default: vertAlignment = center text vertically in box

boxSize sets text box size. This is a number for a square, or a vector [width height] for a rectangle (deg). Or a string <cds>"f"<cds> = fit box to text. 0 = no box.

margin sets space between the box and text edges (deg). This applies if you align text left or top, or fit the box to the text.

boxColor is a 1×3 RGB vector with numbers between 0–1 setting box color.

vertAlignment is a string <cds>"t"<cds> = top or <cds>"c"<cds> = center to vertically align text in the box.

Adjustable properties

You can vary or allow the subject to adjust the following properties of an object of this type when it's running. If you need to make other properties adjustable, you can edit the element type code—see Element Type Programming Manual.

Adjustable properties

Adjustable properties

position
nn_eyes
rotation
colorMask
alpha
intensity
contrastMult
drawCodeVars

(None)

(None)

Input properties
Record properties

PsychBench uses record properties to record information during experiments. You can't set record properties but you can see them in experiment results using input property report.

text
elements (see below)

All elements
startTime
endTime
duration
n_startFrame
n_endFrame
startLatencyBufferable
endLatencyBufferable