[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/svg-lib 7f5f806: Added a crop left/right parameter for
From: |
ELPA Syncer |
Subject: |
[elpa] externals/svg-lib 7f5f806: Added a crop left/right parameter for tags collage |
Date: |
Wed, 22 Dec 2021 09:57:32 -0500 (EST) |
branch: externals/svg-lib
commit 7f5f8068de7365d02e57e2dc8828f774c3d4d91f
Author: Nicolas P. Rougier <Nicolas.Rougier@inria.fr>
Commit: Nicolas P. Rougier <Nicolas.Rougier@inria.fr>
Added a crop left/right parameter for tags collage
---
svg-lib.el | 21 ++++++++++++++++-----
1 file changed, 16 insertions(+), 5 deletions(-)
diff --git a/svg-lib.el b/svg-lib.el
index 5ffac5a..17ab8b4 100644
--- a/svg-lib.el
+++ b/svg-lib.el
@@ -4,7 +4,7 @@
;; Maintainer: Nicolas P. Rougier <Nicolas.Rougier@inria.fr>
;; URL: https://github.com/rougier/svg-lib
-;; Version: 0.2.1
+;; Version: 0.2.2
;; Package-Requires: ((emacs "27.1"))
;; Keywords: svg, icons, tags, convenience
@@ -67,6 +67,9 @@
;;; NEWS:
+;; Version 0.2.2
+;; - Added a left/righ crop style argument to allow for tags collage.
+
;; Version 0.2.1
;; - Added an alignment parameter for moving tags inside margins.
@@ -150,6 +153,8 @@ to the default face)."
:width 20 ;; In characters
:height 0.90 ;; Ratio of text line height
:scale 0.75 ;; Icon scaling
+ :crop-left nil ;; Wheter to crop on left (for collage with other
tags)
+ :crop-right nil ;; Wheter to crop on righ (for collage with other
tags)
:collection "material" ;; Icon collection
@@ -220,7 +225,10 @@ and style elements ARGS."
(foreground (plist-get style :foreground))
(background (plist-get style :background))
- (alignment (plist-get style :alignment))
+ (crop-left (plist-get style :crop-left))
+ (crop-right (plist-get style :crop-right))
+
+ (alignment (plist-get style :alignment))
(stroke (plist-get style :stroke))
;; (width (plist-get style :width))
(height (plist-get style :height))
@@ -244,11 +252,15 @@ and style elements ARGS."
(svg-width (+ tag-width (* margin txt-char-width)))
(svg-height tag-height)
- ;; (tag-x (/ (- svg-width tag-width) 2))
(tag-x (* (- svg-width tag-width) alignment))
-
(text-x (+ tag-x (/ (- tag-width (* (length label) tag-char-width))
2)))
(text-y ascent)
+
+ (tag-x (if crop-left (- tag-x txt-char-width) tag-x))
+ (tag-width (if crop-left (+ tag-width txt-char-width) tag-width))
+ (text-x (if crop-left (- text-x (/ stroke 2)) text-x))
+ (tag-width (if crop-right (+ tag-width txt-char-width) tag-width))
+ (text-x (if crop-right (+ text-x (/ stroke 2)) text-x))
(svg (svg-create svg-width svg-height)))
@@ -264,7 +276,6 @@ and style elements ARGS."
(svg-image svg :ascent 'center)))
-
;; Create a progress pie
(defun svg-lib-progress-pie (value &optional style &rest args)
"Create a progress pie image with value VALUE using given STYLE
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [elpa] externals/svg-lib 7f5f806: Added a crop left/right parameter for tags collage,
ELPA Syncer <=