summaryrefslogtreecommitdiff
path: root/fonts/utilities/t1install/toil/toil.mf1
blob: 825a4e25c386812dcdaeeacdeedeaf083cc51658 (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
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
THIS IS AN INCLUDE FILE No. 1 FOR TOILB.AWK
%This file belongs to the TOIL package : Ten plik nale/zy do pakietu TOIL
%This package is public domain         : Pakiet stanowi dobro powszechne
%For more info see `0TOILENG.LIC'      : Wi/ecej informacji w ,,0TOILPOL.LIC''
%============================================================================
% RUDIMENTARY DEFINITIONS, REDEFINITIONS AND DEFAULTS:
%%% addto H V
%%% ; semi_
%%% message write_enc write_map char_title
% ---
% This METAFONT file was generated from an AFM file in order to create
% a corresponding TFM file along with a font map file and an encoding vector
% file (the latter two are to be extracted from a log file and are meant
% for use with Tomas Rokicki's DVIPS driver)
% ---
% By default, italic angle (in degrees) |IA=whatever| and
% x-scale |XS=whatever|. User may assign a value to any of these
% variables either by changing this file or (preferably) from a command
% line writing, e.g.,
%    mf &plain \IA:=12; input thisfile
% or
%    mf &plain \XS:=1.2; input thisfile
% or
%    mf &plain \XS:=1.2;IA:=12; input thisfile
% ---
string res_enc_name;  res_enc_name=ENCNNAME;
string res_enc_file;  res_enc_file=ENCXNAME;
string type_one_file; type_one_file=TONEFILE;
boolean quiet;        quiet=MESSAGES;
vardef math_axis = MATHAXIS enddef;
vardef math_rule = MATHRULE enddef;
% ---
let semi_ = ; ;
let endchar_=endchar;
let beginchar_=beginchar;
string curr_title;
string enc_vec[\\];
% ---
mode_def tfm_mode =
 proofing:=0;               % no, we're not making full proofs
 fontmaking:=1;             % yes, we're making a font
 tracingtitles:=0;          % no, don't show titles online
 pixels_per_inch:=DUMMYPPI; % doesn't matter
 blacker:=0;                % no additional blackness
 fillin:=0;                 % no compensation for fillin
 o_correction:=1;           % no reduction in overshoot
enddef;
% --------------------------------
% SKIPPING AND NAMING CHARACTER:
def skip_char =
 let ; = end_skip_char \\ semi_
 if known show_skipping:
  message "SKIPPING " & curr_title \\ semi_
 fi
 let endchar = fi \\ semi_
 if false:
enddef;
def end_skip_char =
 let ; = semi_ semi_
 let endchar = endchar_;
enddef;
% --------------------------------
% BEGINNING CHARACTER:
def char_title expr t =
 curr_title:=t; curr_enc:=Enc(curr_title);
 if curr_enc<>-1: enc_vec[curr_enc]:=curr_title; t \\ fi
enddef;
% ---
def beginchar(expr cc,ww,hh,dd) =
 numeric code; code:=byte(cc);
 if (known skip_this_char) or (code<0):
  let next_to_do = skip_char;
 else:
  let next_to_do = beginchar_;
 fi
 save skip_this_char;
 next_to_do(code,ww,hh,dd)
enddef;
extra_endchar:=extra_endchar & ";charcode:=charcode-256;";
% --------------------------------
% ITALIC CORRECTIONS (according to the rule of thumb,
%                     see METAFONTbook, p. 105):
def IC expr tip =  % to improve or not to improve?
 charic:=xpart(tip)-charwd+ypart(tip)*user_slant+0.5u#;
 if charic<0: charic:=0; fi
enddef;
% --------------------------------
% KERNS AND LIGATURES (be careful if you don't want to produce
%                      malformed TFM):
vardef code_OK(expr c) = % returns |true| iff code |c| is OK
 if known c: (c>=0) and (c<=255) and (charexists c) else: false fi
enddef;
def start_or_cont =
% we postpone starting |ligtable| until a legal pair is encountered
 if unknown already_started:
  already_started:=1; ligtable LK_code: else: ,
 fi
enddef;
def skip_LK =
 let ; = end_skip_LK \\ semi_
 let KL = fi \\ semi_
 if false:
enddef;
def end_skip_LK =
 let ; = semi_ semi_
 let KL = relax;
enddef;
def LK(expr c) = % start ligature-kern table
 numeric LK_code,code,code',already_started;
 code:=Enc c;
 if code_OK(code): let next_to_do = relax;
 else: let next_to_do = skip_LK; fi
 next_to_do \\ LK_code:=code;
enddef;
def LP(expr c, cc) = % ligature pair
 hide(code:=Enc c; code':=Enc cc)
 if code_OK(code) and code_OK(code'):
  start_or_cont \\ code=:(code') %  braces are crucial for delimiting suffix
 fi
enddef;
def KP(expr c, k) = % kern pair
 hide(code:=Enc c)
 if code_OK(code): start_or_cont \\ code kern k fi
enddef;
let KL = relax;
% --------------------------------
% SCALING:
vardef sharp_scale(expr e) = e/100 enddef; % i.e., |1pt#*e/100|
vardef H expr x = % sharp horizontal scaling
 if known XS: XS* fi \\ sharp_scale(x)
enddef;
vardef V expr y = % sharp vertical scaling
 sharp_scale(y)
enddef;
% --------------------------------
% WRITING ENCODING:
boolean internal_enc; % set in the ENCODING part
def write_enc = message ":ENC:" \\ & enddef;
def write_map = message ":MAP:" \\ & enddef;
def write_enc_info =
 if not internal_enc:
  write_enc "/enc" & res_enc_name & "[";
  for i:=0 upto 255:
   write_enc "/"
    & if unknown enc_vec[i]: ".notdef" else: enc_vec[i] fi;
  endfor
  write_enc "] def";
 fi
enddef;
def write_map_info = % this produces a line for PSFONTS.MAP
 write_map TFMNAME;
 write_map TONENAME;
% BJ doesn't like superfluous spaces, that's why the following
% code is rather tangled than woven...
 if (user_slant<>0) or (known XS):
  write_map ditto
   if (user_slant<>0):
    & decimal(user_slant) & " SlantFont"
   fi
   if known XS:
    if (user_slant<>0): & " " fi
    & decimal(XS) & " ExtendFont"
   fi
   if internal_enc: & ditto fi;
 fi
 if not internal_enc:
  write_map
   if not ((user_slant<>0) or (known XS)): ditto & fi
    "enc" & res_enc_name & " ReEncodeFont" & ditto;
 fi
 if not internal_enc: write_map "<" & res_enc_file; fi
 if type_one_file<>"": write_map "<" & type_one_file; fi
 message "";
enddef;
% --------------------------------