Hershey               package:graphics               R Documentation

_H_e_r_s_h_e_y _V_e_c_t_o_r _F_o_n_t_s _i_n _R

_D_e_s_c_r_i_p_t_i_o_n:

     If the 'vfont' argument to one of the text-drawing functions
     ('text', 'mtext', 'title', 'axis', and 'contour') is a character
     vector of length 2, Hershey vector fonts are used to render the
     text.

     These fonts have two advantages:

        1.  vector fonts describe each character in terms of a set of
           points;  R renders the character by joining up the points
           with straight lines.  This intimate knowledge of the outline
           of each character means that R can arbitrarily transform the
           characters, which can mean that the vector fonts look better
           for rotated and 3d text.

        2.  this implementation was adapted from the GNU libplot
           library which provides support for non-ASCII and non-English
           fonts.  This means that it is possible, for example, to
           produce weird plotting symbols and Japanese characters.

     Drawback:
      You cannot use mathematical expressions ('plotmath') with Hershey
     fonts.

_U_s_a_g_e:

     Hershey

_D_e_t_a_i_l_s:

     The Hershey characters are organised into a set of fonts, which
     are specified by a typeface (e.g., 'serif' or 'sans serif') and a
     fontindex or "style" (e.g., 'plain' or 'italic'). The first
     element of 'vfont' specifies the typeface and the second element
     specifies the fontindex.  The first table produced by
     'demo(Hershey)' shows the character 'a' produced by each of the
     different fonts.

     The available 'typeface' and 'fontindex' values are available as
     list components of the variable 'Hershey'. The allowed pairs for
     '(typeface, fontindex)' are:

       serif              plain
       serif              italic
       serif              bold
       serif              bold italic
       serif              cyrillic
       serif              oblique cyrillic
       serif              EUC
       sans serif         plain
       sans serif         italic
       sans serif         bold
       sans serif         bold italic
       script             plain
       script             italic
       script             bold
       gothic english     plain
       gothic german      plain
       gothic italian     plain
       serif symbol       plain
       serif symbol       italic
       serif symbol       bold
       serif symbol       bold italic
       sans serif symbol  plain
       sans serif symbol  italic

     and the indices of these are available as 'Hershey$allowed'.

     _E_s_c_a_p_e _s_e_q_u_e_n_c_e_s: The string to be drawn can include escape
          sequences, which all begin with a '\'.   When R encounters a
          '\', rather than drawing the '\', it treats the subsequent
          character(s) as a coded description of what to draw.

          One useful escape sequence (in the current context) is of the
          form: '\123'.  The three digits following the '\' specify an
          octal code for a character.  For example, the octal code for
          'p' is 160 so the strings '"p"' and '"\160"' are equivalent.
          This is useful for producing characters when there is not an
          appropriate key on your keyboard.

          The other useful escape sequences all begin with '\\'.  These
          are described below. Remember that backslashes have to be
          doubled in R character strings, so they need to be entered
          with _four_ backslashes.


     _S_y_m_b_o_l_s: an entire string of Greek symbols can be produced by
          selecting the Serif Symbol or Sans Serif Symbol typeface.  To
          allow Greek symbols to be embedded in a string which uses a
          non-symbol typeface, there are a set of symbol escape
          sequences of the form '\\ab'. For example, the escape
          sequence '\\*a' produces a Greek alpha. The second table in
          'demo(Hershey)' shows all of the symbol escape sequences and
          the symbols that they produce.


     _I_S_O _L_a_t_i_n-_1: further escape sequences of the form '\\ab' are
          provided for producing ISO Latin-1 characters (for example,
          if you only have a US keyboard).  Another option is to use
          the appropriate octal code.  The (non-ASCII) ISO Latin-1
          characters are in the range 241...377.  For example, '\366'
          produces the character 'o' with an umlaut.  The third table
          in 'demo(Hershey)' shows all of the ISO Latin-1 escape
          sequences.


     _S_p_e_c_i_a_l _C_h_a_r_a_c_t_e_r_s: a set of characters are provided which do not
          fall into any standard font.  These can only be accessed by
          escape sequence.  For example, '\\LI' produces the zodiac
          sign for Libra, and '\\JU' produces the astronomical sign for
          Jupiter. The fourth table in 'demo(Hershey)' shows all of the
          special character escape sequences.


     _C_y_r_i_l_l_i_c _C_h_a_r_a_c_t_e_r_s: cyrillic characters are implemented according
          to the K018-R encoding.  On a US keyboard, these can be
          produced using the Serif typeface and Cyrillic (or Oblique
          Cyrillic) fontindex and specifying an octal code in the range
          300 to 337 for lower case characters or 340 to 377 for upper
          case characters. The fifth table in 'demo(Hershey)' shows the
          octal codes for the available cyrillic characters.


     _J_a_p_a_n_e_s_e _C_h_a_r_a_c_t_e_r_s: 83 Hiragana, 86 Katakana, and 603 Kanji
          characters are implemented according to the EUC (Extended
          Unix Code) encoding. Each character is identified by a unique
          hexadecimal code. The Hiragana characters are in the range
          0x2421 to 0x2473, Katakana are in the range 0x2521 to 0x2576,
          and Kanji are (scattered about) in the range 0x3021 to
          0x6d55.

          When using the Serif typeface and EUC fontindex, these
          characters can be produced by a _pair_ of octal codes.  Given
          the hexadecimal code (e.g., 0x2421), take the first two
          digits and add 0x80 and do the same to the second two digits
          (e.g., 0x21 and 0x24 become 0xa4 and 0xa1), then convert both
          to octal (e.g., 0xa4 and 0xa1 become 244 and 241).  For
          example, the first Hiragana character is produced by
          '\244\241'.

          It is also possible to use the hexadecimal code directly. 
          This works for all non-EUC fonts by specifying an escape
          sequence of the form '\\#J1234'.  For example, the first
          Hiragana character is produced by '\\#J2421'.

          The Kanji characters may be specified in a third way, using
          the so-called "Nelson Index", by specifying an escape
          sequence of the form '\\#N1234'.  For example, the Kanji for
          "one" is produced by '\\#N0001'.

          'demo(Japanese)' shows the available Japanese characters.


     _R_a_w _H_e_r_s_h_e_y _G_l_y_p_h_s: all of the characters in the Hershey fonts are
          stored in a large array.  Some characters are not accessible
          in any of the Hershey fonts.  These characters can only be
          accessed via an escape sequence of the form '\\#H1234'.  For
          example, the fleur-de-lys is produced by '\\#H0746'.  The
          sixth and seventh tables of 'demo(Hershey)' shows all of the
          available raw glyphs.

_R_e_f_e_r_e_n_c_e_s:

     <URL: http://www.gnu.org/software/plotutils/plotutils.html>

_S_e_e _A_l_s_o:

     'demo(Hershey)', 'text', 'contour'.

     'Japanese' for the Japanese characters in the Hershey fonts.

_E_x_a_m_p_l_e_s:

     Hershey

     ## for tables of examples, see demo(Hershey)

