Re: About the font used by 'ps-spool-buffer-with-faces'

Angelo Graziosi <[email protected]> Tue, 24 Dec 2024 10:43:38 +0100
Newsgroups gmane.emacs.windows
Message-ID <[email protected]>

Il 24/12/2024 10:20, Benjamin Riefenstahl ha scritto:
> Hi Angelo,
> 
> Angelo Graziosi writes:
>> The PDF is not rendere with Lucida console but, if I read corectly,
>> with Courier New.
>>
>> Is this to be expected. How can I have a PDF with the font I have set
>> as default in Emacs?
> 
> In short, yes that is expected.
> 
> You may want to look at the Variables in the customization group
> ps-print-face, particularly ps-font-family and ps-font-info-database.
> (M-x customize-group RET ps-print-font RET).  More options at the end.
> 
> Background: PostScript and PDF use a rather low-level interface for text
> and fonts.  This translates to a lot of work that an application has to
> do, if it wants to use PostScript to achieve effects that are expected
> from users nowadays.  This work has not been done in Emacs yet.
> 
> Emacs just uses the shortcuts that PostScript provides, which means:
> 
> * The only fonts that can be selected are those already installed by
>    default on all PostScript printers (see ps-font-info-database).
>    (Unless you have a printer where additional fonts can be installed
>    outside of Emacs.)
> 
> * No rendering of characters outside of ISO8859-1, because that is what
>    those fonts have.
> 
> * I believe Emacs does the line wrapping itself, but does not actually
>    know the metrics of the fonts that exist on the printer, so that
>    assumes a fixed-width font.
> 
> Given, that you are using ps2pdf, your "printer" is actually
> Ghostscript, I think.  It might be possible to specify a TrueType font
> file as the font family and make Ghostscript include that font
> automatically in the PDF.  But I do not know the syntax for that, or if
> it is possible at all without adapting the Emacs code.
> 
> Another option is using some other external plain text formatting tool
> like Enscript (or ask your favorite search engine ;-)).


Thanks Benjamin! It seems this is a consequence of the fact that we are 
using PostScript.

With Kate, for example, I can select 'Print' and than 'Microsoft print 
to PDF' and this produces a PDF with the font used by Kate. In Emacs, 
instead, 'Print buffer' want to send the buffer to the true printer, one 
does not have a menu from which to choose the printer...

In any case, thanks for the clarifications.

Ciao,
   Angelo.