[comp.lang.postscript] 2 Beginer Questions.

mhovan@gmuvax2.gmu.edu (Mike Hovan) (05/21/91)

	Two simple questions:


		1) How do I use the underline information that is in the
	font definition to produce underlines?

		2) What is the easiest way to do arbitrary pattern fills?
	(image?)


		Thanks,  Mike

-- 
  |X|X| "Women,                                 Michael Andrew Hovan III |X|X|
  |X|    Can't live with them,                  mhovan@gmuvax2.gmu.edu     |X|
  |X|    Can't fry them in a WOK!"              George Mason University    |X|
  |X|X|    -- MTV Half-Hour Comedy Hour         Fairfax, Virginia, USA   |X|X|

henry@angel.Eng.Sun.COM (Henry McGilton) (05/21/91)

In article <1991May20.222912.6130@gmuvax2.gmu.edu>, mhovan@gmuvax2.gmu.edu (Mike Hovan) writes:

Two simple questions:


    *  1)  How do I use the underline information that is in the
    *      font definition to produce underlines?

Beware.  /UnderlinePosition and /UnderlineThickness keys live in the
/FontInfo dictionary.  /FontInfo is an OPTIONAL DICTIONARY -- you
cannot depend on its existence.  Other implementations confuse the
issue still further by putting the /UnderlinePosition and
/UnderlineThickness keys in the font dictionary itself, instead
of in the /FontInfo dictionary, thereby rendering PostScript
interpreter dependent -- a new twist on device dependence.

However, should you actually want to use these items of
information, define start underline and end underline
procedures.  The start underline procedure records the start
position of your show string.  The end underline procedure then
draws a line at the correct position and thickness.

Another possible way is to actually use the underline character
from the font, if it's there.  Just go back to the start
position of the show string and then show the appropriate number
of underline characters.

Both these suggestions are simplistic.

The information is also (should be) contained in AFM files, which
applications should use, assuming the information in the AFM files
is correct.

    *  2) What is the easiest way to do arbitrary pattern fills? (image?)

In PostScript Level One, a reasonably good way is to define a font
containing characters that tile.  Using the font machinery for patterns
is a good way to go, since you can use arbitrary PostScript programs
that will scale and so on.

Using image is the next best way if you're desperate, but watch out
for scaling effects.

In PostScript Level Two, coming Real Soon Now to printers near you,
use the pattern facilities.


	........  Henry

    If Operating Systems were buildings, 
	UNIX would be the Winchester Mystery House.