Discussion:
dvi.ps
(too old to reply)
n***@zzo38computer.org.invalid
2020-06-04 23:50:58 UTC
Permalink
I have some questions about use of TeX with PostScript. One of my
questions is if there is a way to automatically decide which METAFONT
mode is needed based on the contents of the page device dictionary? (I
can add a command-line argument to override this and specify it by
yourself instead, but a default should also be needed. I can also add a
command-line argument to not render any text on the page; this can be
used if you want to render the text using a separate program.) Of course
resolution can be figured easily enough, and that can be used for the
purpose of pixel rounding and other purposes (and also to find .pk files
with the extension given the resolution, if you are just given a directory
name rather than using kpsewhich).

My intention is mainly that TeX can be used for text, and then you can
use PostScript for diagrams, but you could also use PostScript codes to
decide how the DVI file is processed in other ways too.

For a diagram, you could for example write \special{(fig1.ps) run} in your
TeX file, and then when that special is encountered, it will execute the
contents of the PostScript file fig1.ps, which presumably draws a diagram
(and it would have access to any fonts used in the document; in addition
to the TeX fonts, the diagram could also use PostScript fonts if wanted;
furthermore, if you needed to pass other information from TeX, then you
could add that to the beginning of the special text so that they will be
on the operand stack and available for the PostScript code to use).

When I have something, then I will post it, although my initial question
still stands; I want to know if it is even possible to determine it
automatically in this way (assuming that you used -sDEVICE= to select the
proper kind of output device that you are using). (If not, then it isn't
too bad; I can just require it to be specified manually, which I would
allow even if automatic is possible too, anyways.)

(Note that I use Plain TeX; I do not use LaTeX.)
--
This signature intentionally left blank.
(But if it has these words, then actually it isn't blank, isn't it?)
ken
2020-06-05 07:02:00 UTC
Permalink
Post by n***@zzo38computer.org.invalid
I have some questions about use of TeX with PostScript. One of my
questions is if there is a way to automatically decide which METAFONT
mode is needed based on the contents of the page device dictionary?
I don't know what 'METAFONT mode' means, it doesn't have any meaning in
PostScript.
Post by n***@zzo38computer.org.invalid
When I have something, then I will post it, although my initial question
still stands; I want to know if it is even possible to determine it
automatically in this way
And what is 'it' ?
Post by n***@zzo38computer.org.invalid
(assuming that you used -sDEVICE= to select the
proper kind of output device that you are using).
That's Ghostscript usage, not PostScript.
Post by n***@zzo38computer.org.invalid
too bad; I can just require it to be specified manually, which I would
allow even if automatic is possible too, anyways.)
I'm afraid I really don't know what it is you are actually asking. As
luser droog said perhaps you'll have more luck with a TeX news group, I
can't see where PostScript has any bearing on your explanation or
question.


Ken
n***@zzo38computer.org.invalid
2020-06-05 17:07:03 UTC
Permalink
Post by ken
Post by n***@zzo38computer.org.invalid
I have some questions about use of TeX with PostScript. One of my
questions is if there is a way to automatically decide which METAFONT
mode is needed based on the contents of the page device dictionary?
I don't know what 'METAFONT mode' means, it doesn't have any meaning in
PostScript.
OK, perhaps it will be helpful to explain it, I suppose.
Post by ken
And what is 'it' ?
The METAFONT mode, of course. METAFONT modes are just names, although they
are used to compile fonts for a specific printer, and each METAFONT mode
defines the following parameters (in addition to some others which are not
relevant to PostScript, that I am not mentioning here):

* The resolution (already seen in the page device dictionary).

* A "blacker" parameter, to correct stems and so on for devices which
would otherwise make them too light.

* A "fillin" parameter, to correct the darkness of diagonal lines.

* A "o_correction" parameter, to "overshoot" curves beyond the baseline
and x-height, such as that of the letter "o". They say this causes it to
look better at high resolutions, while low resolutions should avoid this.

For example, the METAFONT mode for Xerox 8790 or 4045 (at 600dpi) uses
blacker=1, fillin=0.1, and o_correction=0.9. Not having worked with this
many printers, I don't know it exactly, although I should want to ensure
high quality output for any printer, if possible. (There are also METAFONT
modes for printers with a much higher resolution than that, too.)

(Also, to clarify: This PostScript code is meant to run on the computer,
not on the printer. This allows it to access external files (such as the
font files, and external files for diagrams), to use the fill level 3
PostScript features, to use Ghostscript features, etc. You would then
rasterize it and send it to the printer. If you do have a PostScript
printer, you could use Ghostscript's PostScript output mode to convert
the output of the PostScript program into level 2 PostScript.)

Perhaps I can also mention that these fonts are bitmap fonts; METAFONT
compiles a vector description of the font (using a complete programming
language) into a bitmap font, with hinting, with the parameters mentioned,
with parameters specific to the font (so that you can get many styles of
text just by adjusting the parameters), and with a full programming
language, into the font bitmaps and a font metric file.

Although most users seem not to want bitmap fonts, I am one of the users
who does want to use bitmap fonts. (Bitmap fonts probably are not useful
if you want PDF output, but in my case, PDF isn't what I wanted.)
Post by ken
I'm afraid I really don't know what it is you are actually asking. As
luser droog said perhaps you'll have more luck with a TeX news group, I
can't see where PostScript has any bearing on your explanation or
question.
As I previously explained, I already did that (I cross-posted). But where
PostScript has any bearing on the question is the PostScript page device
dictionary, as I mentioned. So, in other words, to answer my question
would probably require a knowledge of both METAFONT (which is usually used
with TeX, although it is actually a separate prorgam) and PostScript.

If my question has no answer, that is fine; I can just make it manually
specified only; although it may be good to figure it out automatically.

The reason I am using PostScript at all is mainly in order to include
diagrams in the document; those would presumably be written using
PostScript code. (It may also be helpful to embed PostScript code in the
document to do other stuff such as setting colours, changing how the rest
of the DVI file will be processed, etc. Your PostScript code for the
diagram might also be passed parameters from TeX, such as the amount of
stretching, in case your diagram includes parts which should be vertically
stretched, too. If I am making a document without diagrams, then I would
just use dvipbm instead; no need to deal with PostScript.)

I prefer to avoid PDF; DVI is just a better format in many ways, and then
another program would rasterize the DVI file; this could be done using a
program written in C, Pascal, etc. However, PostScript is still good for
diagrams and such thing like that, so instead of using C, I am considering
to use PostScript to implement this rasterization. So, DVI should be used
for the main text of the document, and PostScript for diagrams (with the
PostScript code embedded in the DVI file; if they are external then you
can just write something like "(fig1.ps) run" and that will cause it to
execute the PostScript file fig1.ps when that point is reached).

Rasterizing a DVI file does involve more than just fonts; it also involves
rounding pixel positions and dealing with drifting properly. See DVItype
for details of this algorithm (implemented in Pascal).
--
This signature intentionally left blank.
(But if it has these words, then actually it isn't blank, isn't it?)
ken
2020-06-05 17:29:12 UTC
Permalink
Post by n***@zzo38computer.org.invalid
Post by ken
I'm afraid I really don't know what it is you are actually asking. As
luser droog said perhaps you'll have more luck with a TeX news group, I
can't see where PostScript has any bearing on your explanation or
question.
As I previously explained, I already did that (I cross-posted). But where
PostScript has any bearing on the question is the PostScript page device
dictionary, as I mentioned. So, in other words, to answer my question
would probably require a knowledge of both METAFONT (which is usually used
with TeX, although it is actually a separate prorgam) and PostScript.
To be honest, I don't really see how anything in the page device
dictionary could have any real bearing, since this is apparently all
decided in TeX.

If you can describe what information you want I can tell you whether its
likely to be available, and how, but I don't really see how anything in
the PostScript environment has a lot of bearing. If you insist on using
bitmap fonts, then the resolution matters, certainly, beyond that
possibly the default transfer fucntion (which is in the graphics state,
not the page device dictionary)
Post by n***@zzo38computer.org.invalid
If my question has no answer, that is fine; I can just make it manually
specified only; although it may be good to figure it out automatically.
As I say I can't see how you can determine much of this from PostScript.
Part of the point of PostScript is that you are shielded from device-
specific decisions.


Ken
Peter Flynn
2020-06-05 21:53:09 UTC
Permalink
Post by n***@zzo38computer.org.invalid
I have some questions about use of TeX with PostScript. One of my
questions is if there is a way to automatically decide which METAFONT
mode is needed based on the contents of the page device dictionary?
The METAFONT mode is used with Type 3 (bitmap) fonts to specify how many
dots per inch (horizontally and vertically) are needed for the current
output device (ie phototypesetter, graphic display terminal, etc). If a
Type 3 font (in METAFONT terms, a .mf file creating a .gf file) is
needed and a bitmap (a .nnnnpk file) does not yet exist for the
requested resolution, METAFONT will be called to generate it. As most
output devices nowadays have resolutions so far in excess of anything
whose dots your eyes can reasonably be expected to resolve, the METAFONT
mode is largely obsolescent: at some stage, TeX distributions set to
some default value like HP LaserJet 600×600 but I think nowadays
METAFONT has a setting called 'modeless' (I may be wrong on this: it's
been many decades since I needed to know, and texmf.cnf is singularly
unforthcoming).

People do still use Postscript — some printers still have platemaking
equipment whose RIP only accepts Postscript — but most output is now
PDF. Type 3 fonts are still very much around, but with a few elderly
exceptions, font technology in print production has long moved on. A
number of popular numeric and drawing packages still apparently produce
EPS output (my old favourite stats package, P-Stat, among them), but
it's easy to convert the EPS to PDF for embedding in a [La]TeX document.
Post by n***@zzo38computer.org.invalid
My intention is mainly that TeX can be used for text, and then you
can use PostScript for diagrams, but you could also use PostScript
codes to decide how the DVI file is processed in other ways too.
It's certainly possible.
Post by n***@zzo38computer.org.invalid
For a diagram, you could for example write \special{(fig1.ps) run}
[snip]

You certainly could.
Post by n***@zzo38computer.org.invalid
When I have something, then I will post it, although my initial question
still stands; I want to know if it is even possible to determine it
automatically in this way (assuming that you used -sDEVICE= to select the
proper kind of output device that you are using). (If not, then it isn't
too bad; I can just require it to be specified manually, which I would
allow even if automatic is possible too, anyways.)
The value is probably stored somewhere but I don't know where.

Peter
n***@zzo38computer.org.invalid
2020-06-06 03:13:08 UTC
Permalink
.............................................................. As most
output devices nowadays have resolutions so far in excess of anything
whose dots your eyes can reasonably be expected to resolve, the METAFONT
mode is largely obsolescent: at some stage, TeX distributions set to
some default value like HP LaserJet 600×600 but I think nowadays
METAFONT has a setting called 'modeless' (I may be wrong on this: it's
been many decades since I needed to know, and texmf.cnf is singularly
unforthcoming).
OK, then that is a good default, and I suppose that answers my question;
there is then no need to deal with METAFONT modes (unless the user
explicitly specifies one); it already knows the resolution, so it can
just use the resolution alone to determine which file to load.

I cannot find a "modeless" setting in my computer (I looked in modes.mf,
which lists the modes, and texmf.cnf, which doesn't seem to mention the
METAFONT modes at all), and mktexpk just says mismatched mode. I looked at
the code for mktexpk; it is a shell script; it seems that "modeless" is
only for PostScript fonts, and is not for fonts made using METAFONT. It
also looks like it executes METAFONT to determine if the mode matches; if
it doesn't match, tries to guess using a hard-coded table. Although, it
seem like easily enough to add a "modeless" option for METAFONT-based
fonts into mktexpk (there are a few possible ways to do this, but in all
cases you would skip the check at the beginning in modeless mode for if
the mode and DPI does not match).

But maybe the version I have is old, and the new version does have such a
"modeless" setting that would do what would be needed if the user has not
specified any METAFONT mode.
People do still use Postscript — some printers still have platemaking
equipment whose RIP only accepts Postscript — but most output is now PDF.
OK. I did not know that, but Ghostscript has the ability to output
level 2 PostScript (as well as PDF), so you can use that if you need that.
A number of popular numeric and drawing packages still apparently produce
EPS output (my old favourite stats package, P-Stat, among them), but
it's easy to convert the EPS to PDF for embedding in a [La]TeX document.
OK, although I don't use EPS, nor those programs, nor LaTeX, nor pdfTeX.
If I need graphics made from data from another program, I will generally
instead write a program in PostScript to read that file and plot the data.
But EPS works too if that is what you are using.
--
This signature intentionally left blank.
(But if it has these words, then actually it isn't blank, isn't it?)
Loading...