From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Tomas Hlavaty Newsgroups: gmane.emacs.devel Subject: Re: "Why is emacs so square?" Date: Sun, 07 Jun 2020 10:03:35 +0200 Message-ID: <874krns3oo.fsf@logand.com> References: <863691n4xl.wl-me@enzu.ru> <86blno9yle.wl-me@enzu.ru> <87d0845msg.fsf@yahoo.com> <87h7xgjasw.fsf@yahoo.com> <875zdwjais.fsf@yahoo.com> <6a198677-41b6-4dbd-39d0-2b01550d53cf@yandex.ru> <32f6a2ce-e30f-059f-dcd4-233d666a10a1@yandex.ru> <87zh9hrxfj.fsf@logand.com> <83img4aegz.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="124042"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun Jun 07 10:05:16 2020 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jhqIt-000WBR-Vf for ged-emacs-devel@m.gmane-mx.org; Sun, 07 Jun 2020 10:05:15 +0200 Original-Received: from localhost ([::1]:59778 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jhqIt-0005we-2z for ged-emacs-devel@m.gmane-mx.org; Sun, 07 Jun 2020 04:05:15 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:60190) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jhqIQ-0005WN-7R for emacs-devel@gnu.org; Sun, 07 Jun 2020 04:04:46 -0400 Original-Received: from logand.com ([37.48.87.44]:59024) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jhqIO-0007P2-U9; Sun, 07 Jun 2020 04:04:45 -0400 Original-Received: by logand.com (Postfix, from userid 1001) id 281311ACD9A; Sun, 7 Jun 2020 10:03:37 +0200 (CEST) X-Mailer: emacs 26.3 (via feedmail 11-beta-1 I) In-Reply-To: <83img4aegz.fsf@gnu.org> Received-SPF: pass client-ip=37.48.87.44; envelope-from=tom@logand.com; helo=logand.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/07 04:03:37 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:251992 Archived-At: Eli Zaretskii writes: >> From: Tomas Hlavaty >> Date: Fri, 05 Jun 2020 23:54:08 +0200 >> Cc: emacs-devel@gnu.org >> >> It seems that there is some code in Emacs dealing with unicode >> fonts in order to generate postscript files. Any pointers where >> to start with this? > > I think you should provide more details about the particular problem > you are trying to solve here, because I don't think I understand it. > Emacs generally knows only about fonts it uses for its own display, > and it needs to load the font before it can provide information about > it. Whereas you seem to be talking about fonts to be used in the PDF > file, not in Emacs display. I poked around a bit and it seems that what I did in emacs-pdf (pdf-buffer function) is similar to what ps-print-buffer function does in ps-print and ps-mule with ps-multibyte-buffer set to nil. Now I want something like ps-multibyte-buffer, e.g. pdf-multibyte-buffer so that I can use non-ASCII characters in the generated PDF. So I probably want to implement something similar to ps-multibyte-buffer cases of non-latin-printer, bdf-font and/or bdf-font-except-latin. There seem to be ps-bdf so maybe I have to look, if I can reuse something when generating PDF. >> b) After that, emacs-pdf will understand font metrics so it will be >> possible to do layout. > > I very much doubt you can do sensible layout in Lisp. shr.el tries, > but the result is slow and incomplete -- and it does that with text > displayed by Emacs itself, whereas you are talking about something > more ambitious. For printing, this might not be an issue. > If you want to do layout for PDF, I think one way forward would be to > implement a pdfterm.c "terminal" for Emacs, which produces PDF like > the existing *term.c backends do for supported display types. I'll have a look, thanks. >> c) There are functions frame-width and frame-height. Are there also >> functions something like buffer-width and buffer-height and or a >> way to compute x and y position relative to frame origin, which >> would allow me to position images exactly in the buffer similar to >> what w3m browser does? > > Yes, there are, but they need a window to compute these metrics. > Without a live window, "buffer width" is meaningless, because buffer > text doesn't define the fonts (more generally, the typefaces) used for > displaying the text. Only a window in which a buffer is displayed > provides enough typeface information to do these calculations. I see. There is frame-position but no window-position. Is there a way to get window position in a frame? >> 4) Emacs is missing some kind of canvas, where things could be drawn and >> which would handle pixel precise input. >> >> For example, I would like to browse OpenStreetMap in Emacs. I wrote >> a console based OSM browser osmq >> and web-based OSM browser at >> . I would prefer an Emacs based map browser. >> However, I have not figured out how to lay out images in Emacs in a >> grid and how to detect which image was clicked. A bonus would be, >> where exactly was clicked. Any ideas what should I look into? > > Emacs supports "hot spots" on images for this: a click on an image > returns information about pixel-resolution offset of the click from > the image origin. I think that's what you want, although I'm not 100% > sure. Yes. Is there an example how to start with this? > We also support displaying slices of images, in case that helps to > produce a smarter layout of images. Great. Is there an example? >> It seems to me that these points are precondition for a WYSIWYG document >> editor feature in Emacs. > > FWIW, I don't think these points are necessarily preconditions for > WYSIWYG features. They are important and useful features, but a > WYSIWYG document editor should IMO start with something whose > beginning we have in enriched-mode. That mode currently lacks the > ability of laying out text in variable-pitch typefaces, which I think > is the first extension of enriched-mode that should be worked on. > Followed by page layout and page breaks, intelligent sectioning > commands, etc. etc. And yes, printing is also important, whether it > is done by producing PDF or PostScript or any other intermediate > format. Interesting. Maybe the pdfterm.c you suggested is kind of canvas I wrote about. When there is all that complexity with pixel perfect drawing and layout, it would be shame to limit it to enriched mode. But it is still too early to make decisions in this direction. Thank you for your help and quick and helpful answers!