How to specifying font,angle,justify within a text file

How do I specify the “font, angle, justify” values within the body of a text file or a multi-line text file that I want to plot using gmt text?

Note that I want to specify these parameters within the text file, not as parameters to the gmt text command.

The Modules>>text page specifies that records in a text file should be of the following format:
x, y[, font, angle, justify], text

Or using the -M (paragraph mode), the start of each text segment should be in this form:
> x y [font angle justify] linespace parwidth parjust

If I create a text file containing records like this:
176, -38, Some text here

Or a multi-line text file with records like this:
> 176 -38 0.32 1.7 c
More than
one line
of text.

I am able to plot these using the gmt text command and specifying the font, etc as a parameter.

However if I try to use multi-line text records something like this:
> 176 -38 7p,Helvetica,black 0 LT 0.32 1.7 c
More than
one line
of text.
I get an error along the lines of 7p,Helvetica,black not a valid number.

Is someone able to give an example of how these text files should be formatted to include all the font specifications?

I have done a little more investigation and will now just focus on single line text for simplicity (ie not using -M multiline option).

If I use classic mode and use gmt pstext with a text file as defined in GMT version 4 (v4) where each line of the file is in the format:
x y size angle fontno justify text
eg The following two lines plot as expected with correct size font and justification:

50 4 9 0 0 TL This is Text.
50 1 07 -0.0 -Helvetica 1 This is Text 1.

If I use modern mode and use gmt pstext or gmt text with a text file as defined in GMT version 6 (v6) where each line of the file is in the format:
x, y[, font, angle, justify], text
If I do not specify the optional font, angle, justify then this plots as expected. However, if I do attempt to include these three parameters, then no matter what values I try using they are simply plotted as part of the text string and do not affect the formatting.

It doesn’t appear to make any difference whether the values are delimited with commas or spaces (either of these work as intended in classic mode or when only specifying x, y, text.
I have tried each of the following example lines using independent files and they all treat everything after the x, y coordinates as text:
50 3 '7p,Helvetica,black' 0 TL This is Text.
50 3 Helvetica 0 TL This is Text.
50 3 0 0 TL This is Text.

I have managed to reslove this. And I think also identified a slight error in the documentation.

In order to include and use the optional [font, angle, justify] as values in the text file it is essential to specify -F+f+a+j as a parameter to the gmt text command. If +f +a or +j are not each immediately followed by a value then this parameter is sourced from the text file. If -F is not included or if +f+a+j are all specified with values then everything in the text file after the x and y values are treated as the text string.

I believe the documentation on the gmt text page is in error as follows:
Under “Required Arguments => textfiles” I think that this sentence:

This is one or more files containing 1 or more records with (x, y[, font, angle, justify], text).

should read:

This is one or more files containing 1 or more records with (x y[ font, angle, justify] text).

Note that there must be no comma after ‘x’ or ‘y’ or before ‘text’. The commas between ‘font, angle, justify’ seem to be optional.
The definition of ‘font’ must be in the form [size,][font,][color].
Note that these must be comma delimited with no spaces.

I may not have the ‘rules’ for this entirely correct but it is what I found that did and did not work for me. I hope this is useful.

As an example, this is the script that I used to test this successfully:

#! /usr/bin/env bash
gmt begin test_plot pdf
    gmt basemap -R10/70/-3/8 -JX15c/10c -B -B+glightgreen+t"Test Plot"
    gmt text -F+f+a+j <<EOF
50 3 7p,Times-Bold,black 45 LT This is Text.
EOF
gmt end

Thanks for your comment. In general, the documentation may list inputs like x, y, z, …, text etc but those commas were never intended to be taken literally. Yet, CSV input is accepted so in a way it is OK, but text is a special module that has a long history which makes it difficult at times to be strict.
I have removed the commas from the documentation as indicated for this module only.

Thanks for your reply, that makes sense.

The aspect that really had me stuck originally was that the -F+f+a+j argument was required for the optional [font, angle, justify] values to be recognised correctly in my textfile.

When reading the format description of the textfile for the gmt text command this is not immediately apparent. I feel that adding a comment to this effect in the textfile description would be very useful.

I have made it clearer that -F plays an important role in controlling what must be present or absent from the data record.