[metapost] Conformance to Document Structuring Conventions
Specification ver 3.0
Michail Vidiassov
master at iaas.msu.ru
Sat Feb 11 23:41:13 CET 2006
Dear All,
Running mpost test.mp, where test.mp is as follows:
beginfig(1);
prologues := 1;
label("test" infont "Times-Roman" scaled (bp/pt), (0,0) );
endfig;
end
results in the following output:
%!PS-Adobe-3.0 EPSF-3.0
%%BoundingBox: -7 -3 7 3
%%Creator: MetaPost
%%CreationDate: 2006.02.11:1052
%%Pages: 1
%%DocumentFonts: Times-Roman
%%BeginProlog
/Times-Roman /Times-Roman def
/fshow {exch findfont exch scalefont setfont show}bind def
%%EndProlog
%%Page: 1 1
-6.94502 -2.85501 moveto
(test) Times-Roman 10.00005 fshow
showpage
%%EOF
The first line of the output implies that output is intended to conform to
PostScript Language Document Structuring Conventions ver 3.0,
as described in 5001.DSC_Spec.pdf from Adobe.
But conformance is not perfect.
(It looks like DSC ver 1 with %%EOF from ver 2.1 and %%BeginProlog from 3.0,
see part "A.1 Changes Since Earlier Versions" in the DSC spec mentioned above.)
Errors:
1. There should be %%EndComments line after %%DocumentFonts.
In part 4.1 of DSC ver 3.0 doc it is stated that:
> The header section consists of DSC comments only and describes the
> environment that is necessary for the document to be output properly.
> The end of the header section is denoted by the %%EndComments comment
2. Prolog section used incorrectly.
In the same part 4.1 there is this text:
> The beginning of the procedures section is indicated by the %%BeginProlog
> comment. This section is a series of procedure set (procset) definitions;
> each procset is enclosed between a %%BeginResource: procset and
> %%EndResource pair. Procsets are groups of definitions and routines
> appropriate for different imaging requirements.
> The prolog has the following restrictions:
> Executing the prolog should define procsets only. For example, these
> procsets can consist of abbreviations, generic routines for drawing
> graphics objects, and routines for managing text and images.
The proper place for other initialization commands is in the setup section.
Part 4.2 of the specification tells:
> The document setup section is denoted by the %%Begin(End)Setup
> comments. The document setup should consist of procedure calls for
> ..., running initialization routines for procsets, ...
Thus the the definition of fshow is to be wrapped with
%%BeginResource: procset / %%EndResource pair,
while "/Times-Roman /Times-Roman def" has to go to the setup section,
whose bounds are %%BeginSetup / %%EndSetup.
IMHO, what now is
%%BeginProlog
/Times-Roman /Times-Roman def
/fshow {exch findfont exch scalefont setfont show}bind def
%%EndProlog
has to be changed in one of the following ways:
a) Prolog is used properly
%%DocumentProcSets: mpost
%%DocumentSuppliedProcSets: mpost
%%EndComments
%%BeginProlog
%%BeginResource: procset mpost
/fshow {exch findfont exch scalefont setfont show}bind def
%%EndResource
%%EndProlog
%%BeginSetup
/Times-Roman /Times-Roman def
%%EndSetup
b) Prolog is not used at all,
%%BeginSetup / %%EndSetup pair is used instead of %%BeginProlog / %%EndProlog.
%%EndComments
%%BeginSetup
/Times-Roman /Times-Roman def
/fshow {exch findfont exch scalefont setfont show}bind def
%%EndSetup
3. DocumentFonts is used according to DSC spec ver 1
DSC spec ver 3 doc told me:
> %%DocumentFonts: should be the union of the %%DocumentNeededFonts:
> and %%DocumentSuppliedFonts: font lists.
> Note This comment is provided for backward compatibility and may be
> discontinued in later versions of the DSC. Use the more general comments
> %%DocumentNeededResources: and %%DocumentSuppliedResources:
> instead.
Thus %%DocumentNeededFonts comment is to be added, or
%%DocumentFonts is to be replaced with %%DocumentNeededResources.
4. Fonts are not reencoded. (Not a bug, but a missing feature.)
Although psfonts.map is used to get PostScript names of fonts,
infomation on font encoding from the same file is ignored.
It will result in errors with non-ascii characters from TeX fonts,
that are usually in some TeX encoding.
IMHO font reencoding must be added to metapost output.
Sincerely, Michail
More information about the metapost
mailing list