home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / x / volume19 / xfig / part03 / u_fonts.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-05-27  |  4.2 KB  |  131 lines

  1. /*
  2.  * FIG : Facility for Interactive Generation of figures
  3.  * Copyright (c) 1991 by Brian V. Smith
  4.  *
  5.  * "Permission to use, copy, modify, distribute, and sell this software and its
  6.  * documentation for any purpose is hereby granted without fee, provided that
  7.  * the above copyright notice appear in all copies and that both the copyright
  8.  * notice and this permission notice appear in supporting documentation. 
  9.  * No representations are made about the suitability of this software for 
  10.  * any purpose.  It is provided "as is" without express or implied warranty."
  11.  */
  12.  
  13. #include <X11/Xlib.h>
  14. #include "fig.h"
  15. #include "resources.h"
  16. #include "u_fonts.h"
  17. #include "object.h"
  18.  
  19. /* printer font names for indicator window */
  20.  
  21. struct _xfstruct x_fontinfo[NUM_X_FONTS] = {
  22.     {"-adobe-times-medium-r-*--", (struct xfont*) NULL},
  23.     {"-adobe-times-medium-i-*--", (struct xfont*) NULL},
  24.     {"-adobe-times-bold-r-*--", (struct xfont*) NULL},
  25.     {"-adobe-times-bold-i-*--", (struct xfont*) NULL},
  26.     {"-schumacher-clean-medium-r-*--", (struct xfont*) NULL},
  27.     {"-schumacher-clean-medium-i-*--", (struct xfont*) NULL},
  28.     {"-schumacher-clean-bold-r-*--", (struct xfont*) NULL},
  29.     {"-schumacher-clean-bold-i-*--", (struct xfont*) NULL},
  30.     {"-adobe-courier-medium-r-*--", (struct xfont*) NULL},
  31.     {"-adobe-courier-medium-o-*--", (struct xfont*) NULL},
  32.     {"-adobe-courier-bold-r-*--", (struct xfont*) NULL},
  33.     {"-adobe-courier-bold-o-*--", (struct xfont*) NULL},
  34.     {"-adobe-helvetica-medium-r-*--", (struct xfont*) NULL},
  35.     {"-adobe-helvetica-medium-o-*--", (struct xfont*) NULL},
  36.     {"-adobe-helvetica-bold-r-*--", (struct xfont*) NULL},
  37.     {"-adobe-helvetica-bold-o-*--", (struct xfont*) NULL},
  38.     {"-adobe-new century schoolbook-medium-r-*--", (struct xfont*) NULL},
  39.     {"-adobe-new century schoolbook-medium-i-*--", (struct xfont*) NULL},
  40.     {"-adobe-new century schoolbook-bold-r-*--", (struct xfont*) NULL},
  41.     {"-adobe-new century schoolbook-bold-i-*--", (struct xfont*) NULL},
  42.     {"-*-lucidabright-medium-r-*--", (struct xfont*) NULL},
  43.     {"-*-lucidabright-medium-i-*--", (struct xfont*) NULL},
  44.     {"-*-lucidabright-demibold-r-*--", (struct xfont*) NULL},
  45.     {"-*-lucidabright-demibold-i-*--", (struct xfont*) NULL},
  46.     {"-*-symbol-medium-r-*--", (struct xfont*) NULL},
  47.     {"-*-zapfchancery-medium-i-*--", (struct xfont*) NULL},
  48.     {"-*-zapfdingbats-*-*-*--", (struct xfont*) NULL},
  49. };
  50.  
  51. struct _fstruct ps_fontinfo[NUM_PS_FONTS + 1] = {
  52.     {"Default", -1},
  53.     {"Times-Roman", 0},
  54.     {"Times-Italic", 1},
  55.     {"Times-Bold", 2},
  56.     {"Times-BoldItalic", 3},
  57.     {"AvantGarde-Book", 4},
  58.     {"AvantGarde-BookOblique", 5},
  59.     {"AvantGarde-Demi", 6},
  60.     {"AvantGarde-DemiOblique", 7},
  61.     {"Bookman-Light", 0},
  62.     {"Bookman-LightItalic", 0},
  63.     {"Bookman-Demi", 0},
  64.     {"Bookman-DemiItalic", 0},
  65.     {"Courier", 8},
  66.     {"Courier-Oblique", 9},
  67.     {"Courier-Bold", 10},
  68.     {"Courier-BoldOblique", 11},
  69.     {"Helvetica", 12},
  70.     {"Helvetica-Oblique", 13},
  71.     {"Helvetica-Bold", 14},
  72.     {"Helvetica-BoldOblique", 15},
  73.     {"Helvetica-Narrow", 0},
  74.     {"Helvetica-Narrow-Oblique", 0},
  75.     {"Helvetica-Narrow-Bold", 0},
  76.     {"Helvetica-Narrow-BoldOblique", 0},
  77.     {"NewCenturySchlbk-Roman", 16},
  78.     {"NewCenturySchlbk-Italic", 17},
  79.     {"NewCenturySchlbk-Bold", 18},
  80.     {"NewCenturySchlbk-BoldItalic", 19},
  81.     {"Palatino-Roman", 20},
  82.     {"Palatino-Italic", 21},
  83.     {"Palatino-Bold", 22},
  84.     {"Palatino-BoldItalic", 23},
  85.     {"Symbol", 24},
  86.     {"ZapfChancery-MediumItalic", 25},
  87.     {"ZapfDingbats", 26},
  88. };
  89.  
  90. struct _fstruct latex_fontinfo[NUM_LATEX_FONTS] = {
  91.     {"Default", 0},
  92.     {"Roman", 0},
  93.     {"Bold", 2},
  94.     {"Italic", 1},
  95.     {"Modern", 12},
  96.     {"Typewriter", 8},
  97. };
  98.  
  99. x_fontnum(psflag, fnum)
  100.     int            psflag, fnum;
  101. {
  102.     return (psflag ? ps_fontinfo[fnum + 1].xfontnum :
  103.         latex_fontinfo[fnum].xfontnum);
  104. }
  105.  
  106. psfontnum(font)
  107. char *font;
  108. {
  109.     int i;
  110.  
  111.     if (font == NULL)
  112.     return(DEF_PS_FONT);
  113.     for (i=0; i<NUM_PS_FONTS; i++)
  114.     if (strcmp(ps_fontinfo[i].name, font) == 0)
  115.         return (i-1);
  116.     return(DEF_PS_FONT);
  117. }
  118.  
  119. latexfontnum(font)
  120. char *font;
  121. {
  122.     int i;
  123.  
  124.     if (font == NULL)
  125.     return(DEF_LATEX_FONT);
  126.     for (i=0; i<NUM_LATEX_FONTS; i++)
  127.     if (strcmp(latex_fontinfo[i].name, font) == 0)
  128.         return (i);
  129.     return(DEF_LATEX_FONT);
  130. }
  131.