NCAR GRAPHICS on ATM UNIX COMPUTERS: Appendix F

By
Richard Grotjahn

with assistance from:
Erick Lorenz

September 1998 - NCAR Graphics version 3


September 2018



4. Appendix F

.

Appendix F: Software character set from PLCHHQ and PLOTCHAR. See the images below for the PLCHHQ character set complete depictions of the characters and symbols.

Duplex Characters (these do not have serifs).


Comlex Characters (these do have serifs).


former file: \wp7docs\Courses\compute\unixgks.wpd


Drawing text with the PLCHLQ routine

The Plotchar routine PLCHLQ (or PCLOQU) is a higher level NCAR Graphics routine that draws characters of "low quality" by calling the GKS character-drawing routines. This module demonstrates how to draw text with PLCHLQ and how to select fonts, character size, and text color.

PLCHLQ text

Code segment from fpcloqu.f

1   CALL GSTXCI (4)
2   CALL GSTXFP (-13, 2)
3   CALL PLCHLQ (.41, .58, 'Use', .04, 55., 0.)
4   CALL PLCHLQ (.58, .62, 'PLCHLQ', .03, -25., 0.)
5   CALL GSTXFP (-6, 2)
6   CALL PLCHLQ (.66, .47, 'to', .04, -90., 0.)
7   CALL PLCHLQ (.57, .33, 'access', .05, -145., 0.)

Synopsis

      CALL PLCHLQ (XPOS, YPOS, CHRS, SIZE, ANGD, CNTR)

Arguments

XPOS, YPOS
Real, Input---The X and Y user coordinates of the characters to be plotted.

CHRS
Character, Input---A string consisting of the characters to be plotted. The string may include any of the following 95 characters: A-Z a-z 0-9 ! " # $ % & ' ( ) * + - / \\ : ; < = > ? @ ` [ ] ^ _ { | } ~ , . blank
The function codes, like those described later in the "Drawing text with the PLCHHQ routine" module, may not be used.
The number of characters in CHRS is taken to be LEN(CHRS). Use the FORTRAN 77 substring notation CHRS(m:n) to draw only characters m through n (where m and n are integer expressions) from the CHRS character string.
SIZE
Real, Input---Defines a multiplier for character size based upon the following values of SIZE:

<=0.
The absolute value specifies the character size as a multiple of a default digitized size on a 1024x1024 grid on which blanks are 16 units wide.
0.<SIZE<1.
Specifies the desired width of a blank as a fraction of the distance across the plotter frame.
>=1.
Specifies the desired width of a blank in plotter coordinates, as defined by default or by a call to the SPPS routine SETI.

ANGD
Real, Input---The angle, in degrees counterclockwise from the positive X axis, at which the character string is plotted.

CNTR
Real, Input---Specifies the centering option based on the following values of CNTR:

-1
The point (XPOS, YPOS) is the center of the left edge of the first character.
1.
The point (XPOS, YPOS) is the center of the right edge of the last character.
0.
The point (XPOS, YPOS) is the midpoint of the line joining the center of the left edge of the first character to the center of the right edge of the last character.

Discussion

Drawing text with PLCHLQ (or PCLOQU, which has the same arguments) results in a smaller metafile than if PLCHMQ or PLCHHQ is used.

An idiosyncrasy of using PLCHLQ, PLCHMQ, and PLCHHQ is that PLCHLQ uses calls to the GKS routine GTX to draw text, whereas PLCHMQ and PLCHHQ call the GKS routines GPL and GFA. The implication is that changing text characteristics such as its color requires you to use GSTXCI for PLCHLQ and GSPLCI, and GSFACI for PLCHMQ and PLCHHQ. A better way to change character color when using PLCHHQ is to use the parameters provided for color-setting.

Line 1 of the fpcloqu.f code segment sets the color of text by specifying an index (4) in the color table that was set up previously with the GKS routine GSCR.

Line 2 chooses a font (Hershey triplex Roman) and sets the stroke precision to "best."

Line 3 plots the character string "Use" at coordinates (.41, .58) with characters that correspond to a blank size that is 4 percent of the width of the plotter frame. The string is drawn at a 55-degree angle, and (.41, .58) is the center of the string.

Line 4 plots the character string "PLCHLQ". The arguments specify a new location, size, and angle.

Line 5 changes the font to Hershey simplex script.

Lines 6 and 7 plot the strings "to" and "access".

Drawing text with the PLCHHQ routine

The Plotchar routine PLCHHQ (or PCHIQU) plots high-quality characters from font databases that contain Roman, Greek, Cyrillic, and Gothic characters; math, music, and weather symbols; and some filled fonts, to name a few. PLCHHQ also supports subscripting, superscripting, shadow, and outlined characters.

This module demonstrates how to draw text with PLCHHQ and set text characteristics such as font type, size, superscripting, subscripting, and angle.

PLCHHQ features

Code segment from fpchiqu.f

1   CALL PLCHHQ (.225, .453, '   ANGD is  45.', .012, 45., -1.)
2   CALL PLCHHQ (.875, .750, 'A:S:2:N:+B:S:2:N:', .012, 0., 0.)
3   CALL PCSETC ('FC - FUNCTION CODE CHARACTER', '/')
4   CALL PLCHHQ (.990, .410, '/F13/A line with characters from several f
5  +onts:  /F8/P/BF13/0/N/=/F5/g/SF13/2/N/+/F5/j/SF13/2/N/',
6  +.012, 0., 1.)

Synopsis

      CALL PLCHHQ (XPOS, YPOS, CHRS, SIZE, ANGD, CNTR)

Arguments

XPOS, YPOS
Real, Input---The X and Y world coordinates of the characters to be plotted.

CHRS
Character, Input---A string consisting of the characters to be plotted. CHRS may contain embedded function codes that are used to reset parameters affecting the selection of characters from the database and the way in which those characters are plotted.
The characters in CHRS are scanned from left to right and plotted. However, if a function-code signal character (a colon by default; it is defined by the parameter FC) is encountered, the following characters are interpreted as function codes until the next function-code signal character appears in CHRS. Thus if CHRS is the string 'ABC:L:DEF', then "A", "B", and "C" are treated as characters to be plotted, "L" is treated as a function code, and "D", "E", and "F" are treated as characters to be plotted. In this example, the function code "L" requests lowercase. Therefore, the string "ABCdef" would be drawn.
The function codes can take on the following values:

F, F0, Fn
Where n is a font number, selects the character database. By default, the database used is the one specified by the parameter FN. The default for FN is 0; this selects the PWRITX database. F0 returns to the PWRITX database, and F returns to the database specified by the text parameter FN.
R
Selects the Roman font when using the PWRITX database.
G
Selects the Greek font when using the PWRITX database.
P
Selects characters of principal size when using the PWRITX database.
I
Selects characters of indexical size when using the PWRITX database.
K
Selects characters of cartographic size when using the PWRITX database.
U
Selects uppercase characters when using the PWRITX database.
L
Selects lowercase characters. This affects characters from both the PWRITX and fontcap databases.
A
Draws characters across the frame.
D
Draws characters down the frame.
B
Selects a subscript level.
S
Selects a superscript level.
E
Ends subscripting or superscripting.
N
Causes a return to normal level.
Hn or HnQ
Where n is an integer, moves horizontally n digitized units or n blank widths if using HnQ.
Vn or VnQ
Where n is an integer, causes a vertical move in the same manner as Hn and HnQ.
C
Causes a return to the initial position offset by one blank height. For example, the string 'ABC:C:DEF' causes the characters "DEF" to be written directly below the characters "ABC".
Xn
Where n is an integer, causes character width to zoom to n percent of normal.

Yn
Where n is an integer, causes characters to be made n/100 times as high.

Zn
Where n is an integer, causes characters to be made n/100 times as wide and high.

CHRS
A complete description of the function codes, their meanings, and their options appears in the NCAR Graphics Programmer Document Plotchar, a Character-Plotting Package.

SIZE
Real, Input---Defines a multiplier for character size based on the following values of SIZE:

<=0.
The absolute value specifies the size as a multiple of a default digitized size on a 1024x1024 grid; blanks on this grid are 16 units wide.
0.<SIZE<1.
Specifies the desired width of a blank as a fraction of the distance across the plotter frame.
>=1
Specifies the desired width of a blank in plotter coordinates, as defined by the default or by a call to the SPPS routine SETI.

ANGD
Real, Input---The angle, in degrees counterclockwise from the positive X axis, at which the character string is plotted. The text extent or distance (in the fractional system) from the point (XPOS, YPOS) to the left, right, top, and bottom edge of a box enclosing the string can be computed by setting ANGD to 360. and the parameter TE to a nonzero value. In this case, PLCHHQ does not draw any characters; instead it stores the text extent information in the parameters DL, DR, DT, and DB. This provides a way to access this information without drawing the string.

CNTR
Real, Input---Specifies the centering option based on the following values of CNTR:

-1
The point (XPOS, YPOS) is the center of the left edge of the first character.
1.
The point (XPOS, YPOS) is the center of the right edge of the last character.
0.
The point (XPOS, YPOS) is the midpoint of the line joining the center of the left edge of the first character to the center of the right edge of the last character.
s
Where s is any real number, the point (XPOS, YPOS) is obtained by linear interpolation along the line joining the points associated with CNTR values of -1 and +1.

Discussion

PLCHHQ (or PCHIQU, which has the same arguments) accesses a wider variety of fonts and controls a larger range of text characteristics than PLCHLQ or PLCHMQ. A disadvantage of using PLCHHQ, however, is that the resulting metafile tends to be larger.

Line 1 of the fpchiqu.f code segment uses the default font (principal Roman) and character database (PWRITX) to draw the text "ANGD is 45.". The text is drawn at a 45-degree angle because of the ANGD argument.

Line 2 uses function codes to draw the equation "A2+B2". The "A" is written with the default font. The ":S:" turns on one level of superscripting. The "2" is written as a superscript. ":N:" returns to the normal level. "+ B" is drawn normally. ":S:" turns on superscripting again. "2" is written as a superscript. Finally, ":N:" returns to the normal level.

Line 3 switches the function code character from a colon to a slash. Line 4 draws a text string that includes several fonts, subscripting, and superscripting.

The "/F13/" in the CHRS argument selects font 13 from the fontcap database. The characters "A line with ... fonts" is drawn in font 13. The "/F8/" selects font 8. The "P" draws the P from font 8, which is the pi symbol. "/BF13/0" turns on subscripting using font 13 and draws the character zero. The "/N/=" returns drawing to the normal level and draws an equal sign. "/F5/g" selects font 5 and draws the gamma character. The "/SF13/2" turns on superscripting, selects font 13 and then draws "2" as a superscript. The "/N/+" returns drawing to a normal level and draws the plus sign. "/F5/j" selects font 5 and draws a "j." The "/SF13/2" turns on superscripting, selects font 13 and draws a superscripted 2. Finally, the "/N/" returns drawing to the normal level.