>  Docs Center  >  Libraries  >  Coyote  >  CGGREEK






  This function provides a device-independent way to ask for a Greek letter as
  a string that can be included, for example, in a plot title. It uses the Greek
  simplex font (!4) when used with Hershey fonts, and the Symbol font (!9) when
  used with PostScript or True-Type fonts. Selects the type of Greek character to
  return based on value of !P.FONT. Updated now to return the UNICODE values for
  Greek characters for those fonts that support them (Macintosh?).


  David Fanning, Ph.D.
  1645 Sheely Drive
  Fort Collins, CO 80526 USA
  Phone: 970-221-0438
  E-mail: david@idlcoyote.com
  Coyote's Guide to IDL Programming: http://www.idlcoyote.com/


  Graphics, Utilities

Calling Sequence

  greekString = cgGreek(greekLetter)

Return Value

  greekString A string that represents the Greek letter.


  greekLetter: The name of the Greek letter desired. A string. Default: 'alpha'.
                  Valid string names are the 24 characters of the Greek alphabet.
                    alpha nu
                    beta xi
                    gamma omicron
                    delta pi
                    epsilon rho
                    zeta sigma
                    eta tau
                    theta upsilon
                    iota phi
                    kappa chi
                    lambda psi
                    mu omega
                  Note that if the first letter of the name is capitalized, this is
                  the equivalent of setting the CAPITAL keyword.


  CAPTIAL: If this keyword is set, the captial Greek letter is returned rather
                  than the lowercase Greek letter. An alternative way of capitalizing
                  the letter is to make the first letter of the name an uppercase letter.
  EXAMPLE: If this keyword is set, the names of the Greek characters and their
                  symbols are written out in the current graphics window.
  PS: Normally, the PostScript version of the greek letter is returned if
                  the current device is PostScript and !P.Font is 0 or 1. But, the
                  PostScript version of the greek letter can be obtained at any time
                  and in any device, by setting this keyword.
  UNICODE: If this keyword is set, the function returns the Unicode for the Greek


  Lowercase PSI:
    IDL> Plot, findgen(11), XTitle='This title contains ' + $
          cgGreek('psi') + ' as a Greek letter'
  Uppercase PSI:
    IDL> Plot, findgen(11), XTitle='This title contains ' + $
          cgGreek('Psi') + ' as a Greek letter'


  See the following article for additional information:


  For this program to work correctly on your graphics display, you should be using
  Hershey fonts (!P.Font=-1). It will work correctly in PostScript with either
  hardware fonts (!P.Font=0) or True-Type fonts (!P.Font=1).

Modification History

  Written by: David W. Fanning, 9 January 2010.
  An alternative way to get an uppercase letter is to make the first letter of
    the Greek name uppercase. (Maarten Sneep's suggestion!) 11 Jan 2010. DWF
  Had the wrong value for the PostScript version of Phi. 26 January 2010. DWF
  Added UNICODE keyword and values for Greek characters. 11 June 2010. DWF.
  Changed the branching from !D.NAME EQ 'PS' to !P.FONT NE -1. (This is actually
      what the documentation says, and what I intended.) 13 Dec 2010. DWF.
  I don't think the last change did quite want I wanted. More tweaking to make
      this more responsive to being in a PostScript file. 31 July 2011. DWF.
  Added PS keyword so the return value is the PostScript file. This is for
      convenience only, as the return value will be the PostScript value if
      the current graphics device is PS and FONT is not equal to -1. 30 Aug 2011. DWF.
  Retired Greek and replaced by cgGreek. 23 Dec 2012. DWF.

© 2020 Harris Geospatial Solutions, Inc. |  Legal
My Account    |    Store    |    Contact Us