Here is a sample setup:
(require 'ps-print) (require 'ps-mule) (setq ps-multibyte-buffer 'bdf-font-except-latin) (setq ps-multibyte-buffer 'bdf-font bdf-directory-list (mapcar (lambda (d) (concat "/usr/local/src/intlfonts-1.2/" d)) '("Asian" "Chinese" "Ethiopic" "European" "Japanese" "Misc" "Chinese.X" "Japanese.X" "Korean.X" "European.BIG" "Japanese.BIG")))
This loads the libraries, tells ps-print to use the BDF fonts for everything but the latin fonts (since these are available on the printer), and it tells Emacs to use some of the directories below
/usr/local/src/intlfonts-1.2/ (substitute the directories you want to use from the intlfonts package).
Note that the above works best if you are printing either latin texts, or texts requiring the BDF fonts. For texts that require both, this looks ugly. When I print the HELLO file, for example, the Czech or Esperanto greetings look terrible. In these situations, I often prefer to use BDF fonts for the entire text.
(setq ps-multibyte-buffer 'bdf-font)
Now if you work in a Latin-9 environment, you’ll notice that
‘ps-mule-font-info-database-bdf’ is missing fonts for ISO8859-15 (which corresponds to Latin-9). So here is a workaround that just uses Latin-1 for Latin-9:
(setq ps-multibyte-buffer 'bdf-font-except-latin) (add-to-list 'ps-mule-font-info-database-ps-bdf '(latin-iso8859-15 (normal nil nil iso-latin-1)))
When you use Latin-1 for Latin-9, then you will get all the Umlauts, but you will continue to miss the EUR sign. But at least you can print.
This is usefull for BbdbMulePrinting, for example.
If you use Emacs23 - thanks to the Unicode support -, you can use any nice looking ttf font after an easy conversion step with all of the international characters that the font supports! For example, I printed the hello file with DejaVu? Sans Mono and it is much nicer and complete, than with the builtin fonts.
First, convert the fonts:
otf2bdf $OPTS -w Bold -s O /usr/share/fonts/truetype/ttf-dejavu/DejaVuSansMono-BoldOblique.ttf >/somedir/djvmono-bo.bdf otf2bdf $OPTS -w Bold /usr/share/fonts/truetype/ttf-dejavu/DejaVuSansMono-Bold.ttf >/somedir/djvmono-b.bdf otf2bdf $OPTS -s O /usr/share/fonts/truetype/ttf-dejavu/DejaVuSansMono-Oblique.ttf >/somedir/djvmono-o.bdf otf2bdf $OPTS /usr/share/fonts/truetype/ttf-dejavu/DejaVuSansMono.ttf >/somedir/djvmono.bdf
(eval-after-load 'ps-print (require 'ps-mule) (setq ps-multibyte-buffer 'bdf-font) ;; print everything with bdf (setq ps-font-size 10) ;; change according your tastes (setq bdf-directory-list '("/somedir")) (setq ps-mule-font-info-database-bdf '((unicode-bmp ; everything in the world should be printed with this font (normal bdf "djvmono.bdf") (bold bdf "djvmono-b.bdf") (italic bdf "djvmono-o.bdf") (bold-italic bdf "djvmono-bo.bdf")) (iso-8859-1 ; please, latin-1 TOO, I said everything! (normal bdf "djvmono.bdf") (bold bdf "djvmono-b.bdf") (italic bdf "djvmono-o.bdf") (bold-italic bdf "djvmono-bo.bdf")))))
Euro sign checked, it works!
Nice ! The postscript looks fine on screen, but when I send it to the printer, I get garbage if there are some special Unicode characters in the file, e.g. 03B1 (alpha) 03B2 (beta) etc. The same happens if I convert the postscript to pdf using ps2pdf.
As a workaround, I filtered the postscript through the ps2ps utility, and it worked. Here is a short snippet that does it automatically.
(defadvice ps-do-despool (before ps-2-ps activate) "we apply the ps2ps command to the postscript buffer just before printing" (if (or (not (boundp 'ps-spool-buffer)) (not (symbol-value 'ps-spool-buffer))) (message "No spooled PostScript to print") (save-excursion (set-buffer ps-spool-buffer) (shell-command-on-region (point-min) (point-max) "ps2ps - -" nil t "*Message*"))))
‘ps-generate’ command can be adviced in the same way if we want to convert the content of the postscript buffer as soon as it is generated.