src/vflmkgf.c

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

FUNCTIONS

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

   1 /* 
   2  * vflmkgf.c 
   3  * - a vflibcap entry generator for TeX GF fonts
   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  "gf.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_gff; 
  62 char  *gf_fontdirs[NDIRS];
  63 
  64 int   gen_missing_glyph = 0;
  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_gff = 0;
  82   for (i = 0; i < NDIRS; i++){
  83     gf_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("vflmkgf: generates vflibcap entries for GF fonts\n");
  93       printf("Usage: vflmkgf [options]\n");
  94       printf("Options\n");
  95       printf("  -d DIR   : GF font file directory\n");
  96       printf("  -n MODE  : Device mode name for kpathsea\n");
  97       printf("  -r DPI   : Default device resolution\n");
  98       printf("  -g       : Emit code to generate GF file on-the-fly\n");
  99 
 100       printf("Example: vflmkgf -d TEXMF -d /usr/tex/fonts -g \n");
 101       exit(0);
 102 
 103     } else if (strcmp(*xargv, "-d") == 0){
 104       /* font dir */
 105       if (n_gff == NDIRS){
 106         fprintf(stderr, "Too many GF font directories\n");
 107         exit(1);
 108       }
 109       xargv++; xargc--;
 110       check_argc(xargc);
 111       gf_fontdirs[n_gff++] = x_strdup(*xargv);
 112 
 113     } else if (strcmp(*xargv, "-r") == 0){
 114       xargv++; xargc--;
 115       check_argc(xargc);
 116       dpi = strdup(*xargv);
 117 
 118     } else if (strcmp(*xargv, "-n") == 0){
 119       /* mode */
 120       xargv++; xargc--;
 121       check_argc(xargc);
 122       mode = x_strdup(*xargv);
 123 
 124     } else if (strcmp(*xargv, "-g") == 0){
 125       gen_missing_glyph = 1; 
 126 
 127     } else {
 128       if (*xargv[0] == '-'){
 129         fprintf(stderr, "vflmkgf: unknown option %s\n", *xargv);
 130         exit(1);
 131       }
 132       break;
 133 
 134     }
 135   }
 136 
 137   banner("GF", "vflmkgf", cmdline);
 138 
 139   gen_class_deafult();    
 140 
 141   return 0;
 142 }
 143 
 144 
 145 
 146 void
 147 gen_class_deafult(void)
     /* [<][>][^][v][top][bottom][index][help] */
 148 {
 149   int   i;
 150 
 151   printf("(%s %s", 
 152          VF_CAPE_VFLIBCAP_CLASS_DEFAULT_DEFINITION, FONTCLASS_NAME_GF);
 153   printf("\n  (%s", VF_CAPE_FONT_DIRECTORIES);
 154   for (i = 0; i < n_gff; i++)
 155     printf("\n       \"%s\"", gf_fontdirs[i]);
 156   printf(")");
 157   printf("\n  (%s %s)", VF_CAPE_DPI, dpi);
 158 #if 0
 159   printf("\n  (%s \"%s\")", VF_CAPE_MAKE_MISSING_GLYPH, 
 160          (gen_missing_glyph==1) ? "yes" : "no");
 161 #endif
 162   printf(")\n");
 163   printf("\n");
 164 }
 165 

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