!=====================================================================
! NGPC: Plotchar, A Character-Plotting Package
!=====================================================================
!
! NGPC, an NCAR Graphics package called PLOTCHAR, which includes
! routines allowing a user to draw characters of high, medium, or low
! quality.
!
! The high-quality routine provides many features, among which are the
! following: Many fonts are available, including some filled fonts.
! The aspect ratio of the characters can be changed at will.
! Characters can be written in any desired size. Characters can be
! written across the frame or down the frame. Subscripting and
! superscripting can be done easily. Character strings can be centered
! in various ways relative to a given point in the user coordinate
! system. Text-extent quantities can be retrieved to find out how much
! space a character string will occupy when it is finally written.
! Characters can be drawn with shadows and outlines; colors can be
! specified by the user for all parts of the characters, including the
! shadows and outlines. Each character string written can be enclosed
! in a box, which may itself have a shadow and/or an outline; colors
! can be specified for the parts of the box.
!
! ~~~~~~~~~~~~~~~~~~~~~~~~~~~
! set/Get internal parameters
! ~~~~~~~~~~~~~~~~~~~~~~~~~~~
!
! NG_PCRSET  Reset all parameters to its default values
!
! NG_PCSETC  set the value of a CHARACTER internal parameter
! NG_PCSETI  set the value of an INTEGER internal parameter
! NG_PCSETR  set the value of a REAL internal parameter
!
! NG_PCGETC  Get the value of a CHARACTER internal parameter
! NG_PCGETI  Get the value of an INTEGER internal parameter
! NG_PCGETR  Get the value of a REAL internal parameter
!
! NG_PCPNWI  Obtain the name of a specified element of an internal parameter array
!
! *** not support yet ***
! NG_PCDLSC  Define a set of colors used in drawing some characters
!
! ~~~~~~~~~~~~~~~~~~~~~~~~~~
! Character Drawing Routines
! ~~~~~~~~~~~~~~~~~~~~~~~~~~
!
! NG_PCHIQU  Draw high-quality characters, new name
! NG_PLCHHQ  Draw high-quality characters, original name
! NG_PLCHHZ  Draw high-quality characters, adding an argument SLEN
!
! NG_PCMEQU  Draw medium-quality characters, new name
! NG_PLCHMQ  Draw medium-quality characters, original name
!
! NG_PCLOQU  Draw low-quality characters, new name
! NG_PLCHLQ  Draw low-quality characters, original name
!
! Notes:
!
!  1. Routine NG_PLCHHZ is just like NG_PLCHHQ (which it eventually
!     calls), but it has an additional argument SLEN which is the
!     desired length, in the fractional coordinate system, of the
!     character string written.  If the length of the string without
!     zooming is between 4/5ths and 5/4ths of the desired length,
!     the capability of zooming in the X direction is used to make
!     the string have exactly the desired length.  This can be used
!     to generate paragraphs that are justified on both left and right.
!
!  2. PLCHLQ draws characters of "low quality" by calling the GKS
!     character-drawing routines. No function codes may be used.
!
!  3. PLCHMQ draws characters of "medium quality". It does this by
!     drawing lines, just as PLCHHQ does, but it does not produce
!     quite such fancy characters. No function codes may be used.
!
!---------------------------------------
!
! Note: CNCARG add three "optional" dummy arguments, PANG, PLAT, and
! PLON to the following PLOTCHAR routines. (2013-11-27)
!
!   NG_PCHIQU( XPOS, YPOS,       CHRS, SIZE, ANGD, CNTR, PANG, PLAT, PLON )
!   NG_PCMEQU( XPOS, YPOS,       CHRS, SIZE, ANGD, CNTR, PANG, PLAT, PLON )
!
!   NG_PLCHHQ( XPOS, YPOS,       CHRS, SIZE, ANGD, CNTR, PANG, PLAT, PLON )
!   NG_PLCHMQ( XPOS, YPOS,       CHRS, SIZE, ANGD, CNTR, PANG, PLAT, PLON )
!
!   NG_PLCHHZ( XPOS, YPOS, SLEN, CHRS, SIZE, ANGD, CNTR, PANG, PLAT, PLON )
!
! *** used while CALL NG_PCSETI( 'MA - The mapping flag', 4 ) ***
!
! When 'MA' = 4, in all user calls to PLCHHQ and PLCHMQ the values
! of the arguments XPOS, YPOS, and ANGD should be zero.  The argument
! SIZE specifies the desired character width, as always, but it is
! interpreted as an angle, in degrees.  The characters of the string
! are initially thought of as being written along the equator of the
! globe and are positioned relative to the point with latitude 0 and
! longitude 0 as determined by the value of the argument CNTR.  The
! arguments PANG, PLAT, and PLON, should be PRESENT, and must have been
! set by the user to determine how the string is to be transformed on
! the surface of the globe.  Three rotations and a call to the EZMAP
! routine MAPTRA are used: the net effect is to move the string to the
! position (PLAT,PLON) in such a way that a vector in the writing
! direction of the string makes an angle of PANG with the local east
! vector.  The reason for doing all this is that it produces little
! distortion in the character string, as viewed on the surface of the
! globe.
!
!-------------------
!
! Note: CNCARG add "optional" dummy argument "NDC" to the following
! PLOTCHAR routines. (2017-12-29)
!
!   SUBROUTINE NG_PCHIQU( XPOS, YPOS,       CHRS, SIZE, ANGD, CNTR, NDC, PANG, PLAT, PLON )
!   SUBROUTINE NG_PLCHHQ( XPOS, YPOS,       CHRS, SIZE, ANGD, CNTR, NDC, PANG, PLAT, PLON )
!
!   SUBROUTINE NG_PCMEQU( XPOS, YPOS,       CHRS, SIZE, ANGD, CNTR, NDC, PANG, PLAT, PLON )
!   SUBROUTINE NG_PLCHMQ( XPOS, YPOS,       CHRS, SIZE, ANGD, CNTR, NDC, PANG, PLAT, PLON )
!
!   SUBROUTINE NG_PCLOQU( XPOS, YPOS,       CHRS, SIZE, ANGD, CNTR, NDC )
!   SUBROUTINE NG_PLCHLQ( XPOS, YPOS,       CHRS, SIZE, ANGD, CNTR, NDC )
!
!   SUBROUTINE NG_PLCHHZ( XPOS, YPOS, SLEN, CHRS, SIZE, ANGD, CNTR, NDC, PANG, PLAT, PLON )
!
! NDC - Flag (LOGICAL) to determine the type of coordinates (XPOS, XPOS), if the
!       internal parameter 'MA' has the value 0.
!
!       =.TRUE. , XPOS and YPOS are fractional/normalized device coordinates
!
!       =.FALSE., XPOS and YPOS are world/user coordinates
!
!       Default is .FALSE. (i.e., user coordinates), if argument not present
!
! While internal parameter 'MA' has non-zero value, this argument will be ignored
!
!---------------------------------------------------------------------
!
! SUBROUTINE NG_PLCHHI(xp, yp, string, ht, dg, txjust, ndc, xb, yb)
!
! An extension version of NG PlotChar "NG_PLCHHQ" routine:
!
!    NG_PLCHHQ(xp, yp, string, ht, dg, cntr)
!
! Replacing "centering" option (argument "cntr" in NG_PLCHHQ)
! by "justification" option (argument "txjust" in NG_PLCHHI), and,
! adding three optional arguments "ndc", "xb" and "yb".
!
! This routine can only be used for "internal parameter 'MA' has the value 0"
!
!   REAL,         INTENT(IN   )           :: xp, yp
!   CHARACTER(*), INTENT(IN   )           :: string
!   REAL,         INTENT(IN   )           :: ht
!   REAL,         INTENT(IN   )           :: dg
!   CHARACTER(*), INTENT(IN   )           :: txjust
!   LOGICAL,      INTENT(IN   ), OPTIONAL :: ndc
!   REAL,         INTENT(  OUT), OPTIONAL :: xb(5), yb(5)
!
! Variables:
!
! xp, yp - X and Y coordinates of the text string
!
! string - text string to be drawn
!
! ht     - character size (measured in fractional coordinate system)
!
! dg     - the angle, in degrees counterclockwise from the positive X axis,
!          at which the character string is to be written
!
! txjust - one of following nine justification values:
!
!             'TopLeft'      'TopCenter'      'TopRight'
!
!          'CenterLeft'   'CenterCenter'   'CenterRight'
!
!          'BottomLeft'   'BottomCenter'   'BottomRight'
!
!          Note: if none of above, default is 'CenterCenter'
!
!
! ndc    - flag to determine the type of coordinates (xp, yp)
!
!          =.TRUE. , xp and yp are fractional/normalized device coordinates (ndc)
!
!          =.FALSE., xp and yp are world/user coordinates
!
!          Default is .FALSE. (i.e., user coordinates), if argument not present
!
! xb, yb - X and Y coordinates (measured in fractional coordinates) of
!          bounding box of the character string
!
!            2----------------3
!            |                |
!            |                |
!          5,1----------------4  numbered before rotation "dg" applied
!
!---------------------------------------------------------------------
!
! SUBROUTINE NG_PLCHGB( xp, yp, string, ht, dg, txjust, NDC, sl, xb, yb,&
!                       GB_Encoding,&
!                       GB_Font    ,&
!                       GB_Quality ,&
!                       GB_DotLWSC ,&
!                       GB_Debug   )
!
! Routine to draw Chinese (GB2312) and/or English (ASCII) characters string
!
!   REAL,         INTENT(IN   )           :: xp, yp
!   CHARACTER(*), INTENT(IN   )           :: string
!   REAL,         INTENT(IN   )           :: ht, dg
!   CHARACTER(*), INTENT(IN   )           :: txjust
!   LOGICAL,      INTENT(IN   ), OPTIONAL :: NDC
!   REAL,         INTENT(  OUT), OPTIONAL :: sl, xb(5), yb(5)
!   CHARACTER(*), INTENT(IN   ), OPTIONAL :: GB_Encoding
!   CHARACTER(*), INTENT(IN   ), OPTIONAL :: GB_Font
!   INTEGER,      INTENT(IN   ), OPTIONAL :: GB_Quality
!   REAL,         INTENT(IN   ), OPTIONAL :: GB_DotLWSC
!   LOGICAL,      INTENT(IN   ), OPTIONAL :: GB_Debug
!
! Variables:
!
!   xp, yp - X and Y coordinates of the text string
!
!   string - text string to be drawn
!
!   ht     - character size (measured in fractional coordinate system)
!
!   dg     - the angle, in degrees counterclockwise from the positive X axis,
!            at which the character string is to be written
!
!            Note: if "dg" is exactly 360.0, then no characters are
!            drawn; it just computes the drawing length in NDC and
!            returned through argument "sl" (if present).
!
!   txjust - one of following nine justification values:
!
!               'TopLeft'      'TopCenter'      'TopRight'
!
!            'CenterLeft'   'CenterCenter'   'CenterRight'
!
!            'BottomLeft'   'BottomCenter'   'BottomRight'
!
!            Note: if none of above, default is 'CenterCenter'
!
!
!   NDC    - flag to determine the type of coordinates (xp, yp)
!
!            =.TRUE. , xp and yp are fractional/normalized device coordinates (NDC)
!
!            =.FALSE., xp and yp are world/user coordinates
!
!            Default is .FALSE. (i.e., user coordinates), if argument not present
!
!   sl     - the drawing length of text string in NDC
!
!   xb, yb - X and Y coordinates (measured in fractional coordinates) of
!            bounding box of the character string
!
!              2----------------3
!              |                |
!              |                |
!            5,1----------------4  numbered before rotation "dg" applied
!
!---------
!
!   GB_Encoding - Encoding scheme of string characters
!
!                 = 'U', for UTF-8
!                 = 'G', for GB2312
!
!                 Default value is 'U', if argument not present or invalid
!
!   GB_Font     - Chinese fonts
!
!                 = 'SV', "Song"     font of type "Vector"
!                 = 'HV', "Hei"      font of type "Vector"
!                 = 'FV', "FangSong" font of type "Vector"

!                 = 'SD', "Song"     font of type "Dot"
!                 = 'HD', "Hei"      font of type "Dot"
!                 = 'KD', "Kai"      font of type "Dot"
!                 = 'FD', "FangSong" font of type "Dot"
!
!                 Default value is 'SV', if argument not present or invalid
!
!   GB_Quality  - n, quality of fonts
!
!                 a) for "Dot" fonts
!
!                    n = 1-9, use the font with dot-matrix size of
!                             "16*n" by "16*n"
!
!                    n >= 10, use the font with dot-matrix size of
!                             "n" by "n"
!
!                    Default value is 4, if argument not present or invalid
!
!                 b) for "Vector" fonts
!
!                    n = 0, "fill" polygon only
!
!                    otherrwise, "fill" first, and then, "outline" with
!                    line width scaled by factor REAL(ABS(n))/100.0
!
!                    i.e.,
!                          ! get current line with
!                          CALL NG_GQLWSC( a )
!                          ! set "outline" line width
!                          CALL NG_GSLWSC( a*REAL(ABS(n))/100.0 )
!
!                    Default value is 0 for font "HV", and, 100 for
!                    fonts "SV" and "FV"
!
!                 Note: Chinese words in character string "string" not
!                       supported in "VECTOR" font will be drawn using
!                       "DOT" font of same "Song/Hei/FangSong" type
!                       with default dot matrix size 64 (n=4) automatically
!
!   GB_DotLWSC  - Scaling factor of the size of the dots for using dot font
!                 (this argument used for "DOT" font only)
!
!                 Default value is 1.0, if argument not present
!
!   GB_Debug    - Debug flag
!
!                 Default value is .FALSE., if argument not present
!
!---------
! Notes
!---------
!
! GB2312: [1-94,1-94] 94*94=9118 word positions
!
! Dot fonts:
!  [WCHAR-NCL] https://github.com/WCHAR-NCL/Dot-Matrix
!  support [1-87,1-94] 87*94=8187 characters
!
! Vector Fonts:
!  鲁建军,QQ:273603861,email:hsljj@163.com,湖北省鄂州市气象局
!  support [16-87,1-94] 72*94=6768 characters
!
!
!=====================================================================
!
! Table of text-drawing parameters
!
! PLCHHQ or PCHIQU parameters
! --------------------------------------------------------------------
! Parameter  Brief Description                      Type
! --------------------------------------------------------------------
! AS         Sets chAracter Spacing                 Real
! BC         Box Color                              Integer array
! BF         Box outline, Fill, and shadow          Integer
! BL         Box Line width                         Real
! BM         Box Margin width                       Real
! BX         Box shadow X offset                    Real
! BY         Box shadow Y offset                    Real
! CC         SpeCial Color indices                  Integer array
! CD         Complex or Duplex dataset              Integer
! CE         String CEntering                       Integer
! CH         Digitized Cartographic Height          Real
! CL         PrinCipal Line width                   Real
! CS         Constant-Spacing flag                  Real
! CV         Cartographic Vertical spacing          Real
! CW         Digitized Cartographic Width           Real
! DB         Bottom text extent box Distance        Real
! DL         Left text extent box Distance          Real
! DO         Character Drawing Order                Integer
! DR         Right text extent box Distance         Real
! DT         Top text extent box Distance           Real
! FB         Bezier curve Fidelity parameter        Real
! FC         Function-Code character                Character
! FN         Font Number or name                    Character or Integer
! IH         Digitized Indexical Height             Real
! IS         Indexical size Sub- or superscripting  Real
!            offset
! IV         Indexical Vertical spacing             Real
! IW         Digitized Indexical Width              Real
! MA         MApping flag                           Integer
! OC         Outline Color specifier                Integer
! OF         Outline Flag                           Integer
! OL         Outline Line width                     Real
! OR         Out-of-Range flag                      Integer
! PH         Digitized Principal Height             Real
! PS         Principal size Sub- or superscripting  Real
!            offset
! PV         Principal Vertical spacing             Real
! PW         Digitized Principal Width              Real
! QU         QUality flag                           Integer
! SA         Character size multiplier              Real
! SC         Shadow Color                           Integer
! SF         Shadow Flag                            Integer
! SL         Shadow Line width                      Real
! SS         Subtract Space flag                    Real
! SX         Shadow X offset                        Real
! SY         Shadow Y offset                        Real
! TE         Text-Extent computation flag           Integer
! XB         Last string X Beginning -- output      Real
! XC         Last string X Center -- output         Real
! XE         Last string X End -- output            Real
! YB         Last string Y Beginning -- output      Real
! YC         Last string Y Center -- output         Real
! YE         Last string Y End -- output            Real
! --------------------------------------------------------------------
!
! PLCHMQ or PCMEQU parameters
! -----------------------------------------------
! Parameter  Brief description       Fortran type
! -----------------------------------------------
! HW         Character aspect ratio  Real
! MA         MApping flag            Integer
! OR         Out-of-Range flag       Real
! -----------------------------------------------
!
! PLCHLQ or PCLOQU parameters
! ------------------------------------------
! Parameter  Brief Description  Fortran type
! ------------------------------------------
! MA         MApping flag       Integer
! OR         Out-of-Range flag  Real
! ------------------------------------------
!
!=====================================================================
! NCAR Graphics Fontcaps:
!=====================================================================
!
!   0 - PWRITX Database
!   1 - DEFAULT
!   2 - HERSHEY:CARTOGRAPHIC_ROMAN
!   3 - HERSHEY:CARTOGRAPHIC_GREEK
!   4 - HERSHEY:SIMPLEX_ROMAN    ~ UNIPLT Font01, Futura Light
!   5 - HERSHEY:SIMPLEX_GREEK    ~ UNIPLT Font19, Greek
!   6 - HERSHEY:SIMPLEX_SCRIPT   ~ UNIPLT Font07, cursive
!   7 - HERSHEY:COMPLEX_ROMAN    ~ UNIPLT Font03, Times Medium
!   8 - HERSHEY:COMPLEX_GREEK    ~ UNIPLT Font20, Times Greek
!   9 - HERSHEY:COMPLEX_SCRIPT   ~ UNIPLT Font09, Script Complex (serifs, doubled strokes)
!  10 - HERSHEY:COMPLEX_ITALIC   ~ UNIPLT Font05, Times Medium Italic
!  11 - HERSHEY:COMPLEX_CYRILLIC ~ UNIPLT Font23, Cyrillic
!  12 - HERSHEY:DUPLEX_ROMAN     ~ UNIPLT Font02, Futura Medium
!  13 - HERSHEY:TRIPLEX_ROMAN    ~ UNIPLT Font04, Times Bold
!  14 - HERSHEY:TRIPLEX_ITALIC   ~ UNIPLT Font06, Times Bold Italic
!  15 - HERSHEY:GOTHIC_GERMAN    ~ UNIPLT Font14, Gothic German
!  16 - HERSHEY:GOTHIC_ENGLISH   ~ UNIPLT Font13, Gothic English
!  17 - HERSHEY:GOTHIC_ITALIAN   ~ UNIPLT Font15, Gothic Italian
!  18 - HERSHEY:MATH_SYMBOLS
!  19 - HERSHEY:SYMBOL_SET1
!  20 - HERSHEY:SYMBOL_SET2
!  21 - NCAR:HELVETICA      (filled font)
! 121 - NCAR:HELVETICA      (outline font)
!  22 - NCAR:HELVETICA-BOLD (filled font)
! 122 - NCAR:HELVETICA-BOLD (outline font)
!  25 - NCAR:TIMES-ROMAN    (filled font)
! 125 - NCAR:TIMES-ROMAN    (outline font)
!  26 - NCAR:TIMES-BOLD     (filled font)
! 126 - NCAR:TIMES-BOLD     (outline font)
!  29 - NCAR:COURIER        (filled font)
! 129 - NCAR:COURIER        (outline font)
!  30 - NCAR:COURIER-BOLD   (filled font)
! 130 - NCAR:COURIER-BOLD   (outline font)
!  33 - NCAR:GREEK          (filled font)
! 133 - NCAR:GREEK          (outline font)
!  34 - NCAR:MATH-SYMBOLS   (filled font)
! 134 - NCAR:MATH-SYMBOLS   (outline font)
!  35 - NCAR:TEXT-SYMBOLS   (filled font)
! 135 - NCAR:TEXT-SYMBOLS   (outline font)
!  36 - NCAR:WEATHER1       (filled font)
! 136 - NCAR:WEATHER1       (outline font)
!  37 - NCAR:WEATHER2       (filled font)
! 137 - NCAR:WEATHER2       (outline font)
!
! Note: If character color (parameter "CC") or fill-area color index
! FACI not specified (i.e., -1), current polyline color index PLCI
! will be used for filled font color filling.
!
!=====================================================================
! Refer "NCAR menu" for interfacing PLOTCHAR in detail
!=====================================================================


!=====================================================================
! UNIPLT Character Plot Routines (by chiangtp)
!=====================================================================
!
! NG_PCHSET - Set parameters
! NG_PCHGET - Get parameters
! NG_PCHRST - Reset parameters
!
! NG_PCHOUT - Draw character string
! NG_PCHLEN - Inquire drawing-length of string
!
!---------------------------------------
!
! UNIPLT supports following 32 Hershey vector fonts
!
!  0 - Default (Times Medium)
!
!  1 - Futura Light
!  2 - Futura Medium
!
!  3 - Times Medium
!  4 - Times Bold
!  5 - Times Medium Italic
!  6 - Times Bold Italic
!
!  7 - cursive (nearly same as scripts.jhf)
!  8 - Script Simplex (no serifs)
!  9 - Script Complex (serifs, doubled strokes)
!
! 10 - Raman Simplex (no serifs, single stroke)
! 11 - Roman Duplex (no serifs, doubled strokes)
! 12 - Roman triplex (serifs, tripled strokes)
!
! 13 - Gothic English
! 14 - Gothic German
! 15 - Gothic Italian
!
! 16 - Gothic English Triplex
! 17 - Gothic German Triplex
! 18 - Gothic Italian Triplex
!
! 19 - Greek
! 20 - Times Greek
!
! 21 - Greek Simplex (no serifs)
! 22 - Greek Complex (serifs, doubled strokes)
!
! 23 - Cyrillic
! 24 - Cyrillic 1
!
! 25 - Music
! 26 - Meteorology
! 27 - Astrology
!
! 28 - Math Upper
! 29 - Math Lower
!
! 30 - Symbolic
! 31 - Markers
!
!---------------------------------------------------------------------
!
! SUBROUTINE NG_PCHSET( ifont, ratio, angle )
!
! Routine to set the font number and drawing styles (aspect ratio and
! italic angle of character plot.
!
! Variables :
!
!   INTEGER, INTENT(IN), OPTIONAL :: ifont
!   REAL,    INTENT(IN), OPTIONAL :: ratio, angle
!
!   ifont: The font-number of Hershey font, in the range 0-32
!
!   ratio: The specified aspect ratio
!          =1.0 is normal, while values greater than 1.0
!          give characters that are wider than normal, and
!          smaller values (<1.0) give narrow characters.
!          Note that the aspect ratio is limited in the
!          range [0.1, 4.0], and, the value of aspect ratio
!          will be set to 1 if ABS(aspect_ratio-1.0) <= 0.1
!
!   angle: The specified slant angle
!          =0.0 is the normal condition, while italic_angle>0.0
!          gives a forward slant, and italic_angle<0.0 gives
!          a backward slant.
!          Note that the value of angle is limited in the
!          range of [-45.0,45.0].
!
!---------------------------------------------------------------------
!
! SUBROUTINE NG_PCHGET( ifont, ratio, angle )
!
! Routine to inquire the font number and drawing styles (aspect ratio
! and italic angle) of currect character plot.
!
! Variables :
!
!   INTEGER, INTENT(OUT), OPTIONAL :: ifont
!   REAL,    INTENT(OUT), OPTIONAL :: ratio, angle
!
!   ifont: The font number of hershey font
!
!   ratio: The aspect ratio of drawing style
!
!   angle: The slant angle of drawing style
!
!---------------------------------------------------------------------
!
! SUBROUTINE NG_PCHRST()
!
! Routine to reset font number and drawing styles to its default.
!
! The default values are:
!
!     0, the font-number of hershey font
!
!   1.0, the aspect ratio of drawing style
!
!   0.0, the slant angle of drawing style
!
!---------------------------------------------------------------------
!
! SUBROUTINE NG_PCHOUT( XC, YC, STRING, HT, DG, ICNT, cwd, iwd )
!
! Routine to draw the given character string.
!
! Variables :
!
!   REAL,                   INTENT(IN) :: XC, YC, HT, DG
!   INTEGER,                INTENT(IN) :: ICNT
!   CHARACTER(*),           INTENT(IN) :: STRING
!   CHARACTER(1), OPTIONAL, INTENT(IN) :: cwd
!   INTEGER,      OPTIONAL, INTENT(IN) :: iwd
!
!   XC    : X position, in user coordinate
!
!   YC    : Y position, in user coordinate
!
!   HT    : Height, in fractional coordinate
!
!   DG    : Align angle in degree
!
!   STRING: Character string
!
!   ICNT  : Centering option.
!           =-1 means that (XC,YC) is the center of the left edge of the first character
!           = 0 means that (XC,YC) is the center of the midpoint of the character string
!           = 1 means that (XC,YC) is the center of the right edge of the last character
!
!   cwd   : The specified "character" for constant-width-plot.
!           All characters in "string" will be drawn with the width
!           of character "cwd"
!
!   iwd   : The specified digitized "width" for constant-width-plot.
!           All characters in "string" will be drawn with the width
!           "iwd" (refer the notes)
!
!   Notes:
!
!     1. Digitized "height", iht=21, is fixed for all Hershey fonts
!
!     2. "cwd" specification will override "iwd", if coexist
!
!---------------------------------------------------------------------
!
! SUBROUTINE NG_PCHLEN( STRING, HT, SL, cwd, iwd )
!
! Routine to get the actual drawing length of character string.
!
! Variables :
!
!   CHARACTER(*),           INTENT(IN   ) :: STRING
!   REAL,                   INTENT(IN   ) :: HT
!   REAL,                   INTENT(  OUT) :: SL
!   CHARACTER(1), OPTIONAL, INTENT(IN   ) :: cwd
!   INTEGER,      OPTIONAL, INTENT(IN   ) :: iwd
!
!   STRING: The character string to be drawn
!
!   HT    : Height of the character
!
!   SL    : Calculated string drawing length
!
!   cwd   : The specified "character" for constant-width-plot.
!           All characters in "string" will be drawn with the width
!           of character "cwd"
!
!   iwd   : The specified digitized "width" for constant-width-plot.
!           All characters in "string" will be drawn with the width
!           "iwd" (refer the notes)
!
!   Notes:
!
!     1. Digitized "height", iht=21, is fixed for all Hershey fonts
!
!     2. "cwd" specification will override "iwd", if coexist
!
!---------------------------------------------------------------------