Debian Codegraph @

texmf-dist/fonts/source/public/cmbright/ebaccess.mf

raw
1 % ebaccess.mf
2 %
3 % This file is part of ecfonts version 1.0
4 %
5 % Please read the files 00readme.txt, 00inst.txt, 00error.txt, and
6 % copyrite.txt for further information
7 %
8 % You find some documentation in ecdoc.tex (needs LaTeX2e)
9 %
10 % Accessories and special definitions for polish letters
11 % Adapted to the ec fonts by J\"org Knappen
12 % Adapted to the cm bright fonts by Walter Schmidt, see (CMBR)
13 %
14 % Copyright (c) 1992 Bogus\l{}aw Jackowski \& Marek Ry\'cko
15 % Copyright (c) 1995, 1996, 1997 J\"org Knappen
16 % ---------------------------------------------------------------------------
17 % This was PL_DOD.MF ({\bif{}dodatkowy}, i.e., additional file for the Polish
18 % extension of CM family) in text format.
19 % ---------------------------------------------------------------------------
20 %%{\let\:\sl
21 %\: This file provides accessories for making Polish diacritical characters:
22 %\: acute accent for |"C"|, |"N"|, |"L"|, |"S"|, |"Z"|, dot accent for |"Z"|,
23 %\: cross for |"L"| and ogonek for |"A"| and |"E"|. In order to avoid extra
24 %\: parameters (62 should be enough) the macros do a lot of ``clever'' stuff,
25 %\: trying to figure out needed dimensions. This is not always a trivial
26 %\: task and in some cases such extra parameters may prove to be unavoidable.
27 %\: Several additional parameters may be assigned a value, prior to reading
28 %\: the driver file, in order to override the default behaviour.
29
30 %\: One of them is
31 %\: --- the factor controlling the slope of accents over majuscules,
32 %\: |cap_flat|; if the default slope is, say, $\beta$, the resulting
33 %\: slope is equal to |(1-cap_flat)*|$\beta$; this parameter is used
34 %\: in the sources of the following fonts:
35 %\ PLCSC10, PLDUNH10, PLTCSC10
36
37 %\: Unexpectedly difficult to program turned out to be ogoneks. We decided
38 %\: that the best looking are ogoneks such that a single B\`ezier segment
39 %\: describes each of ogonek's edges. This necessitated introducing many
40 %\: parameters controlling the positions of control points (for more details
41 %\: see comments in the section ``OGONEK ACCESSORIES''). All these
42 %\: (optional) parameters may be splitted into three groups of importance:
43 %\: primary, secondary and tertiary. The primary parameters are intended
44 %\: to be ``normally'' accessible to users, the secondary ones---only in
45 %\: case of emergency, the tertiary ones---rather not at all.
46
47 %\: The primary parameters are:
48
49 %\: --- the factor controlling the depth of ogoneks, |depth_corr|; the
50 %\: resulting depth is equal to |depth_corr*desc_depth#| if the value
51 %\: of |depth_corr| is known, |desc_depth#| otherwise
52 %\: --- the factor controlling the leftmost and tip positions
53 %\: of an ogonek, |left_corr|, |tip_xcorr| and |tip_ycorr|;
54 %\: the default distances are scaled using the values of the
55 %\: corresponding parameters
56 %\: --- the scaling factor for the top and tip breadths of an ogonek,
57 %\: |top_breadth_corr|, |tip_breadth_corr|
58
59 %\: Some of the primary parameters are used in the sources of the following
60 %\: fonts:
61 % PLB10, PLBX5, PLBX6, PLBX7, PLBX8, PLFI10, PLITT10, PLR5, PLR6, PLR7,
62 % PLR8, PLR9, PLR12, PLR17, PLSL8, PLSL9, PLSL12, PLSSQ8, PLSSQI8, PLTI7,
63 % PLTI8, PLTI12, PLVTT10
64
65 %\: The following four parameters we regard as of a secondary importance:
66
67 %\: --- the pen ogoneks are to be filled with, |ogonek_pen#| (this is
68 %\: the only sharp ogonek parameter and is used in the sources of
69 %\: the {\commfont{}PLFF10} and {\commfont{}PLFI10} fonts)
70 %\: --- the darkness of ogoneks may be controlled using two parameters,
71 %\: |0<pre_lightness<1| and |0<post_lightness<1|, referring to the top
72 %\: and tip of an ogonek, respectively; used in {\commfont{}PLB10.MF}
73 %\: --- next two parameters, |pre_deflexion| and |post_deflexion|, control
74 %\: a rather small deflexion angle (in degrees) of the inner ogonek
75 %\: outline as compared to the outer one; they refere to the top and
76 %\: tip of an ogonek, respectively
77
78 %\: The complete list of `ogonek' parameters can be found in the section
79 %\: ``OGONEK ACCESSORIES.''
80
81 %\: There is one more (rather unimportant) parameter, |is_smoke|. If this
82 %\: variable is assigned a known value, `smoked' proofs will not contain
83 %\: a rule marking the height of accented letters.
84 %%}
85 % ---------------------------------------------------------------------------
86 % HISTORY
87 % 7 Feb 1992: version 1.00
88 % 11 Feb 1992: version 1.01
89 % (no changes; the new version number due to changes in \MeX{} format)
90 % 25 May 1992: version 1.02
91 % The following two erroneous assignments:
92 %| z_a:=(x_down+the_left_pos,.5penkind); %| starting point
93 %| z_d:=(xpart(z_a)-.5penkind,y_right+.5penkind)+the_tip_pos; %| ending point
94 % changed to the following ones:
95 %| z_a:=(x_down+the_left_pos,ypart(ogonek_pos)); %| starting point
96 %| z_d:=(xpart(z_a)-.5penkind,y_right+ypart(ogonek_pos))+|
97 %| the_tip_pos; %| ending point
98 % Some comments changed.
99 % 18 Dec 1992: version 1.03
100 % (no changes; the new version number due to changes in FIK_MIK.MF
101 % and some cosmetic changes in CMBX11.MF, CMR11.MF, CMTI11.MF, CMSL11.MF,
102 % CMSSBI10.MF, and POLAN.MF)
103 % 21 Apr 1995: Adaption for dxbase and dcfonts:
104 % Deleted character code (those are fixed by the Cork standard)
105 % Deleted |improve_kerns|
106 % Avoid double rounding in the definition of |fisp| by defining |fisp#|
107 % Made |the_ogonek_depth| explicitly sharp (|the_ogonek_depth#|)
108 % Changed definition of |is_cap|
109 % Replaced all occurences of |ogonked_a| and |ogonked_e| with the
110 % Cork code values |oct"241"| and |oct"246"| respectively
111 % Replaced |dotted_Z| and |dotted_z| with |oct"233"| and |oct"273"|
112 % respectively
113 % Renamed |expansion_factor| to |expansion_faktor| because of
114 % conflicting definition
115 % 7 May 1995 Appended material from czechoslovak fonts (csaccent.mf)
116 % 18 May 1995 Changed |put_accent| because I want to use it twice in
117 % one character. To achieve this, the variables |z.top| and |z.right|
118 % were renamed |z[jj].top| and |z[jj].right| respectively
119 % Changed |is_cap| again (included |168| for l with acute)
120 % 29 May 1995 Added accessories for the grave accent
121 % Changes one comment to point to dxcsc.mf instead of polkap.mf
122 % 18 Jun 1995 Made provision in |put_cross| for the blank symbol
123 % Made provision in |put_dot| for turkish dotted `I'
124 % 10 Jul 1995 Changed condition in |put_dot| to refer to |is_cap|. Needed
125 % with the tc fonts.
126 % 11 Jul 1995 Added another proviso to |put_dot| to produce floating dot
127 % 23 Jul 1995 Added proviso in |put_cross| for recipe sign
128 % 17 Aug 1995 Tuned height of accent again, added |hi.x_height@#+acc_height@#|
129 % to the minimum condition
130 % 14 Apr 1996 Buildt in Bogus\l{}aw Jackowski's fixes to avoid resolution
131 % dependent font metrics.
132 % I did not apply the change to the |put_dot| macro, because there is
133 % no chance to keep it consistent for the floating dot accent
134 % Macros for processing characters twice put to |exbase.mf|
135 % 26 Apr 1996 Put in version checking
136 % Moved last minute font setup to |expseudo.mf|
137 % 10-MAY-1996 Corrected |corrital| to make use of the canonical sharp mode
138 % Added |version_check|
139 % 22-DEC-1996 Moved definition of |is_small_cap| and |hi.| to |exbase.mf|
140 % Changed the documentation to know about ec fonts instead of dc fonts.
141 % ---------------------------------------------------------------------------
142 % VERSION CHECKING
143 % ---------------------------------------------------------------------------
144 version_check(1,0); % |version_check| was introduced in dc1.3
145 % ---------------------------------------------------------------------------
146 % LAYOUT SETUP:
147 % (A MIXTURE OF EXTENDED CM, EXTENDED ASCII, AND ``LOCAL'')
148 % ---------------------------------------------------------------------------
149 % [deleted]
150 % ---------------------------------------------------------------------------
151 % EXTRA PARAMETERS
152 % ---------------------------------------------------------------------------
153 % [deleted and/or moved]
154 %
155 % The variable |limit_dist| is set to |5/4u| in PL_DL.MF, PL_ML.MF and
156 % PL_MLK.MF, and used in |put_accent| and |put_cross|. It was introduced
157 % because of some funny (although troublesome) fonts. The value of |u| is
158 % changed by |mono_adjust|, hence it is set outside |beginchar| ... |endchar|
159 % rather than inside.
160 numeric limit_dist;
161 % ---------------------------------------------------------------------------
162 % GENERAL PURPOSE ACCESSORIES
163 % ---------------------------------------------------------------------------
164 vardef is_egyptian =
165 % |false| for most of the CM fonts, except funny fonts;
166 % |true| for the CC fonts
167 serifs and (1.4max(fine#,crisp#, tiny#)<slab#) and (1.6slab#>stem#)
168 enddef;
169
170 vardef is_bold = if serifs: (hair#+.5stem#)>1.5u# else: stem#>2u# fi\\ enddef;
171
172 vardef is_cap =
173 (((127 < charcode) and (charcode < 158)) or\\
174 ((191 < charcode) and (charcode < 224))) or\\
175 (charcode = 168) % true for l with acute
176 enddef;
177
178 %%% top is_known
179 %%% top fix_virgin
180 vardef is_known z suffix $ =
181 % an auxiliary macro for |fix_virgin z|, used also while constructing ogoneks
182 (known x$) or (known x$l) or (known x$r)\\ or
183 (known y$) or (known y$l) or (known y$r)
184 enddef;
185
186 vardef fix_virgin z = % find a pair of virgin pairs
187 numeric ii,jj; jj:=1;
188 forever:
189 if is_known z[jj] or is_known z[jj+1]: % unknown gaps may occur
190 jj:=incr jj else: jj=ii fi; exitif known ii;
191 endfor;
192 jj:=ii+1;
193 % now |ii| and |jj| are such that |z[ii]| and |z[jj]| are ``untouched''
194 enddef;
195
196 %%% italcorr corrital
197 % correction of italic correction (cf. D. E. Knuth, The \MF{}book, p. 105):
198 vardef corrital z suffix $ =
199 % |z$| is the rightmost position of a pen (in accent path)
200 if known sharp_calc:
201 if not monospace:
202 save charic_; charic_=(rt(x$)-r)/hppp+slant*y$/vppp+.5u#;
203 if charic_>charic: charic:=charic_; fi
204 fi
205 %| else: %| |charic=mono_charic#|, do nothing
206 fi
207 enddef;
208
209 %%% top prepare_pen
210 def prepare_pen suffix $ =
211 %%% fine $ %%%% temporary MFT convention
212 if $>fudged.hair: $:=fudged.hair; fi
213 $.breadth:=$;
214 pickup if $=0: nullpen else: pencircle scaled $; $:=$-eps fi;
215 $.nib:=savepen; breadth_[$.nib]:=$;
216 forsuffixes $$=lft,rt,top,bot: shiftdef($.$$,$$ 0); endfor
217 %%% qq $ %%%% ordinary MFT convention
218 enddef;
219
220 % The proportion of |vair/stem| depends drastically on resolution;
221 % e.g., for 300 dpi cmbx10 |vair=1| and |stem=5|, for 746 dpi cmbx10
222 % (300 dpi, magstep 5) |vair=4| and |stem=12|, while, sharply speaking,
223 % |stem#/vair#=3.15381|; hence a new variable |xvair| has been introduced
224 % to be used in some crucial places instead of |vair|.
225 vardef xvair = stem*vair#/stem# enddef;
226 % ---------------------------------------------------------------------------
227 % ACCENT ACCESSORIES
228 % ---------------------------------------------------------------------------
229 % |the_cap_flat| is a factor controlling the flatness of accents over
230 % majuscules; a default value may be overriden by assigning a value to the
231 % variable |cap_flat| (cf. also |the_|... macros in ogonek accessories).
232 vardef the_cap_flat =
233 if known cap_flat: cap_flat elseif serifs and hefty: 1/5 else: 1/3 fi
234 enddef;
235 % ---------------------------------------------------------------------------
236 % The |hpos_corr| variable is an optional parameter to |put_ogonek|, meant
237 % to be set locally inside |beginchar| ... |endchar|, if a horizontal
238 % correction of the accent position is needed:
239 numeric hpos_corr;
240 % ---------------------------------------------------------------------------
241 %%%% temporary MFT convention:
242 %%% top x_height diam a_wd a_ht i_ht u asc_height cap_A_wd
243 % width of the acute accent:
244 vardef a_wd@# = 9hi.u@# enddef;
245 % height of the acute accent:
246 vardef a_ht@# =
247 min(asc_height@#,2hi.x_height@#,hi.x_height@#+acc_height@#) enddef;
248 % height of the letter `i':
249 vardef i_ht@#(suffix diam) =
250 if is_small_cap: a_ht@# % usually there is no dot over a small cap `i'
251 else: min(asc_height@#, 10/7hi.x_height@#+.5diam@#) fi
252 enddef;
253 % width of the letter `A' (used in |put_ogonek|):
254 vardef cap_A_wd@# = 13u@# enddef;
255 %%%% ordinary MFT convention:
256 %%% qq x_height diam a_wd a_ht i_ht u asc_height cap_A_wd
257
258 def mark_height(expr sharp_h)=
259 % |sharp_h| is the height of an accented minuscule
260 if known sharp_calc:
261 charht:=if is_cap: h/vppp else: sharp_h fi;
262 if\\ (proofing>0) and is_cap:
263 % BJ likes to have proofs vertically aligned (somehow):
264 proofoffset(0,h-charht*vppp-1mm);
265 fi
266 fi
267 % say earlier, e.g., |is_smoke=1| if you're making `smoked' proofs
268 % and you don't like to have a rule marking the height
269 if unknown is_smoke:
270 if proofing>0: proofrule((l+w/2,charht*hppp)t_,(r+u,charht*hppp)t_); fi
271 if displaying>0: screenrule((l+w/2,charht*hppp)t_,(r+u,charht*hppp)t_); fi
272 fi
273 enddef;
274
275 def fix_acc_pairs =
276 fix_virgin z;
277 begingroup
278 % excerpt from |beginchar|:
279 save w,h; w=round(a_wd); h=round(a_ht);
280 % excerpt from |mono_adjust|:
281 if monospace:
282 save u_; numeric u_; u_:=hi.u#; save u; u#:=u_;
283 numeric expansion_faktor;
284 mono_charwd#=2 hi.letter_fit#+expansion_faktor*a_wd#;
285 hi.u:=u#*expansion_faktor*hppp;
286 w:=mono_charwd-shrink_fit-2 hi.letter_fit;
287 fi
288 % end of the excerpts
289 numeric accent_gap,mid_stem; mid_stem=2/3[stem,hi.stem];
290 if serifs:
291 pickup crisp.nib;
292 x[jj]'=hround(w-2hi.u)-.5mid_stem; x[jj]':=x[jj]'-2/3[x[jj]',w-x[jj]'];
293 y[jj]'=h-.5mid_stem+eps-max(2/3[h,hi.x_height],hi.x_height+o+hair);
294 accent_gap=a_ht-(y[jj]'+.5mid_stem)-hi.x_height;
295 bot z[ii]=round(accent_hpos,
296 accent_gap+if is_cap: cap_height else: hi.x_height fi);
297 z[jj]=z[ii]+(z[jj]'
298 if is_cap: rotated (-the_cap_flat*angle(z[jj]')) fi);
299 numeric theta; theta=angle(z[ii]-z[jj])+90;
300 pos[jj](mid_stem,theta); pos[ii](hair,theta);
301 else:
302 pickup fine.nib;
303 rt x[jj]'r=hround(.5w-1.25hi.u);
304 top y[jj]'=h-vround(2/3[h,hi.x_height]);
305 z[ii]'=origin; pos[jj]'(mid_stem,0); pos[ii]'(vair,0);
306 accent_gap=a_ht-y[jj]'-hi.x_height;
307 if is_cap:
308 numeric beta; beta=-the_cap_flat*angle(z[jj]'-z[ii]');
309 z[ii]=round(accent_hpos,accent_gap+cap_height);
310 z[jj]=z[ii]+(z[jj]' rotated beta);
311 y[jj]r=y[jj]l=y[jj]; y[ii]r=y[ii]l=y[ii];
312 for xx:=jj,ii: forsuffixes $:=l,r:
313 (z[xx]$-z[ii]) rotated -beta=whatever[z[jj]'$,z[ii]'$];
314 endfor\\ endfor
315 else:
316 for xx:=jj,ii: forsuffixes $:=r, ,l:
317 z[xx]$=z[xx]'$+round(accent_hpos,
318 accent_gap+if is_small_cap: cap_height else: x_height fi);
319 endfor\\ endfor
320 fi
321 fi
322 endgroup;
323 enddef;
324
325 def put_accent=
326 numeric accent_hpos;
327 accent_hpos=.5w - if is_cap: .75 else: .5 fi\\ u
328 if known hpos_corr: +hpos_corr fi;
329 fix_acc_pairs; % |fix_acc_pairs| uses private values of |w|, |h| \& |u|
330 numeric hpos_corr; % |hpos_corr| is local: forget its value
331 % draw the diagonal:
332 if serifs:
333 pickup crisp.nib; filldraw circ_stroke (z[jj]e--z[ii]e);
334 z[jj].right=directionpoint up of (z[jj]r{z[jj]r-z[ii]r}..{z[ii]l-z[jj]l}z[jj]l);
335 z[jj].top=directionpoint left of (z[jj]r{z[jj]r-z[ii]r}..{z[ii]l-z[jj]l}z[jj]l);
336 else:
337 pickup fine.nib; filldraw stroke (z[jj]e--z[ii]e);
338 z[jj].right=z[jj].top=z[jj]r;
339 fi
340 corrital z[jj].right; % correct italic correction
341 % adjust and save height (it is used in the program for the dotted `Z'):
342 h:=if is_cap: y[jj].top else: a_ht fi;
343 if known sharp_calc: saved_height:=h; fi
344 mark_height(a_ht#);
345 penlabels([ii],[jj]);
346 enddef;
347 % ---------------------------------------------------------------------------
348 % GRAVE ACCENT ACCESSORIES
349 % ---------------------------------------------------------------------------
350 % This section borrows heavily from the (acute) accent accessories
351 def fix_grav_pairs =
352 fix_virgin z;
353 begingroup
354 % excerpt from |beginchar|:
355 save w,h; w=round(a_wd); h=round(a_ht);
356 % excerpt from |mono_adjust|:
357 if monospace:
358 save u_; numeric u_; u_:=hi.u#; save u; u#:=u_;
359 numeric expansion_faktor;
360 mono_charwd#=2 hi.letter_fit#+expansion_faktor*a_wd#;
361 hi.u:=u#*expansion_faktor*hppp;
362 w:=mono_charwd-shrink_fit-2 hi.letter_fit;
363 fi
364 % end of the excerpts
365 numeric accent_gap,mid_stem; mid_stem=2/3[stem,hi.stem];
366 if serifs:
367 pickup crisp.nib;
368 x[jj]'=hround(w-2hi.u)-.5mid_stem; x[jj]':= -x[jj]'+ 2/3[x[jj]',w-x[jj]'];
369 y[jj]'=h-.5mid_stem+eps-max(2/3[h,hi.x_height],hi.x_height+o+hair);
370 accent_gap=a_ht-(y[jj]'+.5mid_stem)-hi.x_height;
371 bot z[ii]=round(accent_hpos,
372 accent_gap+if is_cap: cap_height else: hi.x_height fi);
373 z[jj]=z[ii]+(z[jj]'
374 if is_cap: rotated (-the_cap_flat*(angle(z[jj]')-180)) fi);
375 numeric theta; theta=angle(z[ii]-z[jj])+90;
376 pos[jj](mid_stem,theta); pos[ii](hair,theta);
377 else:
378 pickup fine.nib;
379 lft x[jj]'l=-hround(.5w-1.25hi.u);
380 top y[jj]'=h-vround(2/3[h,hi.x_height]);
381 z[ii]'=origin; pos[jj]'(mid_stem,0); pos[ii]'(vair,0);
382 accent_gap=a_ht-y[jj]'-hi.x_height;
383 if is_cap:
384 numeric beta; beta=-the_cap_flat*(angle(z[jj]'-z[ii]')-180);
385 z[ii]=round(accent_hpos,accent_gap+cap_height);
386 z[jj]=z[ii]+(z[jj]' rotated beta);
387 y[jj]r=y[jj]l=y[jj]; y[ii]r=y[ii]l=y[ii];
388 for xx:=jj,ii: forsuffixes $:=l,r:
389 (z[xx]$-z[ii]) rotated -beta=whatever[z[jj]'$,z[ii]'$];
390 endfor\\ endfor
391 else:
392 for xx:=jj,ii: forsuffixes $:=r, ,l:
393 z[xx]$=z[xx]'$+round(accent_hpos,
394 accent_gap+if is_small_cap: cap_height else: x_height fi);
395 endfor\\ endfor
396 fi
397 fi
398 endgroup;
399 enddef;
400
401 def put_gravis=
402 numeric accent_hpos;
403 accent_hpos=.5w + if is_cap: .75 else: .5 fi\\ u
404 if known hpos_corr: +hpos_corr fi;
405 fix_grav_pairs; % |fix_grav_pairs| uses private values of |w|, |h| \& |u|
406 numeric hpos_corr; % |hpos_corr| is local: forget its value
407 % draw the diagonal:
408 if serifs:
409 pickup crisp.nib; filldraw circ_stroke (z[jj]e--z[ii]e);
410 z[jj].right=directionpoint down of (z[jj]r{z[jj]r-z[ii]r}..{z[ii]l-z[jj]l}z[jj]l);
411 z[jj].top=directionpoint left of (z[jj]r{z[jj]r-z[ii]r}..{z[ii]l-z[jj]l}z[jj]l);
412 else:
413 pickup fine.nib; filldraw stroke (z[jj]e--z[ii]e);
414 z[jj].right=z[jj].top=z[jj]r;
415 fi
416 % adjust and save height (tho the height is never needed):
417 h:=if is_cap: y[jj].top else: a_ht fi;
418 if known sharp_calc: saved_height:=h; fi
419 mark_height(a_ht#);
420 penlabels([ii],[jj]);
421 enddef;
422 % ---------------------------------------------------------------------------
423 % DOT ACCENT ACCESSORIES
424 % ---------------------------------------------------------------------------
425 %%% good penkind
426 def put_dot (suffix penkind) (expr dd_) = % dot of the lowercase letter `i'
427 fix_virgin z;
428 numeric dd#; % sharp dot diameter
429 dd#=dd_; define_whole_blacker_pixels(dd);
430 % adjust height temporarily:
431 h:=vround(if is_cap: (cap_height#+1.5u#+dd#)
432 elseif (charcode=oct"273") or (charcode=oct"012"): i_ht#(dd)
433 fi\\ *hppp);
434 pickup penkind.nib; pos[jj](dd,90); pos[ii](dd,0);
435 x[jj]=x[ii]=good.x(.5w+if charcode=oct"233": .5 else: if charcode=oct"235": 0
436 else: .25 fi\\fi\\ u);
437 top y[jj]r=h+1; y[ii]=.5[y[jj]l,y[jj]r];
438 % draw the dot:
439 dot([ii],[jj]);
440 % dotted `Z' inherits the recently saved height (if known; usually the height
441 % of the accented `Z') which allows to decrease by one the number of different
442 % heights in a font; dotted `z' has the height of a lowercase `i' (exception:
443 % caps and small caps)
444 if known saved_height: h:=saved_height; fi\\ mark_height(i_ht#(dd));
445 penlabels([ii],[jj]);
446 enddef;
447 % ---------------------------------------------------------------------------
448 % L's CROSS ACCESSORIES
449 % ---------------------------------------------------------------------------
450 def put_cross(expr l_jut,r_jut) =
451 fix_virgin z;
452 numeric dd; dd=if is_cap: cap_bar else: bar fi;
453 numeric theta; theta=angle(11u#,.3[x_height#,cap_height#]);
454 pickup crisp.nib; pos[ii](dd,theta+90); pos[jj](dd,theta+90);
455 lft x[ii]r = hround(x1-l_jut)-eps;
456 rt x[jj]l = hround(x1+r_jut)+eps;
457 z[ii]-z[jj]=whatever*dir theta;
458 % |.52| is one of CM (Computer Magic) numbers appearing in many CM programs,
459 % among others in the programs for B, F, and H:
460 whatever[z[ii],z[jj]]=if not is_cap and hefty: top fi\\
461 (x1,if charcode=32: .3[x_height,asc_height-serif_drop] % tc blank sign
462 elseif charcode=147: .3x_height % tc recipe sign
463 else: .52cap_height fi\\);
464 % before drawing the stroke improve discretization:
465 save eps_;
466 eps_:=y[ii]l-good.y(y[ii]l);
467 forsuffixes $:=l, ,r: y[ii]$:=y[ii]$-eps_; endfor
468 eps_:=y[jj]r-good.y(y[jj]r);
469 forsuffixes $:=l, ,r: y[jj]$:=y[jj]$-eps_; endfor
470 filldraw stroke z[ii]e--z[jj]e; % now draw the stroke
471 corrital z[jj]l; % correct italic correction
472 penlabels([ii],[jj]);
473 enddef;
474 % ---------------------------------------------------------------------------
475 % OGONEK ACCESSORIES
476 % ---------------------------------------------------------------------------
477 % This part is admittedly sophisticated, however, a wide spectrum of
478 % different ogonek shapes is in fact to be programmed: one shape is needed
479 % for caps, another for `a' with ogonek, yet another for `e' with ogonek,
480 % as they all have different joins. Moreover, a sansserif ogonek differs
481 % significantly from a serif one, a bold ogonek from a non-bold, an ogonek
482 % for hefty fonts should still be different. And if you take into account
483 % that the basic font unit |u| may change during one session of font
484 % generation (monospace and caps-small-caps) and that a few different
485 % pens may be used to draw a single letter, you'll understand why so many
486 % |if| ... |else:| ... |fi| commands are used in the following code.
487 %
488 % Outer and inner edges of an ogonek (suffixed with |l| and |r|, resp.)
489 % are single B\`ezier segments; the outer one, a path
490 % |p=z_a..controls z_b and z_c ..z_d|
491 % is constructed as follows: given pairs |z_a|, |z_d|, angles |alpha_a|,
492 % |alpha_d| and two numbers |x_down|, |y_right|, find pairs |z_b| and |z_c|
493 % such that the path |p| has the following properties:
494 % (a) |direction p(z_a)=alpha_a|
495 % (b) |direction p(z_d)=alpha_d-180|
496 % (c) |direction p(x_down,some_y)=down|
497 % (d) |direction p(some_x,y_right)=right|
498 % The problem is solved using a ``double'' bisection method, provided
499 % that appropriate limits |z_b'|, |z_b''| and |z_c'|, |z_c''| for |z_b|
500 % and |z_c|, respectively, are given; more precisely,
501 % |z_b=|$\lambda_b$|[z_b',zb'']| and |z_c=|$\lambda_c$|[z_c',zc'']|
502 % is supposed to hold for given |z_b'|, |z_b''|, |z_c'|, |z_c''| and
503 % some $0<\lambda_b,\lambda_c<1$.
504 %
505 % The inner edge is constructed by a careful modification of the outer one.
506 %
507 % If a default behaviour of our program is not satisfying, the user may
508 % assign a value to the following ``emergency'' parameters (provided E knows
509 % what E is doing):
510 % |depth_corr|, |left_corr|, |top_breadth_corr|, |tip_breadth_corr|,
511 % |tip_xcorr|, |tip_ycorr|, |pre_angle|, |post_angle|,
512 % |pre_limit|, |post_limit|, |pre_lightness|, |post_lightness|,
513 % |pre_deflexion|, and |post_deflexion|.
514 % Any of these parameters, if known while generating a font, is used instead
515 % of a default setting. The parameters are accessed only via macros:
516 % |the_ogonek_depth#|, |the_left_pos|, |the_top_breadth_corr|,
517 % |the_tip_breadth_corr|, |the_tip_pos|,
518 % |the_pre_angle|, |the_post_angle|, |the_pre_limit|, |the_post_limit|,
519 % |the_pre_lightness|, |the_post_lightness|,
520 % |the_pre_deflexion|, and |the_post_deflexion|.
521 % There is one sharp ogonek parameter, |ogonek_pen#|; a respective pen is
522 % defined at the end of this file (and once again in POLKAP.MF after
523 % |font_setup|) and used in the files PL_DL.MF, PL_ML.MF, PL_MLK.MF.
524 % Any parameter may have its |lower| variant (see the file POLKAP.MF).
525 % ---------------------------------------------------------------------------
526 % two handy macros:
527 vardef cross_point(expr a,b) (expr c,d) =
528 save z_; pair z_; z_=whatever[a,b]; z_=whatever[c,d]; z_
529 % the crossing point of lines (not segments) |a--b| and |c--d| is returned
530 enddef;
531
532 vardef touch_time(expr p,q) = % a variant of |intersectionpoint|
533 save x_,y_; (x_,y_)=p intersectiontimes q; if x_<0: 0 else: y_ fi
534 enddef;
535 % ---------------------------------------------------------------------------
536 % the kernel routine for the ogonek:
537 numeric x_down,x_down',y_right,y_right',alpha_a,alpha_d;
538 pair z_a,z_b,z_b',z_b'',z_c,z_c',z_c'',z_d;
539
540 pair nz_,pz_;
541 % with plain's |solve| embeded calls are not allowed, hence a bit tricky
542 % variation:
543 %%% known zsolve
544 vardef zsolve@#(suffix z_)=
545 % |@#| is the name of a real monotonic function; it is assumed that
546 % |@#(z_')<=0|, |@#(z_'')>0| holds for given |z_'| and |z_''|
547 save nz_,pz_; pair nz_,pz_; % recursive calls are possible
548 nz_:=z_'; pz_:=z_'';
549 forever:
550 z_:=.5[nz_,pz_]; exitif abs(nz_-pz_)<=tolerance; % by default |tolerance=.1|
551 if @#(z_)<=0: nz_ else: pz_ fi :=z_;
552 endfor
553 % on exit |z_| is (hopefully) near the point where |@#| changes from
554 % negative to positive
555 enddef;
556
557 vardef down_dir(expr z_b)=
558 zsolve right_dir(z_c); % here |z_c| is computed
559 lft(xpart(directionpoint down of (z_a..controls z_b and z_c..z_d)))-x_down
560 enddef;
561
562 vardef right_dir(expr z_c)=
563 bot(ypart(directionpoint right of (z_a..controls z_b and z_c..z_d)))-y_right
564 enddef;
565 % ---------------------------------------------------------------------------
566 % ogonek defaults:
567 vardef the_ogonek_depth# = % sharp value
568 if known depth_corr: depth_corr* fi\\ desc_depth#
569 enddef;
570
571 vardef the_left_pos =
572 if known left_corr: left_corr* fi
573 if monospace: 3.75 elseif serifs:
574 if hefty: 2.3 elseif is_bold: 1.7 else: 1.9 fi
575 else: % sansserif
576 if is_bold: 1.65 else: 1.55 fi\\ fi\\ hi.u
577 enddef;
578
579 vardef the_tip_pos =
580 (if monospace: 1.9 elseif serifs: if hefty: 1.85
581 elseif is_bold: 1.75 else: 2 fi\\ else: % sansserif
582 if is_bold: 2.1 else: 1.95 fi\\ fi\\ hi.u,
583 if serifs:
584 if monospace: 1.25 elseif hefty: 1 elseif is_bold: .75 else: 1.45 fi
585 else: % sansserif
586 .45 fi\\ hi.u)
587 if known tip_xcorr: xscaled\\ tip_xcorr fi
588 if known tip_ycorr: yscaled\\ tip_ycorr fi
589 enddef;
590
591 vardef the_top_breadth_corr =
592 if known top_breadth_corr: top_breadth_corr else:
593 if serifs: 1 elseif is_bold: 1.12 elseif is_cap: 1.06 else: .96 fi\\ fi
594 enddef;
595
596 vardef the_tip_breadth_corr =
597 if known tip_breadth_corr: tip_breadth_corr else: 1 fi
598 enddef;
599
600 vardef the_pre_angle = % refers to the outer edge
601 if known pre_angle: pre_angle else:
602 if serifs: if hefty: 208 elseif is_bold: 211 else: 214 fi\\ else: 211 fi
603 fi
604 enddef;
605
606 vardef the_post_angle = % refers to the outer edge
607 if known post_angle: post_angle else:
608 if serifs: if monospace: 60 elseif hefty: 66 elseif is_bold: 55 else: 74 fi
609 else: 25 fi\\ fi
610 enddef;
611
612 vardef the_pre_limit = % refers to the outer edge
613 if known pre_limit: pre_limit else: x_down-3.5hi.u fi
614 enddef;
615
616 vardef the_post_limit = % refers to the outer edge
617 if known post_limit: post_limit else: x_down-2hi.u fi
618 enddef;
619
620 vardef the_pre_lightness = % refers to the inner edge
621 if known pre_lightness: pre_lightness else:
622 if serifs and hefty: .97 elseif not serifs and is_bold: .6
623 elseif is_bold: .66 else: .78 fi\\ fi
624 enddef;
625
626 vardef the_post_lightness = % refers to the inner edge
627 if known post_lightness: post_lightness else:
628 if serifs:
629 if hefty: .95 elseif is_bold: .66 else: .82 fi
630 else: % sansserif
631 .75 fi\\ fi
632 enddef;
633
634 vardef the_post_deflexion = % refers to the inner edge
635 if known post_deflexion: post_deflexion elseif serifs and hefty: 0
636 else: -5 fi
637 enddef;
638
639 vardef the_pre_deflexion = % refers to the inner edge
640 if known pre_deflexion: pre_deflexion
641 elseif known join_angle and not serifs:
642 if is_bold: -4 else: -2 fi\\
643 elseif not serifs: if is_bold: -8 else: -4 fi\\ else: 0 fi
644 enddef;
645 % ---------------------------------------------------------------------------
646 %%% fine lo
647 vardef lo suffix z = % in a way |lo| is a counterpart to |hi|
648 if is_small_cap: z_a+((z-z_a) scaled sqrt(body_height#/higher.body_height#))
649 else: z fi
650 enddef;
651 % ---------------------------------------------------------------------------
652 % parameters to |put_ogonek|:
653 numeric join_angle; % starting (inner) ogonek direction, if known
654 numeric ogonek_breadth; % ogonek breadth at the tip
655 % starting (inner for `e' with ogonek, otherwise outer) ogonek position:
656 pair ogonek_pos;
657 % ---------------------------------------------------------------------------
658 def put_ogonek(suffix penkind) =
659 begingroup
660 if monospace:
661 % excerpt from |mono_adjust|:
662 save u_; numeric u_; u_:=hi.u#; save u; u#:=u_;
663 numeric expansion_faktor;
664 mono_charwd#=2hi.letter_fit#+expansion_faktor*cap_A_wd#; % cap_A_wd=13u
665 hi.u:=u#*expansion_faktor*hppp;
666 % now |u| is like in the letter `A'
667 fi
668
669 fix_virgin z; pickup penkind.nib;
670
671 % `a' with ogonek attached to the hook deserves a special treatment:
672 if\\ (not is_small_cap) and (charcode=oct"241") and serifs and not is_bold:
673 if ypart(ogonek_pos)>.5penkind:
674 z[ii]~l=ogonek_pos;
675 pos[ii]~(max(the_top_breadth_corr*ogonek_breadth,penkind+epsilon),0);
676 ogonek_pos:=cross_point((0,.5penkind),(1,.5penkind))
677 (z[ii]~l,z[ii]~l+dir(the_pre_angle));
678 fi
679 fi
680
681 % similarly, `e' with ogonek deserves a special treatment:
682 if\\ (not is_small_cap) and (charcode=oct"246"):
683 if ypart(ogonek_pos)>.5penkind:
684 z[ii]~r=ogonek_pos;
685 pos[ii]~(max(the_top_breadth_corr*ogonek_breadth,penkind+epsilon),0);
686 ogonek_pos:=cross_point((0,.5penkind),(1,.5penkind))
687 (z[ii]~l,z[ii]~l+dir(join_angle));
688 fi
689 fi
690
691 % invariant: |ypart(ogonek_pos)|$\le$|.5penkind|;
692 % moreover, for `A' and `E': |ypart(ogonek_pos)=.5penkind|
693
694 % OUTER EDGE:
695 alpha_a:=the_pre_angle; % starting direction
696 alpha_d:=180+the_post_angle; % ending direction
697 x_down:=if serifs: hround else: ceiling fi
698 (xpart(ogonek_pos)-the_left_pos); % left bound
699 y_right:=-vround(d+hi.o); % bottom bound
700 z_a:=(x_down+the_left_pos,ypart(ogonek_pos)); % starting point
701 z_d:=(xpart(z_a)-.5penkind,y_right+ypart(ogonek_pos))+
702 the_tip_pos; % ending point
703 % guess the boundaries for control points:
704 z_b':=cross_point (z_a,z_a+dir alpha_a)
705 ((the_pre_limit,0),(the_pre_limit,1));
706 z_b'':=cross_point (z_b',z_a)\\ ((x_down,0),(x_down,1));
707 z_c':=cross_point (z_d,z_d+dir alpha_d)
708 ((the_post_limit,0),(the_post_limit,1));
709 z_c'':=cross_point (z_c',z_d)\\ ((0,y_right),(1,y_right));
710 % THE PIVOT STEP OF THE OGONEK PROCEDURE, i.e.,
711 % determine the control points (|z_b| and |z_c|) of the outer path:
712 zsolve down_dir(z_b); % |down_dir| calls `|zsolve right_dir(z_c)|'
713 x_down':=xpart(lft(directionpoint down of
714 (z_a..controls z_b and z_c..z_d)));
715 y_right':=ypart(bot(directionpoint right of
716 (z_a..controls z_b and z_c..z_d)));
717 if abs(x_down'-x_down,y_right'-y_right)>sqrt2:
718 message "ERROR: `ogonek' iteration hasn't converged! Final values:";
719 message "x_down="&decimal x_down'&" (should be "&decimal x_down&")";
720 message "y_right="&decimal y_right'&" (should be "&decimal y_right&")";
721 errhelp "Maybe Jackowski knows how to change them...";
722 errmessage "Probably, you have to change somehow the boundary values";
723 fi
724
725 % small caps have ogoneks a bit smaller:
726 z[ii]l=z_a; z[ii]'l=lo.z_b; z[jj]'l=lo.z_c; z[jj]l=lo.z_d;
727
728 % INNER EDGE:
729 pos[ii](max(the_top_breadth_corr*ogonek_breadth,penkind+epsilon),0);
730 pos[jj](max(the_tip_breadth_corr*ogonek_breadth,penkind+epsilon),
731 angle(direction 1 of (z_a..controls z_b and z_c..z_d))+
732 if serifs: 90 else: 80 fi);
733
734 z[ii]'r=z[ii]r+((z[ii]'l-z[ii]l) scaled the_pre_lightness
735 rotated the_pre_deflexion);
736 z[jj]'r=z[jj]r+((z[jj]'l-z[jj]l) scaled the_post_lightness
737 rotated the_post_deflexion);
738
739 % trim the top of the ogonek, if necessary:
740 path ogonek.l, ogonek.r; numeric tt.r, tt.l;
741
742 ogonek.l=if is_known z[ii]~: % minuscule with ogonek
743 z[ii]~l{dir if charcode=oct"241": the_pre_angle else: join_angle fi}..fi
744 z[ii]l..controls z[ii]'l and z[jj]'l..z[jj]l;
745 ogonek.r=if is_known z[ii]~: % ditto
746 z[ii]~r{dir if charcode=oct"241": the_pre_angle else: join_angle fi}..fi
747 z[ii]r..controls z[ii]'r and z[jj]'r..z[jj]r;
748
749 tt.r=if serifs and (not is_small_cap) and (charcode=oct"241"):
750 touch_time(p.l,ogonek.r) else: 0 fi;
751 tt.l=if\\ (not is_small_cap) and (charcode=oct"246"):
752 touch_time(p.r,ogonek.l) else: 0 fi;
753 % at last, draw the ogonek:
754 if ogonek_breadth>.5:
755 interim turningcheck:=0; filldraw
756 if\\ (not is_small_cap) and (charcode=oct"246"):
757 (point tt.r of ogonek.r){direction tt.r of ogonek.r}..{curl 1} fi
758 subpath (tt.l,length ogonek.l) of ogonek.l--
759 reverse(subpath (tt.r,length ogonek.r) of ogonek.r)
760 if is_small_cap or (charcode<>oct"246"): -- else: & fi\\ cycle;
761 % the |draw| command covers with ink unwanted breaks:
762 pickup pensquare scaled (.5*sqrt2) rotated 45;
763 draw .5[z[ii]l,z[ii]r]..controls .5[z[ii]'l,z[ii]'r] and
764 .5[z[jj]'l,z[jj]'r].. .5[z[jj]l,z[jj]r];
765 else: % poor resolution:
766 pickup pensquare scaled (.5*sqrt2) rotated 45;
767 draw z[ii]l..controls z[ii]'l and z[jj]'l..z[jj]l;
768 fi
769
770 numeric join_angle, ogonek_breadth; pair ogonek_pos; % all they are local
771
772 penlabels([ii],[jj]);
773
774 endgroup
775 enddef;
776 %*******************************************************************************
777 %
778 % This was csaccent.mf in text format, as of 89/05/08
779 % written by P. Novak, Prague
780 % Czech and Slovak letters with accents
781 % Changed paths for acute and hachek accent added 26/04/92, 11/08/92
782 % Accent definitions |lc_circle_accent| modified
783 % |uc_Circle_accent| added for Duerer font
784 %
785 % 7 May 1995 did whole sale surgery to this part. Moved parameters to
786 % dxpseudo.mf to be able to manipulate them from there. The Acute
787 % accent is done the polish way, therefore removed all acute related
788 % macros. Pseudoparametrised all kinds of |dot_diam|.
789 % 17 Jun 1995 adjusted hachek height parameters to blend better with acute
790 % parameters. Removed lots of stuff not used by the dc and tc fonts.
791 % 17 Jul 1995 corrected uppercase hachek height for sans serif case
792 % Removed many macros, which aren't used anymore
793 % 23 Aug 1996 Adjusted |lc_hachek_accent| for dcsx font
794 % 23 Dec 1996 Done provisions for small caps fonts, consequently
795 % applied |hi.|, replaced |curve| by |cap_curve| for |uc_hachek_accent|,
796 % adjusted numeric factors to the usually higher value of |cap_curve|.
797 % 19 Jan 1997 The |uc_hacheck_accent| comes out too high, because of
798 % unwanted white space above it. Changed appropriately.
799 % 26 May 1997 Adjusted |lc_hachek_accent| for CM Bright (CMBR).
800 %===============================================================================
801
802 def lc_hachek_accent(expr ref) =
803 if serifs:
804 pickup crisp.nib;
805 pos52'(0.75[vair,curve],90);
806 pos52(0.75[vair,curve],90);
807 x52=good.x ref;
808 x52-x51=x53-x52=good.x if hach_sharp:2.5 else:3 fi
809 accent_u-accent_thin;
810 top y52' = top y51 = top y53 = lc_hachek_height;
811 if hach_sharp:
812 y52=max(2/3[h,hi.x_height],hi.x_height+o+hair); % lower point
813 pos51(1.5stem,0); pos53(accent_thin,180);
814 else:
815 0.5[y52,y52r] = 0.5[hi.x_height,y52'];
816 pos51(accent_thin,angle(z52-z51)+90);
817 pos53(accent_thin,angle(z53-z52)+90);
818 fi
819 filldraw stroke z51e -- z52e -- z53e;
820 else:
821 pickup fine.nib;
822 pos51(vair,0);
823 pos53(vair,0);
824 x52=good.x ref;
825 x52-lft x51=rt x53-x52= hround(1.25accent_u + vair);
826 pos52(stem,0);
827 bot y52=vround(0.33[x_height,lc_hachek_height]);% (CMBR)
828 % bot y52=vround(max(2/3[h,hi.x_height],hi.x_height+o+hair));
829 top y51 = top y53 = lc_hachek_height;
830 z50 = whatever[z51r,z52r] = whatever[z52l,z53l];
831 y54l=y54r=y52;
832 x54l=good.x .2[x52l,x52];
833 x54r-x52 = x52-x54l;
834 filldraw z54l -- z51l-- z51r -- z50 -- z53l -- z53r -- z54r -- cycle;
835 fi
836 penlabels(50,51,52,52',53,54);
837 enddef;
838
839 def dtl_hachek(text x_ref,y_ref) =
840 pickup fine.nib;
841 pickup fine.nib;
842 x51=hround(x_ref); y51=vround(y_ref);
843 comma(51,q,pdot_diam,.25accent_u,2/3comma_depth);
844 penlabels(51);
845 enddef;
846
847 def uc_hachek_accent(expr ref) =
848 if serifs:
849 pickup crisp.nib;
850 pos52'(0.5[vair,cap_curve],90);
851 pos52(0.5[vair,cap_curve],90);
852 x52=good.x ref;
853 x52-x51=x53-x52=good.x 3accent_u-accent_thin;
854 top y52' = top y51 = top y53 = % upper points
855 uc_acc_height-.5[vair,cap_curve]+eps
856 -max(2/3[uc_acc_height,hi.x_height],hi.x_height+o+hair)+cap_height;
857 if hach_sharp:
858 y52=max(2/3[uc_acc_height,hi.x_height],hi.x_height+o+hair)
859 -hi.x_height+cap_height; % lower point
860 pos51(cap_stem,0); pos53(2accent_thin,180);
861 else:
862 0.5[y52,y52r] =
863 if not hefty:
864 max(2/3[uc_acc_height,hi.x_height],hi.x_height+o+hair)
865 -hi.x_height+cap_height;
866 else:
867 max(2/3[uc_acc_height,hi.x_height],hi.x_height+o)
868 -hi.x_height+cap_height-hair;
869 fi
870 pos51(accent_thin,angle(z52-z51)+90);
871 pos53(accent_thin,angle(z53-z52)+90);
872 fi
873 filldraw stroke z51e -- z52e -- z53e;
874 else:
875 pickup fine.nib;
876 pos51(vair,0);
877 pos53(vair,0);
878 x52=good.x ref;
879 x52-x51=x53-x52= 1.75accent_u + .5vair;
880 pos52(cap_stem,0);
881 bot y52= cap_height + .5 accent_gap;
882 top y51 = top y53 = cap_height + acc_height;
883 z50 = whatever[z51r,z52r] = whatever[z52l,z53l];
884 y54l=y54r=y52;
885 x54l=good.x .2[x52l,x52];
886 x54r-x52 = x52-x54l;
887 filldraw z54l -- z51l-- z51r -- z50 -- z53l -- z53r -- z54r -- cycle;
888 fi
889 penlabels(50,51,52,52',53,54);
890 enddef;
891
892 endinput;
893 %%