%% Recent History % May 29th 1995 order of variant and shape made consistent! % in fake oblique section % %% Various changes to distributed fontinst by %% %% Alan Jeffrey (11/94) %% Sebastian Rahtz (3/95) %% Constantin Kahn (3/95) %% Sebastian Rahtz (4/95) %% Sebastian Rahtz (5/95) %% %% Changes 19/3/95 by CK: %% %% (1) \latinfamily now always generates an 8r.fd file %% %% (2) font faking code for \latinfamily is revised so that it creates %% `ligfull' 8r-encoded fonts with the help of the \installrawfont %% command (new) %% %% (3) \installrawfont is implemented as a clone of \installfont %% %% (4) \declareencoding for 8r.etx %% %% (5) \NOFILES revised %% \catcode`\ =9 \catcode`\^^M=9 \catcode`\@=11 \catcode`\_=11 \catcode`\~=10 \newif\if_expert_ \newif\if_fake_narrow_ \_fake_narrow_false %%%%%%%%%%%%%%% DEBUGGING %%%%%%%%%%%%%%% % % \NOFILES switches off file generation, and causes fontinst only to % generate empty files. % (CK) revised \NOFILES: contains \installrawfont and fixes \installfont % entry \def\NOFILES{ \def\transformfont##1##2{ \touch_file{##1.pl} \touch_file{##1.mtx} } \def\installfonts{} \def\endinstallfonts{} \def\installfont##1##2##3##4##5##6##7##8{% \touch_file{##1.vpl} } \def\installrawfont##1##2##3##4##5##6##7##8{% \touch_file{##1.pl} } \def\installfamily##1##2##3{ \touch_file{##1##2.fd} } } \def\touch_file#1{ \open_out{#1} \out_line{\percent_char~TEST~FILE.} \out_line{\percent_char~Created~whilst~debugging~fontinst.} \close_out{Test~file} } %------------------------------------------------------ % hacks by SPQR 15.6.94 to get the 35 alive % % any of db, sb or b will do for b % \substitutesilent{b}{db} \substitutesilent{b}{sb} % % bx and b are interchangeable % \substitutesilent{bx}{b} \substitutesilent{b}{bx} % % `l' will do for `m'; if we have both it creates a mess... % ie in Helvetica \substitutesilent{m}{l} \substitutesilent{l}{m} % % sl and it are interchangeable % \substitutesilent{sl}{it} \substitutesilent{it}{sl} % % what is nc??? \substitutesilent{sc}{nc} % if you can't find ui use it \substitutenoisy{ui}{it} %------------------------------------------------------------ %%%%%%%%%%%%%%% LATIN FAMILIES %%%%%%%%%%%%%%% % % The macro: % % \latinfamily{FAMILY}{COMMANDS} % % installs a Latin font family. % \latinfamily{FAMILY}{COMMANDS} % (CK) \latinfamily is changed to generate an 8r.fd file in case we % are doing ligfull 8r installations \def\latinfamily#1#2{ \edef\temp_command{#1} \expandafter\parse_family\temp_command \empty_command\empty_command\end_parse_family \installfonts \installfamily{T1}{#1}{#2} \installfamily{OT1}{#1}{#2} \if_file_exists{ \raw_encoding.mtx }\then \installfamily{\raw_encoding}{#1}{#2} \fi \latin_weights \endinstallfonts } % \parse_family FAMILY\end_parse_family \def\parse_family #1#2#3#4#5\end_parse_family{ \edef\font_family{#1#2#3} \edef\font_variant{#4#5} \edef\raw_variant{#4#5} \edef\latex_family{#1#2#3#4#5} % % SPQR 2/95. If the fourth parameter is x or 9, then its an % expert indication, not a variant. so initialy set \raw_variant % to #4, but unset it if the expert test succeeds. When #4 is used % for a real variant, it passes through. % % SPQR 5/95. If it *is* an expert font, then the variantness % is expressed by the encoding, not a variant letter, so % unset font_variant % \_expert_false \ifx#4x \_expert_true \edef\raw_variant{} \edef\font_variant{#5} \setcommand\digit##1{##1} \else\ifx#49 \_expert_true \edef\raw_variant{} \edef\font_variant{#5} \setcommand\digit##1{##1oldstyle} \else \_expert_false \setcommand\digit##1{##1} \fi\fi \if_expert_ \immediate\write16{DBG>~parse~(expert)~#1,~#2,~#3,~#4,~#5} \else \immediate\write16{DBG>~parse~#1,~#2,~#3,~#4,~#5} \fi } % \latin_weight{FONTWEIGHT}{LATEXWEIGHT} \def\latin_weight#1#2{ \gdef\font_weight{#1}% \gdef\latex_weight{#2}% \latin_widths } % \latin_width{FONTWIDTH}{LATEXWIDTH} \def\latin_width#1#2{ \gdef\font_width{#1} \gdef\latex_width{#2} \latin_shapes } \def\fakenarrow#1{ \_fake_narrow_true \gdef\fake_narrow_width{#1} } % \latin_shape{FONTSHAPE}{RAWSHAPE}{ENCODINGSHAPE}{LATEXSHAPE} \def\latin_shape#1#2#3#4{ \gdef\font_shape{#1} \gdef\raw_shape{#2} \gdef\encoding_shape{#3} \gdef\latex_shape{#4} \immediate\write16{DBG>to~make~#1/#2/#3/#4,~look~for~\font_family\font_weight \raw_shape\raw_variant\raw_encoding\font_width} % Call fake_width before fake_shape so that narrow oblique will be % created from normal oblique rather than narrow roman. \csname fake_width_\font_width\endcsname \csname fake_shape_\raw_shape\endcsname \if_file_exists{ \font_family\font_weight\raw_shape \raw_variant\raw_encoding\font_width.mtx }\then \immediate\write16{DBG>~found~\font_family\font_weight \raw_shape\raw_variant\raw_encoding\font_width.mtx} \latin_encodings \fi } % (CK) changed font faking code; based on Sebastian code (still in this file). % I am not sure that know what I am doing here; let's hope I won't be % caught... Also changed: Order of \font_width and \..._encoding in MANY % places. Also added tests which prevent multiple calls to the same font % faking routine. (Seems to be necessary in some cases and can't hurt.) \def\fake_shape_{ \if_file_exists{ \font_family\font_weight\raw_shape\raw_variant \adobe_encoding\font_width.afm }\then \if_file_exists{ \font_family\font_weight\raw_shape\raw_variant \raw_encoding\font_width.mtx }\then % no action required \else \transformfont{ \font_family\font_weight\raw_shape\raw_variant \raw_encoding\font_width }{ \reencodefont{\raw_encoding}{ \fromafm{ \font_family\font_weight\raw_shape\raw_variant \adobe_encoding\font_width } } } %%% Do a ligfull installation if possible \if_file_exists{ \raw_encoding.mtx }\then \installrawfont{ \font_family\font_weight\raw_shape\raw_variant \raw_encoding\font_width }{ \font_family\font_weight\raw_shape\raw_variant \raw_encoding\font_width, \raw_encoding }{ \raw_encoding }{ \raw_encoding }{ \latex_family }{ \latex_weight\latex_width }{ \latex_shape }{} \fi %%% End of ligfull installation \fi \fi \if_expert_ \if_file_exists{ \font_family\font_weight\raw_variant\raw_shape \expert_encoding\font_width.afm }\then \if_file_exists{ \font_family\font_weight\raw_variant\raw_shape \expert_encoding\font_width.mtx }\then % no action required \else \def\_file_name{ \font_family\font_weight\raw_variant\raw_shape \expert_encoding\font_width } \afmtomtx\_file_name\_file_name \mtxtopl\_file_name\_file_name \fi \fi \fi } \def\fake_shape_c{ \if_file_exists{ \font_family\font_weight\raw_shape\raw_variant \adobe_encoding\font_width.afm }\then \fake_shape_ \else % If real smallcaps font doesn't exist, fake it from the roman. \def\encoding_shape{c} \def\raw_shape{} \fake_shape_ \fi } \def\fake_shape_o{ \if_file_exists{ \font_family\font_weight\raw_shape\raw_variant \adobe_encoding\font_width.afm }\then \fake_shape_ \else \fake_shape_o_raw_encoding \if_expert_ \fake_shape_o_expert_encoding \fi \fi } \def\fake_shape_o_expert_encoding{ \if_file_exists{ \font_family\font_weight\raw_variant \expert_encoding\font_width.mtx }\then \if_file_exists{ \font_family\font_weight\raw_variant\font_shape \expert_encoding\font_width.mtx }\then % no action required \else \immediate\write16{ Faking~oblique~font~ \font_family\font_weight\raw_variant\font_shape \expert_encoding\font_width \space from~ \font_family\font_weight\raw_variant \expert_encoding\font_width } \transformfont{ \font_family\font_weight\raw_variant\font_shape \expert_encoding\font_width }{ \slantfont{167}{ \frommtx{ \font_family\font_weight\raw_variant \expert_encoding\font_width } } } \fi \fi } \def\fake_shape_o_raw_encoding{ \if_file_exists{ \font_family\font_weight\raw_variant \raw_encoding\font_width.mtx }\then \if_file_exists{ \font_family\font_weight\font_shape\raw_variant \raw_encoding\font_width.mtx }\then % no action required \else \immediate\write16{ Faking~oblique~font~ \font_family\font_weight\font_shape\raw_variant \raw_encoding\font_width \space from~ \font_family\font_weight\raw_variant \raw_encoding\font_width } \transformfont{ \font_family\font_weight\font_shape\raw_variant \raw_encoding\font_width }{ \slantfont{167}{ \frommtx{ \font_family\font_weight\raw_variant \raw_encoding\font_width } } } %%% Do a ligfull installation if possible \if_file_exists{ \raw_encoding.mtx }\then \installrawfont{ \font_family\font_weight\font_shape\raw_variant \raw_encoding\font_width }{ \font_family\font_weight\font_shape\raw_variant \raw_encoding\font_width, \raw_encoding }{ \raw_encoding }{ \raw_encoding }{ \latex_family }{ \latex_weight\latex_width }{ \latex_shape }{} \fi %%% End of ligfull installation \fi \fi } \let\fake_shape_i\fake_shape_ % We must do this again! \def\fake_width_{} \def\fake_width_n{ \if_fake_narrow_ \if_file_exists{ \font_family\font_weight\raw_shape\raw_variant \adobe_encoding\font_width.afm }\then % no action required \else \fake_width_n_raw_encoding \if_expert_ \fake_width_n_expert_encoding \fi \fi \fi } \def\fake_width_n_expert_encoding{ \if_file_exists{ \font_family\font_weight\raw_variant\font_shape \expert_encoding.mtx }\then \if_file_exists{ \font_family\font_weight\raw_variant\font_shape \expert_encoding\font_width.mtx }\then % no action required \else \immediate\write16{ Faking~narrow~font~ \font_family\font_weight\raw_variant\font_shape \expert_encoding\font_width \space from~ \font_family\font_weight\raw_variant\font_shape \expert_encoding } \transformfont{ \font_family\font_weight\raw_variant\font_shape \expert_encoding\font_width }{ \xscalefont{\fake_narrow_width}{ \frommtx{ \font_family\font_weight\raw_variant\font_shape \expert_encoding } } } \fi \fi } \def\fake_width_n_raw_encoding{ \if_file_exists{ \font_family\font_weight\font_shape\raw_variant \raw_encoding.mtx }\then \if_file_exists{ \font_family\font_weight\font_shape\raw_variant \raw_encoding\font_width.mtx }\then % no action required \else \immediate\write16{ Faking~narrow~font~ \font_family\font_weight\font_shape\raw_variant \raw_encoding\font_width \space from~ \font_family\font_weight\font_shape\raw_variant \raw_encoding } \transformfont{ \font_family\font_weight\font_shape\raw_variant \raw_encoding\font_width }{ \xscalefont{\fake_narrow_width}{ \frommtx{ \font_family\font_weight\font_shape\raw_variant \raw_encoding } } } %%% Do a ligfull installation if possible \if_file_exists{ \raw_encoding.mtx }\then \installrawfont{ \font_family\font_weight\font_shape\raw_variant \raw_encoding\font_width }{ \font_family\font_weight\font_shape\raw_variant \raw_encoding\font_width, \raw_encoding }{ \raw_encoding }{ \raw_encoding }{ \latex_family }{ \latex_weight\latex_width }{ \latex_shape }{} \fi %%% End of ligfull installation \fi \fi } % \latin_encoding{FONTENCODING}{LATEXENCODING}{EXPERTISEDENCODING} % if this is an expertised family, the base font changes encoding % \def\latin_encoding#1#2#3{ \gdef\latex_encoding{#2} \if_expert_ \gdef\font_encoding{#3} \else \gdef\font_encoding{#1} \fi \gdef\expert_font{} \if_expert_ \if_file_exists{ \font_family\font_weight\raw_shape\raw_variant \expert_encoding\font_width.mtx }\then \gdef\expert_font{ \font_family\font_weight\raw_variant\raw_shape \expert_encoding\font_width, } \fi \fi \installfont{ \font_family\font_weight\font_shape\font_variant \font_encoding\font_width }{ \font_family\font_weight\raw_shape\raw_variant \raw_encoding\font_width, \expert_font latin }{ \latex_encoding\encoding_shape }{ \latex_encoding }{ \latex_family }{ \latex_weight\latex_width }{ \latex_shape }{} } % The standard values. These may be changed, but you'd better know % what you're doing. \def\latin_weights{ \latin_weight{b}{b} \latin_weight{d}{db} %SPQR was {d}{sb} \latin_weight{i}{el} \latin_weight{l}{l} \latin_weight{s}{sb} \latin_weight{k}{m} \latin_weight{m}{m} \latin_weight{r}{m} \latin_weight{x}{eb} \latin_weight{u}{ub} } \def\latin_widths{ \latin_width{}{} \latin_width{n}{c} % \latin_width{c}{sc} % sc is a shape, not a width --DLH } \def\latin_shapes{ \latin_shape{} {} {} {n} % normal \latin_shape{c}{c}{} {sc} % small caps --DLH \latin_shape{o}{o}{} {sl} % slanted \latin_shape{i}{i}{i}{it} % italic } \def\latin_encodings{ \latin_encoding{7t}{OT1}{9t} \latin_encoding{8t}{T1}{9e} } \def\raw_encoding{8r} \def\adobe_encoding{8a} \def\expert_encoding{8x} % (CK) Implementation of the \installrawfont command; this should really % share more code with the existing commands. % \installrawfont (based on \installfont) \def\installrawfont#1#2#3#4#5#6#7#8{ \xdef\curr_file_list{#2} \ifx\prev_file_list\curr_file_list\else \egroup\bgroup \expandafter\input_mtx_files\curr_file_list, \relax,\end_input_mtx_files \global\let\prev_file_list=\curr_file_list \fi \etxtopl{#3}{#1} \x_cs\ifx{#4-#5-#6-#7}\relax \let\do_shape=\relax \x_cs\xdef{#4-#5}{ \x_cs\ifx{#4-#5}\relax\else \csname#4-#5\endcsname \fi \do_shape{#4}{#5}{#6}{#7} } \fi \let\do_size=\relax \x_cs\xdef{#4-#5-#6-#7}{ \x_cs\ifx{#4-#5-#6-#7}\relax\else \csname#4-#5-#6-#7\endcsname \fi \do_size{#8}{#1} } } % \etxtopl (based on \etxtovpl) \def\etxtopl#1#2{{ \def\do_slot{\resetint\slot_name\slot_number} \inputetx{#1} \open_out{#2.pl} \out_line{(COMMENT~font~#2~created~by~fontinst~v\fontinstversion)} \out_line{} \out_line{(COMMENT~Filename:~#2.pl)} \out_line{(COMMENT~Created~by:~tex~\jobname)} \out_line{(COMMENT~Created~using:~\string\etxtopl{#1}{#2})} \out_line{} \out_line{(COMMENT~This~file~can~be~turned~into~a~font~metric~with)} \out_line{(COMMENT~pltotf~#2.pl~#2.tfm)} \out_line{} \out_line{(COMMENT~THIS~FILE~CAN~THEN~BE~DELETED.)} \out_line{} \def\current_raw_font{#2} \make_raw_font{#1} \out_line{} \out_line{(COMMENT~END~OF~FILE~#2.pl)} \close_out{Ligfull~raw~font} }} % \make_raw_font (based on \make_font but somewhat simpler) \def\make_raw_font#1{ \setdim{designsize}{10pt} \scaled_design_size=\dim{designsize} \out_line{(DESIGNSIZE~\vpl_real\scaled_design_size)} \out_line{(DESIGNUNITS~\vpl_real\scaled_design_size)} \setstr{codingscheme}{UNKNOWN} \out_line{(CODINGSCHEME~\str{codingscheme})} \ifisint{boundarychar}\then \boundary_char=\int{boundarychar} \out_line{(BOUNDARYCHAR~\vpl_int\boundary_char)} \else \boundary_char=-1 \fi \setint{letterspacing}{0} \afm_convert\side_bearings=\div{\int{letterspacing}}{2}; \ifdim\side_bearings=0pt \let\do_character=\do_raw_character_no_letterspacing \else \let\do_character=\do_raw_character \fi \out_line{} \let\saved_mapfont\ignore_mapfont \out_line{(FONTDIMEN} \ifisint{fontdimen(1)}\then \a_dimen=\int{fontdimen(1)}pt \divide\a_dimen by \one_thousand \out_lline{(PARAMETER~D~1~\vpl_real\a_dimen)} \fi \a_count=2 \loop\ifnum\a_count<256 % What??? {\ifisint{fontdimen(\the\a_count)}\then \afm_convert\a_dimen=\int{fontdimen(\the\a_count)}; \out_lline{(PARAMETER~\vpl_int\a_count\space\vpl_real\a_dimen)} \fi} \advance\a_count by 1 \repeat \out_lline{)} \out_line{} \bgroup \out_line{(LIGTABLE} \let\do_slot=\relax \let\end_do_slot=\vpl_kerning \let\ligature=\vpl_ligature \let\k=\vpl_kern \inputetx{#1} \out_lline{)} \egroup \out_line{} \bgroup \let\do_slot=\do_character \let\end_do_slot=\end_do_character \let\nextlarger=\vpl_nextlarger \let\varchar=\vpl_varchar \let\endvarchar=\end_vpl_varchar \let\vartop=\vpl_vartop \let\varmid=\vpl_varmid \let\varbot=\vpl_varbot \let\varrep=\vpl_varrep \inputetx{#1} \egroup } \def\ignore_mapfont#1#2{\relax} \def\do_raw_character{ \x_cs\ifx{g-\slot_name}\relax \expandafter\gobble_setslot \else \ifx\slot_name\notdef_name\else \out_line{(CHARACTER~\vpl_int\slot_number\space (COMMENT~\slot_name)} \ifisint{\slot_name-spacing}\then \afm_convert\curr_bearings=\int{\slot_name-spacing}; \else \curr_bearings=\side_bearings \fi \afm_convert\a_dimen=\width\slot_name; \advance\a_dimen by 2\curr_bearings \out_lline{(CHARWD~\vpl_real\a_dimen)} \afm_convert\a_dimen=\height\slot_name; \out_lline{(CHARHT~\vpl_real\a_dimen)} \afm_convert\a_dimen=\depth\slot_name; \out_lline{(CHARDP~\vpl_real\a_dimen)} \afm_convert\a_dimen=\italic\slot_name; \ifnum\a_dimen>0 \out_lline{(CHARIC~\vpl_real\a_dimen)} \fi \fi \fi } \def\do_raw_character_no_letterspacing{ \x_cs\ifx{g-\slot_name}\relax \expandafter\gobble_setslot \else \ifx\slot_name\notdef_name\else \out_line{(CHARACTER~\vpl_int\slot_number\space (COMMENT~\slot_name)} \afm_convert\a_dimen=\width\slot_name; \out_lline{(CHARWD~\vpl_real\a_dimen)} \afm_convert\a_dimen=\height\slot_name; \out_lline{(CHARHT~\vpl_real\a_dimen)} \afm_convert\a_dimen=\depth\slot_name; \out_lline{(CHARDP~\vpl_real\a_dimen)} \afm_convert\a_dimen=\italic\slot_name; \ifnum\a_dimen>0 \out_lline{(CHARIC~\vpl_real\a_dimen)} \fi \fi \fi } % (CK) The missing \declareencoding for 8r.etx \declareencoding{TEXBASE1ENCODING}{8r} \catcode`\@=\atcatcode \catcode`\^^M=\nlcatcode \catcode`\ =\spacecatcode \catcode`\~=\tildecatcode \catcode`\_=\underscorecatcode