%% %% This is file `unibase.mf', %% generated with the docstrip utility. %% %% The original source files were: %% %% uni.dtx (with options: `unibase') %% %% Copyright (C) 1998 Christian Holm. %% %% This file is NOT the source for universal, because almost all %% comments have been stripped from it. It is NOT the preferred %% form of universal for making modifications to it. %% %% Therefore you can NOT redistribute and/or modify THIS file. %% You can however redistribute the complete source (uni.dtx %% and uni.ins) 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. %% %% The universal font and package 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 package; if not, write to the %% Free Software Foundation, Inc., %% 675 Mass Ave, Cambridge, %% MA 02139, USA. %% %% See the file uni.dtx for further comments and documentation. %% unibase := 1 ; string univer ; univer = "2.0" ; if proofing > 1 : message "Base file for font `universal', version " & univer ; fi boolean medium , slant , bold , caps , strict ; medium := false ; slant := false ; bold := false ; caps := false ; strict := false ; font_identifier:="universal"; def start_font(expr size) = u# := size/18 ; mode_setup; x_h# := 8u# ; x_w# := 8u# ; m_w# := 11u# ; l_h# := 13u# ; p_d# := 5u# ; l_s# := 2u# ; r_s# := 2u# ; A_w# := 10u# ; M_w# := 14u# ; c_d# := 3u#/2 ; C_d# := 2u# ; if (medium and bold) : message "Font can't be both medium and bold, making medium font." ; medium := true ; fi; if medium : p_t# := 2u#/3 ; P_t# := u# ; P_T# := u# ; fi ; if bold : P_T# := 3u#/2 ; p_t# := 3u#/2 ; P_t# := 2u# ; fi ; a_h# := x_h#+p_t#/2 ; if (slant and (caps or strict)) : double_shape := 1 ; fi ; if (caps and (slant or strict)) : double_shape := 1 ; fi ; if (strict and (caps or slant)) : double_shape := 1 ; fi ; if known double_shape : message "Font cannot be two shapes, doing upright shape." ; slant := false ; caps := false ; strict := false ; fi ; if slant : slantratio := 1/6 ; else: slantratio := 0 ; fi ; currenttransform := identity slanted slantratio ; font_x_height 8u# ; font_quad 12u#+2u# ; font_normal_space 8u# ; font_normal_stretch 3u# ; font_normal_shrink 2u# ; font_extra_space 2u# ; font_coding_scheme:="TeX text" ; font_size 18u# ; spanish_shriek:=hex"3C" ; spanish_query:=hex"3E"; define_pixels(u,x_h,x_w,m_w,l_h,p_d,A_w,M_w,c_d,C_d,a_h); define_blacker_pixels(p_t,P_t,P_T); picture e_pic, a_pic ; do_pens ; extra_beginchar := extra_beginchar&"fit_font;" ; extra_endchar := extra_endchar& "end_fit_font;extra_proof_rules;charcode:=charcode+code_offset;" ; code_offset := 0 ; enddef; def do_pens = clear_pen_memory ; pickup pencircle scaled P_T slanted slantratio ; UniPencir := savepen ; pickup pencircle scaled p_t slanted slantratio ; unipencir := savepen ; pickup pencircle scaled P_t slanted slantratio ; Unipencir := savepen ; pickup pensquare scaled P_T slanted slantratio ; UniPensqu := savepen ; pickup pensquare scaled p_t slanted slantratio ; unipensqu := savepen ; pickup pensquare scaled P_t slanted slantratio ; Unipensqu := savepen ; enddef ; def fit_font = l := -hround(l_s#*hppp) ; interim xoffset := -l ; charwd := charwd+l_s#+r_s# ; r := l+hround(charwd*hppp) ; w := r-hround(r_s#*hppp) ; italcorr charht*slantratio ; enddef; def end_fit_font = w := r+l ; enddef; def extra_proof_rules = if proofing > 1 : for xa = l,r,w/2: proofrule((xa,-d), (xa,h)) ; endfor ; for ya = 0,h/4,h/2,3h/4,h: proofrule((l,ya), (r,ya)) ; endfor ; if d > 0 : proofrule((l,-d/2), (r,-d/2)) ; proofrule((l,-d), (r,-d)) ; fi fi enddef ; inner bye; % so we can use it inside a macro def end_font = ligtable "u" : "h" kern u# ; ligtable "f" : "f" kern 0 , "l" kern 0 , "i" kern 0 ; ligtable "o" : "l" kern u# ; ligtable "?" : "`" =: spanish_query ; ligtable "!" : "`" =: spanish_shriek ; ligtable "`" : "`" kern -l_s#-r_s#+p_t# ; ligtable "'" : "'" kern -l_s#-r_s#+p_t# , "?" kern 2u#, "!" kern 2u# ; ligtable "-" : "-" =: hex"7B" ; ligtable hex"7B" : "-" =: hex"7C" ; ligtable hex"22" : hex"22" kern -l_s#-r_s# ; ligtable hex"5C" : hex"5C" kern -l_s#-r_s# ; ligtable hex"20" : "l" kern -3c_d#*cosd(15)-p_t#*sind(15)-l_s#-r_s# , "L" kern -3c_d#*cosd(15)-p_t#*sind(15)-l_s#-r_s# ; bye enddef; def do_caps(expr offset) = sc_shrink := x_h#/l_h# ; P_t# := sc_shrink*P_t# ; l_h# := sc_shrink*l_h# ; A_w# := sc_shrink*A_w# ; M_w# := sc_shrink*M_w# ; C_d# := sc_shrink*C_d# ; code_offset := offset ; define_pixels(l_h,A_w,M_w,C_d) ; define_blacker_pixels(P_t) ; do_pens ; enddef ; def end_do_caps = no_shrink := 1/sc_shrink ; P_t# := no_shrink*P_t# ; l_h# := no_shrink*l_h# ; A_w# := no_shrink*A_w# ; M_w# := no_shrink*M_w# ; C_d# := no_shrink*C_d# ; code_offset := 0 ; define_pixels(l_h,A_w,M_w,C_d) ; define_blacker_pixels(P_t) ; do_pens ; enddef ; def no_adjust= old_begin_adjust := extra_beginchar ; old_end_adjust := extra_endchar ; extra_beginchar := " " ; extra_endchar := "extra_proof_rules;charcode:=charcode+code_offset" ; enddef; def restore_adjust= extra_beginchar := old_begin_adjust ; extra_endchar := old_end_adjust ; enddef; string old_begin_adjust, old_end_adjust ; def unicir(expr rad, thick, center, m)= pickup pensquare scaled thick; top z[m] = (0,rad) + center ; penpos[m](thick,90) ; lft z[m+1] = (-rad,0) + center ; penpos[m+1](thick,180) ; bot z[m+2] = (0,-rad) + center ; penpos[m+2](thick,270) ; rt z[m+3] = (rad,0) + center ; penpos[m+3](thick,0) ; penstroke z[m]e{left}..z[m+1]e{down}.. z[m+2]e{right}..z[m+3]e{up}..cycle ; penlabels(range m thru m+3); enddef; def uniarc(expr rad, thick, center, ang_a, ang_b, m)= pickup pensquare scaled thick ; path arc.l, arc.r, arc.e ; n:=m ; ang_c := abs(ang_b-ang_a) ; if ang_c >= 360 : unicir(rad,center,n) ; else: top z[n] = (0,rad) + center ; penpos[n](thick,90) ; arc.r := z[n]r{left} ; arc.l := z[n]l{left} ; if ang_c > 90 : n := n+1 ; lft z[n] = (-rad,0) + center ; penpos[n](thick,180) ; arc.r := arc.r&z[n-1]r..z[n]r{down} ; arc.l := arc.l&z[n-1]l..z[n]l{down} ; if ang_c > 180 : n := n+1 ; bot z[n] = (0,-rad) + center ; penpos[n](thick,270) ; arc.r := arc.r&z[n-1]r..z[n]r{right} ; arc.l := arc.l&z[n-1]l..z[n]l{right} ; if ang_c > 270 : n := n+1 ; rt z[n] = (rad,0) + center ; penpos[n](thick,0) ; arc.r := arc.r&z[n-1]r..z[n]r{up} ; arc.l := arc.l&z[n-1]l..z[n]l{up} ; fi ; fi ; fi ; n:=n+1 ; z[n] = z[m] rotatedabout(center,ang_c) ; penpos[n](thick,90+ang_c) ; arc.r := arc.r&z[n-1]r..z[n]r{dir(180+ang_c)} ; arc.l := arc.l&z[n-1]l..z[n]l{dir(180+ang_c)} ; arc.e := arc.l--reverse arc.r--cycle; fill (arc.e rotatedabout(center,-90+ang_a)); fi; penlabels(range m thru n); enddef; def uniend(expr rad, center, ang_a, ang_b, m)= path arc ; n:=m ; ang_c := abs(ang_b-ang_a) ; if ang_c >= 360 : Rad := 2*rad ; pickup pencircle scaled Rad ; z[n]=center ; drawdot z[n] ; else: z[n] = (0,rad) + center ; arc := center{up}--z[n]{left} ; if ang_c > 90 : n := n+1 ; z[n] = (-rad,0) + center ; arc := arc&z[n-1]..z[n]{down} ; if ang_c > 180 : n := n+1 ; z[n] = (0,-rad) + center ; arc := arc&z[n-1]..z[n]{right} ; if ang_c > 270 : n := n+1 ; z[n] = (rad,0) + center ; arc := arc&z[n-1]..z[n]{up} ; fi ; fi ; fi ; n := n+1 ; z[n] = z[m] rotatedabout(center,ang_c) ; arc := arc&z[n-1]..z[n]{dir(180+ang_c)}--cycle ; fill (arc rotatedabout(center,-90+ang_a)); fi; penlabels(range m thru n); enddef; def unilne(expr thick, start, stop, endcutstart, endcutstop, m)= pickup pensquare scaled thick; if endcutstart = endcutstop : if endcutstart = 0 : lft bot z[m] = start ; rt top z[m+1] = stop ; ang_c := angle(z[m+1]-z[m]) ; penpos[m](thick,-90+ang_c) ; penpos[m+1](thick,-90+ang_c) ; elseif endcutstart > 0 : lft z[m] = start ; rt z[m+1] = stop ; ang_c := angle(z[m+1]-z[m]) ; penpos[m](thick/sind(ang_c),0) ; penpos[m+1](thick/sind(ang_c),0) ; elseif endcutstart < 0: bot z[m] = start ; top z[m+1] = stop ; ang_c := angle(z[m+1]-z[m]) ; penpos[m](thick/cosd(ang_c),90) ; penpos[m+1](thick/cosd(ang_c),90) ; fi; penstroke z[m]e--z[m+1]e ; else : message "Different endcuts on unilne not implemented yet."; fi; n := m + 1 ; penlabels(range m thru n); enddef; \endinput %% %% End of file `unibase.mf'.