src/vflmkpcf.c

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

FUNCTIONS

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

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

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