summaryrefslogtreecommitdiff
path: root/language/coptic/cbcoptic/coptbase.mf
blob: 0a8976050f04d61b3e6cb6395dbf29bbdb06bd06 (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
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
% This file defines the Metafont macros for producing fonts copto and copti:
%copto ir "ordinary Coptic" and copti is "inclined Coptic".
%
% {limn output Sep 24 17:59:49 1995 from imageto output Sep 24 16:54:15 1995}
% Generated Tue Dec 31 14:44:16 1996.
% The original files were prepared by S. Rosmorduc in 1995; the necessity of 
% making postscrip outlines (with mftrace and pfaedit) and of extending the set of glyphs
% with new signs required some modifications and a reorganization of the orignial material.
%
% The modifications were made by Claudio Beccari on Aug 3, 2004; the font and file names 
% were changed according to the prescriptions of the GNU GPL; see below. 
%
% The bundle contains the files copto.mf, copti.mf and coptbase.mf and 
% the derived files which are: copto.tfm, copto.pk, copti.tfm, copti.pk (or whatelse
% the local METAFONT generating process calls the pk files, for example copto.600pk),
% and copto.pfb, copti.pfb; there is also a LaTeXe font definition file lcopcoptic.fd where
% the COP LaTeX encoding is defined and a coptic.sty extension package where some macros
% are defined for using inline Coptic script as well as displayed Coptic text with
% the facilities needed for some philological markup; such information was given by
% Cristiano Pulone.
%
% There is no encoding file and the pfb fonts are usable only under (La)TeX and 
% pdf(la)tex and their drivers for producing postscript output or pdf output.
% 
%
% There is no maintainer
%
% This font is in the public domain under the conditions of the GNU General Public Licence.
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Copyright (C) 1992 Free Software Foundation, Inc. 
%
% This program is free software; you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation; either version 2, or (at your option)
% any later version.
%
% This program is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with this program; if not, write to the Free Software
% Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% |true_design_size| is supposed to be the design size of the original font.  
% If the user does not set |designsize| on the command line, we default to the following.

true_design_size# := 10.000pt#;
default_design_size# := 10pt#; 
if designsize = 0: designsize := default_design_size#; fi;

% Actually the font might be declared to be 12pt, but the inner workings set up
% by S. Rosmorduc make it difficult to simply change the true_ and the default_ 
% design sizes so as to produce a real 12pt font. I (CB) let it stand this way
% because the blacker design and the larger x-heigh make the Coptic script stand
% out in evidence both along the lines maily written in Latin characters 
% and as displayed material. 

% It's pointless to actually produce different TFM files for different
% design sizes: we have only one set of outlines, after all.  So we
% adjust the resolution to account for different sizes, by setting
% |mag|.  Then we reset |designsize| to the default.

if unknown mag: mag := 1; fi; mag := mag * designsize / default_design_size#;

% So we can produce output at varying sizes, all our dimensions are
% output in terms of the ad hoc parameter |u|.
%
u# := default_design_size# / true_design_size#;

designsize := default_design_size#;

% Macros from page 289 of {\sl The Metafontbook} for short-circuit evaluation.
%
def cand (text q) = startif true q else: false fi enddef; 
def cor (text q) = startif true true else: q fi enddef; 
tertiarydef p startif true = if p: enddef;

% The proof resolution of 2601.72 pixels per inch established by plain
% \MF\ does not always work, because the characters might be too large
% (or small, for that matter) for the paper size.  So, here we change
% the proof resolution to fit the design size of the font into
% |proof_size| inches.  To do this, we must know the resolution of the
% device the proof output will be printed on; we make |proof_resolution|
% default to 300.
%
if unknown mode cor ((mode = proof) or (mode = smoke)):
  % Given in inches:
  if unknown proof_size: proof_size := 4.982; fi;% era 7, ma veniva una dimensione strana e diversa da 2602 che e' il valore di default.

  % Given in pixels per inch:
  if unknown proof_resolution: proof_resolution := 300; fi;

  % Set up the new mode to be the same as the old one, except for the
  % resolution.
  original_mode := if known mode: mode else: proof fi;
  mode_def bzr_proof_mode =
    if original_mode = proof:
      proof_;
    else:
      smoke_;
    fi;
    pixels_per_inch
      := (proof_size * proof_resolution)
         * (72.27 / proof_resolution)
         * (72.27 / designsize);
         proofing:=3;
         let makebox=maketicks;
  enddef;
  mode := bzr_proof_mode;
fi;

% Set up the device values for this run.  Since we allow a nonstandard
% value of |proofing| (see below), we must save its value, if it has
% already been assigned.
%
if (known proofing) cand (proofing > 2):
  save_proofing := proofing;
fi


mode_setup;

if known save_proofing:
  proofing := save_proofing;
fi;


% We can't define the pixel-oriented version of |u| until after
% |mode_setup| has been called.

define_pixels (u);

ascender_height:=9.45u; ascender_height#:=9.45u#; 
x_height:=5.6u; x_height#:=5.6u#;
descender_depth:=2u; descender_depth#:=2u#;

% Use a font that blends better with the \MF\ logo for the title line.
%
special "titlefont cmss8";

% If we are doing smoke proofs, put the character at its actual size on
% the output; if we're doing gray proofs, use a smaller font for the
% labels.
%

% Produce a |makelabel| command for each |z| point in |point_list| and
% each suffix in |suffixes|.
%
def general_label (text point_list, suffixes) =
  forsuffixes point_suffix = ,suffixes:
    forsuffixes point = point_list:
      % Unfortunately, the way in which the |str| operator formats its
      % argument (which is an arbitrary suffix) cannot be changed, so
      % the proofsheets end up showing "0 0" for the variable |z[0][0]|.
      makelabel (str point.point_suffix, z.point.point_suffix);
    endfor
  endfor
enddef;

% Define our labels for the proofsheets.  The person running Metafont
% can also see the control points on each spline, by setting
% |proofing>2| at the beginning.  (The {\tt plain.mf} macros only
% distinguish between |proofing=0|, |proofing>0| and |proofing>1|, so we
% are not disturbing them.)
%
def proof_labels (text t) =
  % We need to delimit the arguments here, so \MF\ knows where the
  % second |text| argument begins.  Our output uses the suffix |"s"| for
  % startpoints of segments, and the suffixes |"c1"| and |"c2"| for
  % control points.
  if proofing > 1: general_label (t) (s); fi;
  if proofing > 2: general_label (t) (c1,c2); fi;
enddef;


% We define our characters as filled outlines; page 206 of {\sl The
% Metafontbook} suggests disabling \MF's |autorounding| and
% |smoothing| features in that case.
%
autorounding := 0; % 0 avant pour les deux!
smoothing := 0;

% Sometimes we want to fill our paths, other times unfill them,
% depending on whether the winding number is positive or negative.  We
% could be absolutely safe here, and declare |temp_path| inside a group,
% at every invocation of |fill_or_unfill|; but this would waste time and
% space to no advantage, since we know exactly what kind of \MF\
% programs we output, and the variable |temp_path| is not used in them.
%
% Incidentally, we need a variable in the first place only because it is more
% efficient to avoid evaluating long paths more than once.
%
path temp_path;

def fill_or_unfill expr p =
  temp_path := p;
  if turningnumber temp_path > 0: fill else: unfill fi temp_path;
enddef;

% Since we can assume the font fills all cycles counterclockwise
% (because PostScript requires this), we want to disable the
% |turningnumber| checking which generates the `Strange path' errors.
% See p.112 and p.119 of the Metafontbook.
%
% (By the way, setting |turningcheck := 0| makes Metafont always use the
% filling rule for positive turning number, i.e., always |fill| and
% never |unfill|.  When would this be useful?)
%
turningcheck := 1;

% When we don't know the dimensions of the character we're defining
% before we define it, we have to use these to begin it:
def begin_no_dimen_char (expr c) =
  begingroup
  transform save_currenttransform;
  save_currenttransform := currenttransform;
  charcode:=if known c: byte c else: 0 fi;
  charic:=0; clearxy; clearit; clearpen; scantokens extra_beginchar;
enddef;

def end_no_dimen_char =
  currenttransform := save_currenttransform;
  endchar;
enddef;

% When use the above to start a character, must call this before `endchar'.
%
def set_char_dimens (expr w_sharp,h_sharp,d_sharp) =
 charwd:=w_sharp;      charht:=h_sharp;       chardp:=d_sharp;
 w:=hround(charwd*hppp); h:=vround(charht*hppp); d:=vround(chardp*hppp);
enddef;

% Move by shifting the current transform matrix.
%
def move (expr h_amount, v_amount) =
  currenttransform := currenttransform shifted (h_amount, v_amount);
enddef;

def hmove (expr amount) = move (amount, 0); enddef; 
def vmove (expr amount) = move (0, amount); enddef; 
def depart= 0; enddef;


transform modif; modif := identity;

% Definizione della currenttransform in cmbase.mf
%  currenttransform:=identity slanted slant
%   yscaled aspect_ratio scaled granularity;



%% Patch to get a better letter spacing.
extra_space_after:=0.9u#;

def beginchar(expr c,w_sharp,h_sharp,d_sharp) =
 begingroup
 charcode:=c + depart;
 charwd:=w_sharp + extra_space_after;
 charht:=h_sharp;       chardp:=d_sharp;
 italcorr h_sharp-.5u#;
 w:=hround(charwd*hppp); h:=vround(charht*hppp); d:=vround(chardp*hppp);
 charic:=0; clearxy; clearit; clearpen; scantokens extra_beginchar;
 transform save_currenttransform;
 save_currenttransform= currenttransform;
 currenttransform:= currenttransform transformed modif;
 enddef;

def endchar =
 scantokens extra_endchar;
 if proofing>0: makebox(proofrule); fi
 chardx:=w;     % desired width of the character in pixels
 shipit;
 if displaying>0: makebox(screenrule); showit; fi
 currenttransform:= save_currenttransform;
 endgroup enddef;



%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
font_coding_scheme := "# encoding for coptic font "; 
font_identifier := "copto";