unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* print with DejaVu font from emacs
@ 2009-11-09 15:38 harven
  2009-11-09 16:36 ` Peter Dyballa
       [not found] ` <mailman.10350.1257784601.2239.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 6+ messages in thread
From: harven @ 2009-11-09 15:38 UTC (permalink / raw)
  To: help-gnu-emacs

I recently switched to emacs23.1.1 and the unicode support is great.
I use the default DejaVuSansMono font in emacs, but when I try to do 
a ps-print-buffer or ps-spool-buffer, it uses the Courier font.
Thus the result is disappointing because Courier does not support 
a lot of unicode characters. 

I tried to set ps-font-family to "Monospace" or "DejaVuSansMono"
which is the default font on my DE (gnome 2.28). But I get the warning
"don't have data to scale font Monospace. Known fonts family are (Courier..."
The list of known fonts is pretty short and I don't think that any of them
supports the whole unicode range.

I am a bit clueless about that scaling issue. (this is not an problem related 
to the printer or system, gedit prints without problem with that font).
How can I make emacs use the Monospace font for printing ? 

Thanks for your help,
--
Harven


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: print with DejaVu font from emacs
  2009-11-09 15:38 print with DejaVu font from emacs harven
@ 2009-11-09 16:36 ` Peter Dyballa
       [not found] ` <mailman.10350.1257784601.2239.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 6+ messages in thread
From: Peter Dyballa @ 2009-11-09 16:36 UTC (permalink / raw)
  To: harven; +Cc: help-gnu-emacs


Am 09.11.2009 um 16:38 schrieb harven:

> I recently switched to emacs23.1.1 and the unicode support is great.
> I use the default DejaVuSansMono font in emacs, but when I try to do
> a ps-print-buffer or ps-spool-buffer, it uses the Courier font.
> Thus the result is disappointing because Courier does not support
> a lot of unicode characters.

In Unicode forget ps-print-<whatever>! PostScript only handles  
encodings of 256 elements (and with some difficulty also CJK fonts  
with thousands of code points). What you need is a conversion from  
text to Unicode encoded HTML which then can easily be handled by your  
OS or desktop.

Htmlize.el by Hrvoje Nikšić: http://fly.srk.fer.hr/~hniksic/emacs/ 
htmlize.el. A sample of its capabilities can be seen here: http:// 
fly.srk.fer.hr/~hniksic/emacs/htmlize.el.html – missing some CJK and  
other non-Latin content. Lennart Borgman's htmlize-view.el helps a  
bit to handle printing (http://piprim.tuxfamily.org/home/pi/emacs.d/ 
site-lisp/htmlize-view.el).

So using DejaVu in the buffer will produce HTML output using the same  
fonts which then can be converted to PDF for the purpose of printing,  
still using DejaVu.

--
Greetings

   Pete

Give a man a fish, and you've fed him for a day. Teach him to fish,  
and you've depleted the lake.





^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: print with DejaVu font from emacs
       [not found] ` <mailman.10350.1257784601.2239.help-gnu-emacs@gnu.org>
@ 2009-11-11 16:12   ` harven
  2009-11-11 19:23     ` Peter Dyballa
       [not found]     ` <mailman.10521.1257967402.2239.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 6+ messages in thread
From: harven @ 2009-11-11 16:12 UTC (permalink / raw)
  To: help-gnu-emacs

Thanks for your reply.
Instead of converting to html, I think I will just open the file in the
browser and print from there. DejaVu is also used as the default monospace 
in my browser.

I am a bit surprised by your comment on postscript not supporting unicode.
I successfully print unicode/DejaVu text files from gedit. Redirecting
the output to a virtual printer, I get a well behaved postscript file
that displays the DejaVu fonts without problem. From what I have seen,
the unicode characters appearing in the text file are redefined in
the postscript. I don't know what part of the gnome desktop generates the 
postscript though.

Is there some plan (or obstruction) to implement that feature in emacs
with ps-print ? That is, being able to print a buffer with the (unicode, ttf) 
font actually displayed in the buffer instead of the bdf default Courier ?
Or maybe I can put it on the wishlist.

Sincerely, 


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: print with DejaVu font from emacs
  2009-11-11 16:12   ` harven
@ 2009-11-11 19:23     ` Peter Dyballa
       [not found]     ` <mailman.10521.1257967402.2239.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 6+ messages in thread
From: Peter Dyballa @ 2009-11-11 19:23 UTC (permalink / raw)
  To: harven; +Cc: help-gnu-emacs


Am 11.11.2009 um 17:12 schrieb harven:

> Thanks for your reply.
> Instead of converting to html, I think I will just open the file in  
> the
> browser and print from there. DejaVu is also used as the default  
> monospace
> in my browser.

That's exactly what htmlize.el and htmlize-view.el do: they prepare  
an Unicode encoded buffer easily as HTML which is then "sent" to an  
external HTML viewer (a so-called "browser") which can use the OS'  
desktop mechanisms to print that Unicode contents as PDF Unicode.

>
> I am a bit surprised by your comment on postscript not supporting  
> unicode.


PostScript is 8 bit! It might be elder then you. PostScript fonts can  
larger, maybe contain 1,000 glyphs. These are accessed by an  
encoding, which is 8 bit. TeX, a bit elder then PS, is essentially 7  
bit. The trick of a "virtual font,\x05" something like a "fontset" in  
GNU Emacs, allows it to access two 7-bit encoded fonts as if it were  
one 8-bit font. Similarly by using a whole stack of encodings TeX is  
able to access some percent of Unicode. Particular mechanisms in TeX  
and in PostScript allow to print in CJK.


BTW, I am not that sure that your GNOME desktop creates PostScript  
files! (It would necessitate CID fonts.) You can easily check this by  
disabling the printer queue. Then any print output is queued in but  
not sent to the printer. So you have (almost) infinite time to locate  
the queue's content and check the files' type – possibly with super- 
user privileges. And I am sure you'll find PDF...

--
Greetings

   Pete

Encryption, n.:
	A powerful algorithmic encoding technique employed in the creation  
of computer manuals.





^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: print with DejaVu font from emacs
       [not found]     ` <mailman.10521.1257967402.2239.help-gnu-emacs@gnu.org>
@ 2009-11-11 21:43       ` harven
  2009-11-11 23:10         ` Peter Dyballa
  0 siblings, 1 reply; 6+ messages in thread
From: harven @ 2009-11-11 21:43 UTC (permalink / raw)
  To: help-gnu-emacs

Peter Dyballa <Peter_Dyballa@Web.DE> writes:

> Am 11.11.2009 um 17:12 schrieb harven:
> BTW, I am not that sure that your GNOME desktop creates PostScript
> files! (It would necessitate CID fonts.) You can easily check this by
> disabling the printer queue. Then any print output is queued in but
> not sent to the printer. So you have (almost) infinite time to locate
> the queue's content and check the files' type – possibly with super- 
> user privileges. And I am sure you'll find PDF...

I just tried your suggestion. From the virtual printer, I can choose
ps or pdf for the output. When I choose ps, I get a file starting with

%!PS-Adobe-3.0
%%Creator: cairo 1.8.0 (http://cairographics.org)
%%CreationDate: Wed Nov 11 22:06:56 2009
%%Pages: 1
%%BoundingBox: 0 0 612 792
%%DocumentData: Clean7Bit
%%LanguageLevel: 2
...

From the cairographics webpage, I see that the fonts are always subsetted 
and embedded. Later in the file, I find

  Encoding 1 /uni222C put
  Encoding 2 /uni006D put
  Encoding 3 /uni006F put
  ...
 /sfnts [  
 <00010000000a008000030020636d61700043f0c90000080c0000005863767420e997070c0000
 0864000002306670676d5b026bdf00000a94000000ac676c79663d08b488000000ac00000760

which corresponds to the unicode characters I typed. Finally, when I open
the file on a computer which does not have the DejaVu fonts, the "postscript" 
correctly displays the text with the DejaVu fonts. So what do you think ? 
I may be fooled by the headers, I don't know much about postscript.

BTW, Am I wrong, or emacs23 now depends on cairo for 2D display ?

Cheers


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: print with DejaVu font from emacs
  2009-11-11 21:43       ` harven
@ 2009-11-11 23:10         ` Peter Dyballa
  0 siblings, 0 replies; 6+ messages in thread
From: Peter Dyballa @ 2009-11-11 23:10 UTC (permalink / raw)
  To: harven; +Cc: help-gnu-emacs


Am 11.11.2009 um 22:43 schrieb harven:

> Finally, when I open
> the file on a computer which does not have the DejaVu fonts, the  
> "postscript"
> correctly displays the text with the DejaVu fonts. So what do you  
> think ?

Cairo obviously has expanded PostScript use remarkably. It is  
embedding the TT font (large number of glyphs), as it should, and it  
seems to create one or more arbitrary encodings to encode just the  
characters used. Clever! (Could you send me privately this PS file?  
You don't need to print anything, lprm will remove anything from the  
queue.)

>
> BTW, Am I wrong, or emacs23 now depends on cairo for 2D display ?

I cannot explain a thing on this issue, but I can tell that Cairo is  
part of GNOME/GTK – and nowhere in GNU Emacs code some Cairo function  
is used. So it's some part of GTK which needs Cairo functions.

--
Greetings

   Pete

Life is the only flaw in an otherwise perfect nonexistence
				– Schopenhauer





^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2009-11-11 23:10 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-11-09 15:38 print with DejaVu font from emacs harven
2009-11-09 16:36 ` Peter Dyballa
     [not found] ` <mailman.10350.1257784601.2239.help-gnu-emacs@gnu.org>
2009-11-11 16:12   ` harven
2009-11-11 19:23     ` Peter Dyballa
     [not found]     ` <mailman.10521.1257967402.2239.help-gnu-emacs@gnu.org>
2009-11-11 21:43       ` harven
2009-11-11 23:10         ` Peter Dyballa

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).