From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Arthur Miller Newsgroups: gmane.emacs.devel Subject: Re: Emacs Survey: Toolbars Date: Tue, 22 Dec 2020 18:52:48 +0100 Message-ID: References: <87o8iv3ac3.fsf@gnus.org> <877dpjp30g.fsf@ucl.ac.uk> <87zh2fnmwq.fsf@gnus.org> <87o8ivumn5.fsf@telefonica.net> <87v9d3nkxk.fsf@gnus.org> <83k0t9rfj5.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="10291"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: Gregory Heytings , rms@gnu.org, emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Dec 22 18:54:06 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 1krlrJ-0002S3-Gs for ged-emacs-devel@m.gmane-mx.org; Tue, 22 Dec 2020 18:54:05 +0100 Original-Received: from localhost ([::1]:54476 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1krlrI-0005F7-JP for ged-emacs-devel@m.gmane-mx.org; Tue, 22 Dec 2020 12:54:04 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:40832) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1krlqG-0004lA-7V for emacs-devel@gnu.org; Tue, 22 Dec 2020 12:53:00 -0500 Original-Received: from mail-am7eur06olkn2043.outbound.protection.outlook.com ([40.92.16.43]:41153 helo=EUR06-AM7-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1krlq9-0004Gg-Jk; Tue, 22 Dec 2020 12:52:59 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DClWcpCAxHRc+IuX/gAEgFa7qPB5EcLSy99txXZKkMwoEXIGCZ3/NBVYoRnYlK9X7FrOxWPY9Qc9TiMnVboR4sSCbLutm5KV3ea3L1kVnDwDR3MIsi0mMaordzIjn+iPLls4dstSlT4MbeA3t7RejyuUZda40u4Regkq1jZ2z7vKxDoRQ0gP2kuiSajHcGeeNjh0X3UCKLK9J6Mr+gDOVvU/Fv6ZnH3iS/1yGNBleJuhpAX9CSrIW4pPMHMJ1Zs8f8WKulVG/WubCkl76wgPRAhgDb0Uf98sInJKp6MQqol2D28101pylhiI4eYvhjYuJZt+QY4g/XHagovaakfitg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=BEg1W5dNSEwb1uPenoo/Xh/nBqR26Pl8feNXSAG/yZU=; b=k3RoafGBhicZYWerMTPxyh2joeHFG51nmNsgNsLl1iX+Oi5OPiswitcswYQ6+MF9vVXQ9VM5rTQwBzigwdr2peVat7sYSCqALtXrKB4kvoxpLZxZ03/twpxm1OxTznonC3ZA6h3tsP+fr9Gevc6lpIV+kfqGW9PoFjTuXYqF/ZdlY66c9iww/bVW3Em3VWWJpcqXqJ7Gc4xkQ8Kuo7ICSiecXESJNWkACeUXhC+kO1kjoDPn0O26Iw22w+CzLKkvE2wLfWRd/KPOOCXjI3yAXe28nCHfV9s9rxGcnvLzOfM8h7BEIxfmq2vbjDqboAYVtwFoJx+fWd1oNdHFHW2HWQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=live.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=BEg1W5dNSEwb1uPenoo/Xh/nBqR26Pl8feNXSAG/yZU=; b=DKpLh/odTaMXp90wFvoYkbAxcJc3S/1UilqAa7K10vQ1AnT7M+vhoY5he9Hs6Zdhmh8oCZtYteP6cQP6A16keSAPOVS/xml9Ea0MJ3SxRl+K0QYIvLoo15irEYt1UgGxLh1tgtHM3vyNDH/MgVW2cYbMnzRxZ20A7BXYdkWxTfNe7CvrveY7wfyBoMa5jbK82ZPVZ3WlCiyHWc3CqNQOPXvoZ5/WS7NkiDz5Ltxvx5cRCkgU0/fKuufml7AW63Pul/oUj4OJcqSfshs/RrsU27/JLmQb6PR/Rt0xkzvDHIUPZOwelwCuhq6HgRH9hx+c/C2cHOZHVB8Yo5ZHDB656g== Original-Received: from DB8EUR06FT030.eop-eur06.prod.protection.outlook.com (2a01:111:e400:fc35::47) by DB8EUR06HT204.eop-eur06.prod.protection.outlook.com (2a01:111:e400:fc35::355) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3676.22; Tue, 22 Dec 2020 17:52:50 +0000 Original-Received: from AM0PR06MB6577.eurprd06.prod.outlook.com (2a01:111:e400:fc35::48) by DB8EUR06FT030.mail.protection.outlook.com (2a01:111:e400:fc35::316) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3676.22 via Frontend Transport; Tue, 22 Dec 2020 17:52:50 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:EB92A864595E97076C0C9C4555C9B74A829F98760A1D4F0843A1F33967D2D1FF; UpperCasedChecksum:7A53992D0EC783C6A215BB461331A7BE86A7D81489B269086550F2CE4F4B619B; SizeAsReceived:9016; Count:46 Original-Received: from AM0PR06MB6577.eurprd06.prod.outlook.com ([fe80::9487:8c7d:da00:4993]) by AM0PR06MB6577.eurprd06.prod.outlook.com ([fe80::9487:8c7d:da00:4993%8]) with mapi id 15.20.3676.033; Tue, 22 Dec 2020 17:52:49 +0000 In-Reply-To: <83k0t9rfj5.fsf@gnu.org> (Eli Zaretskii's message of "Tue, 22 Dec 2020 18:06:54 +0200") X-TMN: [ysR8BTUjBb5BNKVotKkFlp+9jR00HRUV] X-ClientProxiedBy: AM5PR0601CA0033.eurprd06.prod.outlook.com (2603:10a6:203:68::19) To AM0PR06MB6577.eurprd06.prod.outlook.com (2603:10a6:208:19a::23) X-Microsoft-Original-Message-ID: <87v9ctbudr.fsf@live.com> X-MS-Exchange-MessageSentRepresentingType: 1 Original-Received: from pascal.homepc (90.230.29.56) by AM5PR0601CA0033.eurprd06.prod.outlook.com (2603:10a6:203:68::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3700.27 via Frontend Transport; Tue, 22 Dec 2020 17:52:49 +0000 X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 46 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: 89ffcbd3-1963-4734-5710-08d8a6a265f0 X-MS-TrafficTypeDiagnostic: DB8EUR06HT204: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: bjqrjUDQ4NwvDLPFj9+ncEElqxr1czhNORuL3m2CrkgK5Aaweu7jKvJcCxaS7kJPikNfPi/t+CwlKPcY3t9vgXSf9FhusbO2tqhTXmMcYJemNxqHD2SyEToFVYDD1uN491ca5IJ/ERCbweQQQvbpcdLf5MTCyzGb0K4l7uR7rq55pY9zjH4I8L+LTlg6J9gNojQ2lzy8RofRv1usQjAe3t49+IXSxzuWjMR41UGlzPBBhh3MvfbebW7enkegdzVb X-MS-Exchange-AntiSpam-MessageData: l6GKLo/rKnS3LrDgxsB5DZVRvFbRCilU0nYyzAp/5cv/CmV7nW/vya7K9taZgvqsG4694uLO20chH+JItE8121XopQmxNno2ybruDTQH5PdN2stgS63wa4zDzrZ+icBNKXWmtxqYXUnw1ExN8fl+Lw== X-OriginatorOrg: live.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Dec 2020 17:52:49.7161 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-Network-Message-Id: 89ffcbd3-1963-4734-5710-08d8a6a265f0 X-MS-Exchange-CrossTenant-AuthSource: DB8EUR06FT030.eop-eur06.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: Internet X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8EUR06HT204 Received-SPF: pass client-ip=40.92.16.43; envelope-from=arthur.miller@live.com; helo=EUR06-AM7-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, MSGID_FROM_MTA_HEADER=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no 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:261517 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Eli Zaretskii writes: >> Date: Tue, 22 Dec 2020 11:03:04 +0000 >> Cc: emacs-devel@gnu.org >> From: Gregory Heytings via "Emacs development discussions." >>=20 >> > I've been trying for more than 10 years to urge people to work toward= =20 >> > giving Emacs the document capabilities of a word processor, but I have= =20 >> > not convinced people to do this work. >> What do you mean by this? I'm probably biased, but I don't see what=20 >> important "capability of a word processor" is lacking in Emacs. Personally I think Emacs is half-wysiwyg, or more then half by now. I think there are almost all tools needed to implement a word processor a l=C3=A1 Word already in Emacs; I think there is just some minor details needed; like renderer that can draw efficient representation of a page below a buffer text (a rectangle) and to tie the text editing stuff to pixels rather then columns. I was experimenting with modelling a page in Emacs in context of some other discussion, and that was what I found a tad bit awkward. But I am bad at Elisp, and what Emacs already has, so hopefully Eli will step in and say: "we already have this." To explain myself: A word processor usually has some representation of page in paper format. We can modell a page easily as a region; but it would take work to implement text processing functions to work with "pages" (insert, delete etc). It is not hard part, it is just labourous. Problem is when presenting an empty page to the user to work with in Emacs windows. There i= s need to draw some kind of rectangle representing page and user would type in text above it. Emacs renderer has svg which can render rectangles fast, but can it render below the buffer text? If it can then you have everythign needed. I don't know how to do it though. It is also a bit awkward to work with window-text-pixel-size and=20 window-lines-pixel-dimensions because they need a text to being able to calculate something. When buffer is empty, there is nothing to calculate. There is need to tell Emacs: "I wish a buffer of this pixel width and height". In some way. That is what I have seen as a problem, but it is maybe possible, I am just not aware of funcionality I can use. I have made a small demo, just roughly modelling a page. To overcome the need for content in buffer in order to display something, the idea was to insert "filler-spaces" so I could have something for renderer to display. I ment to see if I can implement same behaviour as Emacs does for invisible text: to restrict cursor motion into filler-spaces. But I never come to that part. The idea was also to model columns, headers, footers etc just regions in a buffer and to adjust insertion/deletion routines for "page-mode" so cursor movement, and all the other editing would look like in a word processor. For example deleteion would delete a character but insert a filler-character, insertion would insert a character but delete a filler-character and so on. I think it is possible, it is just lots of labour I don't have time for tht myself. For illustration purpose I have attached the demo I worked on if anyone would like to look at it, maybe continue or maybe just get an idea how to implement it more efficiently. Paper size database has to be evaluated forst, then page.el. It was just a small test I never got back to, so take it just as a small illustration. Demo is font dependent so with of the rendered page will depend on what font Emacs uses to calculate (whatever is default). On my machine it is Anonymous Pro. --=-=-= Content-Type: text/plain Content-Disposition: attachment; filename=page.el ;;; page.el --- -*- lexical-binding: t; -*- ;; Copyright (C) 2020 Arthur Miller ;; Author: Arthur Miller ;; Keywords: ;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation, either version 3 of the License, or ;; (at your option) any later version. ;; This program is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; You should have received a copy of the GNU General Public License ;; along with this program. If not, see . ;;; Commentary: ;; ;; documnet is just a plain buffer with bunch of local variables ;; ;; page, footer, header and clientarea are ranges between points in the ;; buffer ;; (bopp) (eopp) (bohp) (eohp) (bocp) (eocp) <- similar as (bobp) (eobp) ;; ;; currently footer and header are global for all pages; it would be easy to ;; make them page-unique; just not done currently ;; ;;; Code: (require 'svg) (require 'paper-size-iso) (defface fill-face '((t :foreground "white" :background "white" :box "white" :height 100)) "Default face for document background" :group 'doc) (defface page-break-face '((t :foreground "grey" :background "grey" :box "grey")) "Default face for page breaks" :group 'doc) (defun doc-page-break (doc) (let ((svg) (w) (h)) (with-current-buffer (get-buffer doc) (unless pagebreak-svg (setq w page-pixel-width h (window-font-height nil 'fill-face)) (message "W: %s H: %s" w h) (setq svg (svg-create w h)) (svg-rectangle svg 0 0 w h :fill "grey") (setq pagebreak-svg (svg-image svg :ascent 'center))) pagebreak-svg))) (defun doc-new (&optional title) (interactive) (unless title (setq title "New Document")) (let ((doc (generate-new-buffer title))) (with-current-buffer (get-buffer-create doc) (setq screen-res 96 print-res 300 format 'A4 orientation 'portrait pages 1 current-page 0 page-rows 0 page-cols 0 header nil footer nil document (current-buffer) pagebreak-svg nil real-pixel-width 0 page-pixel-width 0 page-pixel-height 0) (make-local-variable 'document) (make-local-variable 'title) (make-local-variable 'screen-res) (make-local-variable 'print-res) (make-local-variable 'format) (make-local-variable 'orientation) (make-local-variable 'pages) (make-local-variable 'current-page) (make-local-variable 'page-pixel-width) (make-local-variable 'page-pixel-height) (make-local-variable 'page-rows) (make-local-variable 'page-cols) (make-local-variable 'real-pixel-width) (make-local-variable 'header) (make-local-variable 'footer) (make-local-variable 'pagebreak-svg) (let ((dims (paper-size-iso-in-to-pixels format screen-res))) (setq page-pixel-width (car dims)) (setq page-pixel-height (cdr dims)))) (switch-to-buffer doc) (doc-insert-page doc (point-min)) document)) (defun doc-append-page () "Append a new page at the end" (interactive) (with-current-buffer (buffer-name) (doc-insert-page (buffer-name) (point-max)))) (defun doc-insert-pagebreak (buffer point) (with-current-buffer buffer (goto-char point) (setq real-pixel-width (car (window-text-pixel-size nil (beginning-of-line) (end-of-line)))) (insert ?\n) ;; (insert ?\^L) ;; (set-text-properties (line-beginning-position) (line-end-position) ;; `(face nil display ,(doc-page-break buffer))) ;; (newline) )) (defun doc-insert-footer (buffer point) (save-excursion (with-current-buffer buffer (goto-char point) (insert (buffer-substring (car footer) (cdr footer)))))) (defun doc-insert-header (buffer point) (save-excursion (with-current-buffer buffer (goto-char point) (insert (buffer-substring (car header) (cdr header)))))) (defun doc-insert-page (buffer point) "Insert page at point." (with-current-buffer buffer (hl-line-mode -1) (auto-fill-mode -1) (goto-char point) ;; Emacs needs a live window to calculate pixel sizes ;; so we have to calculate stuff when first page is shown (if (= 0 current-page) (let* ((w 0) (h 0) (space-width) (space-height) (d) (font-width (window-font-width nil 'fill-face)) (font-height (window-font-height nil 'fill-face))) (insert ?\s) (set-text-properties point (point-max) '(face fill-face)) (setq space-width (car (window-text-pixel-size nil (beginning-of-line) (end-of-line)))) (setq space-height (cdr (window-text-pixel-size nil (beginning-of-line) (end-of-line)))) (setq cols (truncate (fround (/ page-pixel-width font-width)))) (setq rows (truncate (fround (/ page-pixel-height font-height)))) (setq cols (+ cols (truncate (/ 158 font-width)))) ;; some nasty magick here (delete-backward-char 1) (setq page-cols cols page-rows rows) (while (< h rows) (self-insert-command cols ?\s) (setq h (+ h 1)) (newline))) (progn ;; we already have page dimensions (doc-insert-pagebreak buffer (point)) (setq point (point)) (dotimes (i page-rows) (self-insert-command page-cols ?\s) (newline)))) (set-text-properties point (point-max) '(face fill-face)) (setq current-page (+ current-page 1)) ;;(setq pages (append pages (list point (- (point-max) 1)))) )) (defun buffer-document (&optional buffer) (unless buffer (setq buffer (buffer-name))) (with-current-buffer (get-buffer buffer) document)) (defun doc-set-footer (begin end) "Set current region as footer." (interactive "r") (with-current-buffer (buffer-document) (setq footer (cons begin end)))) (defun doc-set-header (begin end) "Set current region as header." (interactive "r") (with-current-buffer (buffer-document) (setq header (cons begin end)))) (provide 'page) ;;; page.el ends here --=-=-= Content-Type: text/plain Content-Disposition: attachment; filename=paper-size-iso.el ;;; paper-size-iso-us.el --- -*- lexical-binding: t; -*- ;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation, either version 3 of the License, or ;; (at your option) any later version. ;; This program is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; You should have received a copy of the GNU General Public License ;; along with this program. If not, see . ;;; Commentary: ;; ;;; References: ;; http://www.printernational.org/iso-paper-sizes.php ;; https://papersizes.io/a/ ;; https://en.wikipedia.org/wiki/Pixel_density ;; https://blog.gimm.io/difference-between-pixel-px-and-point-pt-font-sizes-in-email-signatures/ ;; https://honeywellaidc.force.com/supportppr/s/article/How-to-convert-inches-in-dots ;; https://www.shutterstock.com/blog/inches-to-pixels-resize-image-quality ;; https://www.shutterstock.com/blog/ppi-vs-dpi-resolution-guidex ;; https://www.pixelsconverter.com/ (defvar paper-size-iso '(;; Size Width x Height(mm) Width x Height(in) (4A0 . [1682 2378 66.2 93.6 ]) (2A0 . [1189 1682 46.8 66.2 ]) (A0 . [841 1189 33.1 46.8 ]) (A1 . [594 841 23.4 33.1 ]) (A2 . [420 594 16.5 23.4 ]) (A3 . [297 420 11.7 16.5 ]) (A4 . [210 297 8.3 11.7 ]) (A5 . [148 210 5.8 8.3 ]) (A6 . [105 148 4.1 5.8 ]) (A7 . [74 105 2.9 4.1 ]) (A8 . [52 74 2.0 2.9 ]) (A9 . [37 52 1.5 2.0 ]) (A10 . [26 37 1.0 1.5 ]) (A11 . [18 26 0.7 1 ]) (A12 . [13 18 0.5 0.7 ]) (A13 . [9 13 0.4 0.5 ]) (2A0 . [1189 1682 46.8 66.2 ]) (4A0 . [1682 2378 66.2 93.6 ]) (A0+ . [914 1292 36 50.9 ]) (A1+ . [609 914 24 36 ]) (A3+ . [329 483 13 19 ]) (A2-extra . [445 619 17.51 24.3 ]) (A3-extra . [322 445 12.67 17.51]) (A3-Super . [305 508 12 20 ]) (Super-A3 . [305 487 12 19.17]) (A4-extra . [235 322 9.25 12.67]) (A4-Super . [229 322 9.25 12.67]) (Super-A4 . [227 356 8.93 14.01]) (A4-Long . [210 348 8.26 13.7 ]) (A5-extra . [173 235 8.26 9.25 ]) (SO-B5-extra . [202 276 7.95 10.86]) (B0 . [1000 1414 33.37 55.67]) (B1 . [707 1000 27.84 39.37]) (B2 . [500 707 19.69 27.84]) (B3 . [353 500 13.9 19.69]) (B4 . [250 352 9.84 13.9 ]) (B5 . [176 250 6.93 9.84 ]) (B6 . [125 176 4.92 6.93 ]) (B7 . [88 125 3.47 4.92 ]) (B8 . [62 88 2.44 3.47 ]) (B9 . [44 62 1.73 2.44 ]) (B10 . [31 44 1.22 1.73 ]) (B11 . [22 31 0.9 1.2 ]) (B12 . [15 22 0.6 0.9 ]) (B13 . [11 15 0.4 0.6 ]) (B0+ . [1118 1580 44 62.2 ]) (B1+ . [720 1020 28.3 40.2 ]) (B2+ . [520 720 20.5 28.3 ]) (C0 . [917 1297 36.12 51.6 ]) (C1 . [648 917 25.50 36.12]) (C2 . [458 648 18 25.50]) (C3 . [324 458 12.75 18 ]) (C4 . [229 324 9 12.75]) (C5 . [162 229 6.38 9 ]) (C6 . [114 162 4.5 6.38 ]) (C7 . [81 114 3.19 4.5 ]) (C8 . [57 81 2.2 3.2 ]) (C9 . [40 57 1.6 2.2 ]) (C10 . [28 40 1.1 1.6 ]) (C6/C5 . [229 114 9 4.5 ]) (C7/C6 . [81 162 3.19 6.38 ]) (DL . [110 220 4.32 8.69 ]) (E4 . [400 280 15.7 11 ]) )) (defun paper-size-dimensions (format) "Return dimensions in inch for given FORMAT as specified in ISO standard for paper sizes." (cdr (assoc format paper-size-iso))) (defun paper-size-iso-mm-to-pixels (format resolution) (let* ((dims (paper-size-dimensions format)) (width (aref dims 0)) (height (aref dims 1))) (paper-size-pixels width height 'mm resolution))) (defun paper-size-iso-in-to-pixels (format resolution) (let* ((dims (paper-size-dimensions format)) (width (aref dims 2)) (height (aref dims 3))) (paper-size-pixels width height 'in resolution))) (defun paper-size-pixels (width height unit resolution) "Return size in pixels from width and height. UNIT is unit of dimension measurement, either millimmeter or inches. For millimeter pass 'mm, for inches pass 'in. Resolution is number of either pixels per inches for the screen, or dots per inches for printers. Resolution-unit is either 'ppi for the screen or 'dpi for printers" (when (equal unit 'mm) (setq width (/ width 25.4)) (setq height (/ height 25.4))) (setq width (fround (* width resolution))) (setq height (fround (* height resolution))) (cons (ftruncate width) (ftruncate height))) (provide 'paper-size-iso) --=-=-=--