summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/cstex/cspsfonts-gen/kernoff.c
blob: 45bdbb5810b29f7a9f7984ed675bdd00dd01dc5b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/* This program removes kerns smaller then KERNLIMIT from AFM file
   Petr Olsak, 2012
   input AFM file = stdin, output = stdout, no parameters */


#include <stdio.h>

#define KERNLIMIT 9

char line[500];

int mygets(char *s, int num) 
{
  int c, i;   
  if ((c=fgetc(stdin))==EOF) return EOF;
  if (c=='\n')  return s[0] = 0;
  s[0] = c; i=1;
  while (1) {
    if (i>=num) {
      fprintf (stderr, "line is too long\n");
      s[num-1] = 0;
      return;
    }
    if ((c=fgetc(stdin))==EOF) return s[i] = 0;
    if (c=='\n')  return s[i] = 0;
    s[i++]=c;
  } 
}

int main(int argc, char *argv[]) 
{
  int i, v;
  while (1) {
     if (mygets(line,500)==EOF) return 0;
     v=100;
     if (line[0]=='K' && line[1]=='P' && line[2]=='X' && line[3]==' ') {
        i = 4;
        while (line[i]!=' ') i++;
        i++;
        while (line[i]!=' ') i++;
        v = atoi(&line[i]);
     }
     if (v>KERNLIMIT || v<-KERNLIMIT) printf("%s\n", line);
  }
}