<OT> postscript question: Justify text
Joel Hammer
Joel
Mon May 17 11:31:24 PDT 2004
I want to justify simple text files, such as are output by vi. It is
hard to believe it is so hard to do.
When you say keep adding spaces until the line if filled, do you mean
actually adding spaces to the string itself. Wouldn't that get you
words on the same line which were unevenly spaced?
If there were some way for the stringwidth command to return the lenght
of a string that "x y ashow" or widthshow would put out in the current metric, then
you could just write a loop to keep increasing x until the line were
filled, however; I was unable to figure out how to get the width of a string
put out by ashow, without actually ashowing it.
Or, if there were a quick and easy way to increase the width of
the glyph for "space" in the current metric, the same trick might be used.
That is what I am going to be fooling with, I guess, fonts.
Seems like it should be simple, to an amateur.
Joel
On Sat, May 18, 2002 at 03:53:44PM -0700, Kevin O'Gorman wrote:
> That is a laborious process in Postscript proper. The primitives are there
> to support it, but the real work is usually done by the application program
> that emits the postscript file. This makes sense, because the application
> knows how it wants it done, and there are a remarkable number of different
> ways to do it, when you take kerning and such into account.
>
> The relevant primitves are (besides knowing the font metrics for the font
> you're using) are the 'width' and 'moveto' operators. You find out how
> wide a given string will be when printed, then add space until the size is
> just right, then emit the line. Usually an application will precompute all
> this, then just emit the 'moveto' and 'show' operators. All the operators
> I put in 'primes' have several variants.
>
> My advice: don't try to do it in Postscript unless you're really ready
> for a steep learning curve. You'd be a bit better off modifying enscript,
> especially if you're outputting a constant-width font like Courier.
>
> ++ kevin
>
>
> On Sat, May 18, 2002 at 05:44:38PM -0400, Joel Hammer wrote:
> > Does anyone know how to produce justified text in a postscript document?
> > It sounds simple, but there is no reference to this option in enscript, and
> > the two postscript manuals I downloaded from the internet don't have the
> > word "justify" in them.
> > Any insight appreciated,
> > Joel
> >
> > _______________________________________________
> > Linux-users mailing list - http://linux-sxs.org/mailman/listinfo/linux-users
> > Subscribe/Unsubscribe info, Archives,and Digests are located at the above URL.
>
> --
> Kevin O'Gorman (805) 650-6274 mailto:kevin at kosmanor.com
> Permanent e-mail forwarder: mailto:Kevin.O'Gorman.64 at Alum.Dartmouth.org
> At school: mailto:kogorman at cs.ucsb.edu
> Web: http://www.cs.ucsb.edu/~kogorman/index.html
> Web: http://kosmanor.com/~kevin/index.html
>
> "Life is short; eat dessert first!"
> _______________________________________________
> Linux-users mailing list - http://linux-sxs.org/mailman/listinfo/linux-users
> Subscribe/Unsubscribe info, Archives,and Digests are located at the above URL.
More information about the Linux-users
mailing list