I wrote the original PS driver for VIM, several years ago now. This is
somewhat OT from the OP as it is not Windows related. If you are not
interested, stop reading now.
The PS driver relies on fonts being present in the printer. The only
ones guaranteed to be there are the base 35 western fonts (Courier,
Times, etc). However, far east printers will have a few multi-byte
fonts to support CJK printing, for which the printmbcharset et al
options and handling of multi-byte encodings was added. It is possible
to install additional multi-byte fonts on the printer which could also
be used
Technically PostScript is text encoding agnostic - it just deals with
sequences of byte values. The selected font defines how to interpret
the byte sequence, as single bytes or a multi-byte encoding of some kind.
A lot depends on the characters being used. If you are using UTF-8
encoding for text that exists in a single ISO-8859 character set then
you can just set printencoding and VIM should translate the UTF-8
encoded text to single bytes for printing. If you are using characters
from multiple ISO-8859 character sets then things start to get complicated.
If you are just using ISO-8859 characters then it would be possible (but
not currently implemented) to support many such character sets when
printing with a single font.
If you are using true multiple-byte characters (i.e. ones not present in
any of the ISO-8859 or cp character sets) then you will need to use a
multi-byte font and the big issue is with handling them - their
discovery on the host system, metrics calculation for text layout,
selection of a sub-set of the contents (multi-byte fonts tend to be
large - do you want to generate a 12MB PS file to print <1K of text?),
and embedding in the generated PS.
Not a trivial problem to solve at the time. When discussed with Bram it
was decided this was not wanted. Dunno if time has changed the argument
at all.
TTFN
On 05/01/2010 17:47, Chris Jones wrote:
> On Tue, Jan 05, 2010 at 11:39:44AM EST, Benjamin R. Haskell wrote:
>> On Tue, 5 Jan 2010, Chris Jones wrote:
>
> [..]
>
>>> Since utf-8 is the default encoding on debian Lenny, I find it hard
>>> to believe that the Vim to Postscript implementation would not
>>> function out of the box with utf-8 encoded files,
>
> [..]
>
>> Printing UTF-8 text is hard, since PostScript doesn't support it
>> natively.
>
> Actually, since this is rather messy and I'm probably not going to take
> another a look at it for some time, I decided to write my own personal
> mini-howto on the subject, and since I was unable to quickly think of a
> short elegant preamble, I wrote: "Printing UTF8-encoded files is tricky
> at best.." ;-)
>
>> I was pretty surprised that 'enscript' never made it into the
>> Unicode age. 'paps' is the only thing I found that seems to do a
>> reasonable job. Though, just now (while trying to find the page I found
>> yesterday) I found a few entries in a UTF-8 and Unicode FAQ under
>> 'Printing'[1].
>>
>> [1] http://www.cl.cam.ac.uk/~mgk25/unicode.html
>
> Saw that too.. Nothing helpful.
>
>> CUPS supposedly handles UTF-8 via the texttops filter, but I was unable
>> to get anything reasonable (even fiddling with 'CHARSET=' and '-o
>> document-format=text/plain;charset=' options). I eventually gave up and
>> replaced /usr/libexec/cups/filter/texttops with the following script:
>
> Went down that road, only to reach the same dead end.
>
>> #!/bin/sh
>> paps< "$6" | title="$3" perl -lpwe 's/stdin/$ENV{title}/ if 2==$.'
>
> [..]
>
>>> Can anyone shed some light on this mattter?
>
>> From the docs, printexpr only affects how the generated PS temp file
>> gets printed. So, if Vim's already subbing out the chars in the PS,
>> it's not going to matter what happens next.
>
> Pretty much what I speculated.
>
>> Testing with :ha> test.ps shows that no matter what encoding or
>> fileencoding or printencoding or printmbencoding I tried, it still
>> shows up as latin1 in the resulting PostScript. Which is weird
>> considering the various charset handling that appears to be done in
>> src/hardcopy.c.
>
> I was expecting to find a bug report somewhere, or would that be a Vim
> enhancement request - i.e. lifting this limitation, and saw nothing.
>
>> The only way I was able to get decent printouts was by just shelling
>> out to paps:
>
>> :!paps< %> test.ps
>
> Looks like I was on the right track re: the OP's problem then, and one
> variation or other involving paps should fix it for him.
>
> Thank you for your comments,
>
> CJ
>
Mike
--
yip yip yip yip yap yap yip *BANG* - NO TERRIER
No comments:
Post a Comment