aboutsummaryrefslogtreecommitdiffstats
path: root/data/fcvt.awk
blob: bb39390b3d2e676b1d8d9aa378ca946bf47464e9 (plain) (blame)
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# convert old fontdefs file to new font database
NR==1	{
print "###########################################################################"
print "#                                                                         #"

	  # first line must be either EXTRAS or NO_EXTRAS
	  if( $0 == "EXTRAS" )
	  {
print "#  Font definitions database (created by fcvt, with @ExtraMetrics)        #"
	    extra_metrics = 1
	  }
	  else if( $0 == "NO_EXTRAS" )
	  {
print "#  Font definitions database (created by fcvt, without @ExtraMetrics)     #"
	    extra_metrics = 0
	  }
	  else
	  {
print "#  Font definitions database ERRONEOUS FIRST LINE NEEDS INVESTIGATION     #"
	  }
print "#                                                                         #"
print "#  Each entry defines one font.  The fields and their meanings are:       #"
print "#                                                                         #"
print "#     Name          Compulsory   Meaning                                  #"
print "#     ---------------------------------------------------------------     #"
print "#     @Tag          Yes          Must equal @Family-@Face                 #"
print "#     @Family       Yes          Font family name                         #"
print "#     @Face         Yes          Font face name                           #"
print "#     @Name         Yes          PostScript name as in @Metrics file      #"
print "#     @Metrics      Yes          Adobe font metrics file of this font     #"
print "#     @ExtraMetrics No           Extra metrics                            #"
print "#     @Mapping      Yes          .LCM (Lout Character Mapping) file       #"
print "#     @Recode       No           Recode or not (Yes or No, default Yes)   #"
print "#                                                                         #"
print "#  Jeffrey H. Kingston                                                    #"
print "#  6 May 20000                                                            #"
print "#                                                                         #"
print "###########################################################################"
	}

$0~/^#/	{
	  # comment line, skip it
	  next;
	}

	{
	  # a real line
	  # can't get split to work, so using this
	  j = 1
	  for(i = 1;  i < NF; i++ )
	  {
	    if( $1 != "" )
	    {
	      field[j++] = $i
	    }
	  }

	  # now print the lot
	  if( j == 1 )
	  {
	    # empty line, echo it
	    print ""
	  }
	  else if( j != 9 )
	  {
	    print "# error, " j " fields: " $0
	  }
	  else
	  {
	    family = field[2]
	    face = field[3]
	    name = field[5]
	    afmfile = field[6]
	    lcmfile = field[7]
	    recode = field[8]
	    if( used[family "-" face] == "" )
	    {
	      used[family "-" face] = "used"
	      print "{ @FontDef"
	      print "    @Tag { " family "-" face " }"
	      print "    @Family { " family " }"
	      print "    @Face { " face " }"
	      print "    @Name { " name " }"
	      print "    @Metrics { " afmfile " }"
	      if( extra_metrics == 1 )
	        print "    @ExtraMetrics { " afmfile "+ }"
	      print "    @Mapping { " lcmfile " }"
	      if( recode == "NoRecode" )
	        print "    @Recode { No }"
	      print "}"
	      print ""
	    }
	  }
	}