Changing to another font from ASCII font
How can I use the character font AS and also characters from a symbol font together? Can I change to another font within a label once I'm in ASCII font?
The ASCII font is useful to let special characters like the underscore appear in the label and prevent their use by PPLUS as special formatting characters (@ to change fonts, ^ for superscripts, _ for subscripts and so on). In this example we will use the ASCII font so we can include the underscore character as part of the label. But then, if we want to use a special character in its PPLUS sense, for instance the@ character to change to another color or font, it is not recognized as the special character that changes fonts. Here we want to use character 09 from the map font CA. If we try:
yes? label/nouser 3 2 0 0 0.15 "@AStemp_01@CA09(Centigrade_scale)"
The command produces a label that reads:
In PyFerret the SET TEXT command makes settings for the text in labels on the plot page. This includes a choice of font, chosen from those available to the Python packages. In Python library fonts, special characters are embedded in text using an html-style coding. The label discussed below is drawn as follows:
> pyferret yes? SET TEXT/FONT=arial yes? plot myvar yes?label/nouser 3 2 0 0 0.15 "temp_01 <°>(Centigrade_scale)"/i=1:15 i
In PyFerret, the font may be set as /SET TEXT/FONT=HERSHEY. With this setting, all of the classic-Ferret controls for fonts is in effect and the syntax below is valid.
When we are in ASCII font, the ESCAPE character allows the character immediately following it to be recognized as a special character to PPLUS. Placing ESCAPE it in front of the @CA lets us access the map font, and a second ESCAPE character in front of another @AS changes back to ASCII font so we can use an underscore in Centigrade_scale.
yes? ! Here the ESCAPE character appears as a square. yes? label/nouser 3 2 0 0 0.15 "@AStemp_01@CA09@AS(Centigrade_scale)"
The ESCAPE character is decimal character 27, and may be entered into a script with some text editors. A trick to have easy access to the ESCAPE character is to keep it in a file. (See below the figure to get the file). Then in a Ferret session or script, read the character into a string variable, and use the Ferret STRCAT function to put it into the label string.
yes? go ptest ! just an example plot to put a user-defined label on yes? ! Define a character variable containing the ESCAPE character yes? columns/type=text/var=escchar escapeit.dat yes? ! Use STRCAT to put the character into a label yes? let mylab1 = strcat ("@AStemp_01", escchar) yes? let mylab2 = strcat (mylab1, "@CA09") yes? let mylab3 = strcat (mylab2, escchar) yes? let mylabel = strcat (mylab3, "@AS(Centigrade_scale)") yes? label/nouser 4 5 0 0 0.15 `mylabel`
For convenience, the escape character is in a file escapeit.dat, in the tar file escape_character.tar, which you may download here.escape_character.tar