text

 element objects

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

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
report
info

text
fileName

Default: no text

Set one of:

text is a string that is text to show.

OR

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).

You can include the following anywhere in the text for line breaks and formatting changes.

<cd><n>           <cd> – new line (also see below)
<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>.

For new line you can use an array of strings with each cell containing a line (property text only), <cd><n><cd> above, character code <cd>10<cd>, or property wrapWidth to wrap lines automatically.

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 size by setting line height which the font scales to (deg). This is equivalent to setting height of the "em box" for the font. Typically upper case characters are somewhat 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 text 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

Default: boxSize = no text box
Default: margin = 0.5 deg
Default: boxColor = 90% white

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 text box color.

vertAlignment

Default: center text vertically

A string <cds>"t"<cds> = top or <cds>"c"<cds> = center to vertically align text in text 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