src/vflmkpk.c

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

FUNCTIONS

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

   1 /* 
   2  * vflmkpk.c 
   3  * - a vflibcap entry generator for TeX PK 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  "pk.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_pkf; 
  62 char  *pk_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_pkf = 0;
  82   for (i = 0; i < NDIRS; i++){
  83     pk_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("vflmkpk: generates vflibcap entries for PK fonts\n");
  93       printf("Usage: vflmkpk [options]\n");
  94       printf("Options\n");
  95       printf("  -d DIR   : PK 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 PK file on-the-fly\n");
  99 
 100       printf("Example: vflmkpk -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_pkf == NDIRS){
 106         fprintf(stderr, "Too many PK font directories\n");
 107         exit(1);
 108       }
 109       xargv++; xargc--;
 110       check_argc(xargc);
 111       pk_fontdirs[n_pkf++] = 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, "vflmkpk: unknown option %s\n", *xargv);
 130         exit(1);
 131       }
 132       break;
 133 
 134     }
 135   }
 136 
 137   banner("PK", "vflmkpk", 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_PK);
 153   printf("\n  (%s", VF_CAPE_FONT_DIRECTORIES);
 154   for (i = 0; i < n_pkf; i++)
 155     printf("\n       \"%s\"", pk_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] */