[Fontinst] Things to update

Philipp Lehman lehman at gmx.net
Mon Dec 8 19:03:37 CET 2003


Nachricht von Lars Hellström am Montag, 8. Dezember 2003 17:08:

> Is there anything else?

I wanted to look into a map fragment writer for xdvi(k) for some time. 
xdvi(k) interprets a subset of dvips' syntax only so, taking a quick 
look at fimapgen, it seems like copying \make_dvips and stripping it 
down a bit should do it.

Here's a quote from the xdvi sources:

--- QUOTE ---

In principle Xdvi only accepts a subset of the fontmaps used by dvips
and pdftex.  In practice the restrictions are not very restraining.
For a description of the font map file syntax, see the `psfonts.map'
section of the dvips manual (dvips.{texi,dvi,pdf}).

Xdvi accepts fontmaps that obey these rules:

1. The vector files must have a .enc extention or be included by the
   <[ ... syntax in the fontmap.  Encoding is optional.  The
   ReEncodeFont keyword and its argument is tolerated, but it is
   _ignored_.  xdvi looks for a <foo.enc or <[foo to determine the
   encoding vector, and re-encode the font.

2. The other file in the map line must be a font file in pfa or pfb
   format. The extention need not be included for the sake of xdvi,
   but dvips and pdftex might need it, so better include it when using
   shared fontmap files.  An explicit font file name is required by
   xdvi since xdvi does not have any builtin fonts.

3. There may not be any other input files on a fontmap line.

   Xdvi is not a printer and cannot accept arbitrary postscript
   prologues or setup things in fontmaps.

4. Xdvi decodes the ExtendFont and SlantFont commands in the quoted
   postscript code and the extention factor and slanting is applied
   to the font when displayed.  Any other magic done by the quoted
   postscript code won't be understood by xdvi.

--- END QUOTE ---

I must admit I don't fully grok the driver code in fimapgen.
Let's see:

%\def\make_dvips{
\def\make_xdvik{% xdvi(k): plain 'ol xdvi doesn't do PS fonts
   \downloads_list={}
   \let\postscript_code\empty_command
   \let\download\append_download
% Not sure what the next chunk does exactly,
% apart from figuring out ReEncodeFont.
% Where do you add the .enc and .pfb files?
% BEGIN
   \ifx \reencode_etx\empty_command \else
      \if_undefined{pse-\reencode_etx}\then
         \etxtoenc{\reencode_etx}{\reencode_etx}
      \fi
      \expandafter\expandafter \expandafter\second_of_two
         \csname pse-\reencode_etx\endcsname
      \edef\postscript_code{\postscript_code\space
         \expandafter\expandafter \expandafter\first_of_two
            \csname pse-\reencode_etx\endcsname
         \space ReEncodeFont
      }
   \fi
% END
% We need ExtendFont and SlantFont
   \ifdim \xscale_factor=\p@ \else
      \edef\postscript_code{\postscript_code
         \space\expandafter\lose_measure\the\xscale_factor
         \space ExtendFont
      }
   \fi
   \ifdim \slant_factor=\z@ \else
      \edef\postscript_code{\postscript_code
         \space\expandafter\lose_measure\the\slant_factor
         \space SlantFont
      }
   \fi
% xdvi doesn't use the PS name, so this chunk can be dropped
% BEGIN
%   \ifx \PS_font_name\unknown_str \get_PS_font_name \fi
%   \ifx \PS_font_name\clueless_str
%      \includewarning\warn_undecided_data
%      \_a_true
%   \else
%      \if_undefined{psf-\PS_font_name}\then
%         \_a_true
%      \else
%         \csname psf-\PS_font_name \endcsname
%         \_a_false
%   \fi\fi
%   \if_a_
%      \ifx \PS_font_file\unknown_str \get_PS_font_file \fi
%      \append_download{\PS_font_file}
%      \ifx \PS_font_file\clueless_str
%         \includewarning\warn_undecided_data
%      \fi
%   \fi
% END
   \def\download##1{~<##1}
%   \pout_line\output_dvips{
   \pout_line\output_xdvik{
%      \TeX_font_name\space\PS_font_name
      \TeX_font_name
      \expandafter\empty_command \the\downloads_list
      \ifx \postscript_code\empty_command \else
         \space"\postscript_code\space"
      \fi
   }
}

The final xdvi map files should look as follows:

phvr8r		<8r.enc	<phvr8a.pfb
phvro8r		<8r.enc	<phvro8a.pfb
ptmro8r		"0.167 SlantFont"	<8r.enc <ptmr8a.pfb
(or)
ptmro8r		<8r.enc <ptmr8a.pfb	"0.167 SlantFont"

-- 
Philipp Lehman <lehman at gmx.net>



More information about the fontinst mailing list