src/vflmktfm.c

/* [<][>]
[^][v][top][bottom][index][help] */

FUNCTIONS

This source file includes following functions.
  1. main
  2. gen_class_deafult

   1 /* 
   2  * vflmktfm.c 
   3  * - a vflibcap entry generator for TeX TFM files
   4  *
   5  * - This program prints vflibcap entries to standard output.
   6  *
   7  * - Useful for generating vflibcap for TeX DVI drivers
   8  *
   9  *
  10  * by Hirotsugu Kakugawa
  11  *
  12  *  10 May 2001
  13  */
  14 /*
  15  * Copyright (C) 2001  Hirotsugu Kakugawa. 
  16  * All rights reserved.
  17  *
  18  * This program is free software; you can redistribute it and/or modify
  19  * it under the terms of the GNU General Public License as published by
  20  * the Free Software Foundation; either version 2, or (at your option)
  21  * any later version.
  22  * 
  23  * This program is distributed in the hope that it will be useful,
  24  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  25  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  26  * GNU General Public License for more details.
  27  * 
  28  * You should have received a copy of the GNU General Public License
  29  * along with this program; if not, write to the Free Software
  30  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  
  31  */
  32 
  33 
  34 #include "config.h"
  35 #include "with.h"
  36 #include <stdio.h>
  37 #include <stdlib.h>
  38 #include <ctype.h>
  39 #include <unistd.h>
  40 #include <sys/param.h>
  41 #include <sys/time.h>
  42 
  43 #include  "VFlib-3_6.h"
  44 #include  "VFsys.h"
  45 #include  "vflibcap.h"
  46 #include  "texfonts.h"
  47 #include  "tfm.h"
  48 #include  "fsearch.h"
  49 #include  "vflmklib.h"
  50 
  51 
  52 
  53 void  gen_class_deafult(void);
  54 
  55 
  56 char  *mode  = DEFAULT_KPS_MODE;
  57 char  *dpi   = NULL;
  58 int    dpi_i = DEFAULT_KPS_DPI;
  59 
  60 #define NDIRS    64
  61 int   n_tfmf; 
  62 char  *tfm_fontdirs[NDIRS];
  63 
  64 char *glyph_style = TEX_GLYPH_STYLE_FILL_STR;
  65 char *cmdline = NULL; 
  66 
  67 
  68 
  69 int 
  70 main(int argc, char **argv)
     /* [<][>][^][v][top][bottom][index][help] */
  71 {
  72   int     i;
  73   int    xargc;
  74   char **xargv;
  75 
  76   dpi = malloc(256);
  77   sprintf(dpi, "%d", dpi_i);
  78 
  79   cmdline = copy_cmdline(argc, argv);
  80 
  81   n_tfmf = 0;
  82   for (i = 0; i < NDIRS; i++){
  83     tfm_fontdirs[i] = NULL;
  84   }
  85 
  86   xargc = argc; 
  87   xargv = argv;
  88 
  89   for (xargc--,xargv++; xargc > 0; xargc--,xargv++){
  90     if ((strcmp(*xargv, "--help") == 0)
  91         || (strcmp(*xargv, "-help") == 0)){
  92       printf("vflmktfm: generates vflibcap entries for TFM fonts\n");
  93       printf("Usage: vflmktfm [options]\n");
  94       printf("Options\n");
  95       printf("  -d DIR   : TFM font file directory\n");
  96       printf("  -r DPI   : Default device resolution\n");
  97       printf("  -n MODE  : Device mode name for kpathsea\n");
  98       printf("  -g STYLE : Glyph style, 'fill' (default) or 'empty'\n");
  99       printf("Example: vflmktfm -c -d TEXMF -d /usr/tex/fonts -g fill\n");
 100       exit(0);
 101 
 102     } else if (strcmp(*xargv, "-d") == 0){
 103       /* font dir */
 104       if (n_tfmf == NDIRS){
 105         fprintf(stderr, "Too many TFM font directories\n");
 106         exit(1);
 107       }
 108       xargv++; xargc--;
 109       tfm_fontdirs[n_tfmf++] = x_strdup(*xargv);
 110 
 111     } else if (strcmp(*xargv, "-r") == 0){
 112       xargv++; xargc--;
 113       check_argc(xargc);
 114       dpi = strdup(*xargv);
 115 
 116     } else if (strcmp(*xargv, "-n") == 0){
 117       /* mode */
 118       xargv++; xargc--;
 119       check_argc(xargc);
 120       mode = x_strdup(*xargv);
 121 
 122     } else if (strcmp(*xargv, "-g") == 0){
 123       xargv++; xargc--;
 124       check_argc(xargc);
 125       if ((strcmp(*xargv, TEX_GLYPH_STYLE_FILL_STR) != 0)
 126           && (strcmp(*xargv, TEX_GLYPH_STYLE_EMPTY_STR) != 0)){
 127         fprintf(stderr, "Unknown glyph style name: %s\n", *xargv);
 128         fprintf(stderr, "(Must be '%s' or '%s'. Default is '%s'.\n", 
 129                 TEX_GLYPH_STYLE_FILL_STR, TEX_GLYPH_STYLE_EMPTY_STR,
 130                 glyph_style);
 131         exit(1);
 132       }
 133       glyph_style = strdup(*xargv);
 134     } else {
 135       if (*xargv[0] == '-'){
 136         fprintf(stderr, "vflmktfm: unknown option %s\n", *xargv);
 137         exit(1);
 138       }
 139       break;
 140 
 141     }
 142   }
 143 
 144   banner("TFM", "vflmktfm", cmdline);
 145 
 146   gen_class_deafult();    
 147 
 148   return 0;
 149 }
 150 
 151 
 152 
 153 void
 154 gen_class_deafult(void)
     /* [<][>][^][v][top][bottom][index][help] */
 155 {
 156   int   i;
 157 
 158   printf("(%s %s", 
 159          VF_CAPE_VFLIBCAP_CLASS_DEFAULT_DEFINITION, FONTCLASS_NAME_TFM);
 160   printf("\n  (%s", VF_CAPE_FONT_DIRECTORIES);
 161   for (i = 0; i < n_tfmf; i++)
 162     printf("\n       \"%s\"", tfm_fontdirs[i]);
 163   printf(")");
 164   printf("\n  (%s %s)", VF_CAPE_DPI, dpi);
 165   printf("\n  (%s \".tfm\" \".ofm\")", VF_CAPE_EXTENSIONS);
 166   printf("\n  (%s \"%s\")", VF_CAPE_TEX_GLYPH_STYLE, glyph_style);
 167   printf(")\n");
 168   printf("\n");
 169 }

/* [<][>][^][v][top][bottom][index][help] */