unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH v2] emacs: add notmuch-logo.svg and use it in emacs mua on graphic displays
@ 2021-12-14 22:10 Tomi Ollila
  2021-12-16 16:44 ` David Bremner
  0 siblings, 1 reply; 5+ messages in thread
From: Tomi Ollila @ 2021-12-14 22:10 UTC (permalink / raw)
  To: notmuch

emacs/notmuch-logo.svg is handcrafted scalable vector graphics version
of the notmuch logo.

Emacs on graphic displays render this image four times in size compared
to the emacs/notmuch-logo.png, and the image is much sharper.

The rendered image size, 100x110 pixels, fits reasonably well with
text shown in various font sizes.

Scaling the image -- if desired -- may come in the future. For now
this is improvement on how the logo looked in notmuch-hello window.
---

In this version 2, of id:20211101225336.29070-1-tomi.ollila@iki.fi.

Dropped dimensions from 200x220 to 100x110; scaling in emacs is nontrivial;
imagemagick can do it but then it renders background white which looks bad
when using "dark" mode. (press '+' and '-' on top of the image and see
background going white (in this case it also scales the pixel image, 
does not re-render svg).

Spent a bit of time with svg.el -- then noticed it does not support
translate, rotate nor scale. In order to use that I would have to
calculate the final pixels (and if we desired scaling, then dynamically
counting dimensions and pixel endpoints...)

If scaling does not improve in (future) emaces, one option could be
to parse the xml, change image dimensions, add scale (and background
rectangle) nodes, then write xml to string and load that image
(whether that works or not, I don't know -- or if that is good idea)


 debian/elpa-notmuch.elpa |  2 +-
 emacs/Makefile.local     |  2 +-
 emacs/notmuch-hello.el   |  2 +-
 emacs/notmuch-logo.svg   | 27 +++++++++++++++++++++++++++
 4 files changed, 30 insertions(+), 3 deletions(-)
 create mode 100644 emacs/notmuch-logo.svg

diff --git a/debian/elpa-notmuch.elpa b/debian/elpa-notmuch.elpa
index 4712b73f..7b3ce0fa 100644
--- a/debian/elpa-notmuch.elpa
+++ b/debian/elpa-notmuch.elpa
@@ -1,3 +1,3 @@
 debian/tmp/usr/share/emacs/site-lisp/*.el
-debian/tmp/usr/share/emacs/site-lisp/notmuch-logo.png
+debian/tmp/usr/share/emacs/site-lisp/notmuch-logo.svg
 emacs/notmuch-pkg.el
diff --git a/emacs/Makefile.local b/emacs/Makefile.local
index d1b320c3..0f1f0eb2 100644
--- a/emacs/Makefile.local
+++ b/emacs/Makefile.local
@@ -42,7 +42,7 @@ emacs_mua := $(dir)/notmuch-emacs-mua
 emacs_mua_desktop := $(dir)/notmuch-emacs-mua.desktop
 
 emacs_images := \
-	$(srcdir)/$(dir)/notmuch-logo.png
+	$(srcdir)/$(dir)/notmuch-logo.svg
 
 emacs_bytecode = $(emacs_sources:.el=.elc)
 emacs_docstrings = $(emacs_sources:.el=.rsti)
diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
index acd48c9b..fc007c4c 100644
--- a/emacs/notmuch-hello.el
+++ b/emacs/notmuch-hello.el
@@ -198,7 +198,7 @@ (defcustom notmuch-saved-search-sort-function nil
 (defvar notmuch-hello-indent 4
   "How much to indent non-headers.")
 
-(defimage notmuch-hello-logo ((:type png :file "notmuch-logo.png")))
+(defimage notmuch-hello-logo ((:type svg :file "notmuch-logo.svg")))
 
 (defcustom notmuch-show-logo t
   "Should the notmuch logo be shown?"
diff --git a/emacs/notmuch-logo.svg b/emacs/notmuch-logo.svg
new file mode 100644
index 00000000..6fdeb71d
--- /dev/null
+++ b/emacs/notmuch-logo.svg
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg xmlns="http://www.w3.org/2000/svg"
+     height="110" width="100" fill="#000" stroke-width="1">
+  <circle cx="50" cy="5" r="5" />
+  <g transform="translate(50 20) rotate(20)">
+    <circle cx="-47" cy="0" r="3" />
+    <circle cx="47"  cy="0" r="3" />
+    <path d="M-47 -1  L0 -3  L47 -1 L47 1  L0 3  L-47 1 Z" />
+  </g>
+  <path d="M49 4  L45 100
+	   A5 5  0  0 1  40 105  L20 105  A5 5  0  0 0  15 110
+	   L85 110
+	   A5 5  0  0 0  80 105  L60 105  A5 5  0  0 1  55 100
+	   L55 100  L51 4 Z" />
+  <g fill="#fff" stroke="#000">
+    <rect x="7" y="33" width="30" height="18" />
+    <line x1="7"  y1="51" x2="18" y2="41" />
+    <line x1="37" y1="51" x2="26" y2="41" />
+    <polyline points="7 33  22 44  37 33" fill="none" />
+  </g>
+  <path d="M-18 0  A25 20  0  0 0  18 0" transform="translate(22 51)" />
+  <path d="M-18 0  A25 20  0  0 0  18 0" transform="translate(78 72)" />
+  <g fill="none" stroke="#000">
+    <path d="M9  52  l13  -42  l13  42" />
+    <path d="M91 73  l-13 -42  l-13 42" />
+  </g>
+</svg>
-- 
2.25.1

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

end of thread, other threads:[~2021-12-21 13:53 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-14 22:10 [PATCH v2] emacs: add notmuch-logo.svg and use it in emacs mua on graphic displays Tomi Ollila
2021-12-16 16:44 ` David Bremner
2021-12-16 22:10   ` Tomi Ollila
2021-12-21 11:04     ` David Bremner
2021-12-21 13:44       ` Alexander Adolf

Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

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).