emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/svg-lib a11267c23b 1/2: Ascent can now be set using pro


From: ELPA Syncer
Subject: [elpa] externals/svg-lib a11267c23b 1/2: Ascent can now be set using properties
Date: Wed, 6 Jul 2022 13:58:00 -0400 (EDT)

branch: externals/svg-lib
commit a11267c23b369e44e02ac8d99996b761d899881e
Author: Nicolas P. Rougier <Nicolas.Rougier@inria.fr>
Commit: Nicolas P. Rougier <Nicolas.Rougier@inria.fr>

    Ascent can now be set using properties
---
 svg-lib.el | 26 ++++++++++++++++----------
 1 file changed, 16 insertions(+), 10 deletions(-)

diff --git a/svg-lib.el b/svg-lib.el
index 8002a09f78..42c67edfc6 100644
--- a/svg-lib.el
+++ b/svg-lib.el
@@ -162,8 +162,9 @@ 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)
+      :ascent        center ;; Position / baseline
+      :crop-left     nil    ;; Whether to crop on left (for collage with other 
tags)
+      :crop-right    nil    ;; Whether to crop on righ (for collage with other 
tags)
 
       :collection    "material" ;; Icon collection
       
@@ -264,7 +265,8 @@ and style elements ARGS."
 
          (svg-width       (+ tag-width (* margin txt-char-width)))
          (svg-height      tag-height)
-
+         (svg-ascent      (plist-get style :ascent))
+         
          (tag-x  (* (- svg-width tag-width)  alignment))
          (text-x (+ tag-x (/ (- tag-width (* (length label) tag-char-width)) 
2)))
          (text-y ascent)
@@ -286,7 +288,7 @@ and style elements ARGS."
     (svg-text svg label
               :font-family font-family :font-weight font-weight  :font-size 
font-size
               :fill foreground :x text-x :y  text-y)
-    (svg-lib--image svg :ascent 'center)))
+    (svg-lib--image svg :ascent svg-ascent)))
 
 
 ;; Create a progress pie
@@ -323,7 +325,8 @@ and style elements ARGS."
 
          (svg-width       (+ tag-width (* margin txt-char-width)))
          (svg-height      tag-height)
-
+         (svg-ascent      (plist-get style :ascent))
+         
          ;; (tag-x           (/ (- svg-width tag-width) 2))
 
          (cx              (/ svg-width  2))
@@ -355,7 +358,7 @@ and style elements ARGS."
                     (elliptical-arc ((,iradius ,iradius ,x1 ,y1
                                       :sweep t :large-arc ,large-arc))))
               :fill foreground))
-    (svg-lib--image svg :ascent 'center)))
+    (svg-lib--image svg :ascent svg-ascent)))
 
 
 
@@ -394,7 +397,8 @@ and style elements ARGS."
 
          (svg-width       (+ tag-width (* margin txt-char-width)))
          (svg-height      tag-height)
-
+         (svg-ascent      (plist-get style :ascent))
+         
          (tag-x (/ (- svg-width tag-width) 2))
          (svg (svg-create svg-width svg-height)))
 
@@ -412,7 +416,7 @@ and style elements ARGS."
                        (- tag-height stroke (* 2 padding))
                        :fill foreground :rx (- radius (/ stroke 2.0)))
     
-    (svg-lib--image svg :ascent 'center)))
+    (svg-lib--image svg :ascent svg-ascent)))
 
 
 
@@ -472,6 +476,7 @@ given STYLE and style elements ARGS."
          (box-height      (* height txt-char-height))
          (svg-width       (+ box-width (* margin txt-char-width)))
          (svg-height      box-height)
+         (svg-ascent      (plist-get style :ascent))
          (box-x           (/ (- svg-width box-width) 2))
          (box-y           0)
 
@@ -510,7 +515,7 @@ given STYLE and style elements ARGS."
         (svg-node svg 'path :d path
                             :fill foreground
                             :transform icon-transform)))
-    (svg-lib--image svg :ascent 'center)))
+    (svg-lib--image svg :ascent svg-ascent)))
 
 
 
@@ -555,6 +560,7 @@ and style elements ARGS."
 
          (svg-width       (+ tag-width (* margin txt-char-width)))
          (svg-height      tag-height)
+         (svg-ascent      (plist-get style :ascent))
          
          (tag-x (/ (- svg-width tag-width) 2))
          (text-x (+ tag-x (/ (- tag-width (* (length label) tag-char-width)) 
2)))
@@ -597,7 +603,7 @@ and style elements ARGS."
         (svg-node svg 'path :d path
                             :fill foreground
                             :transform icon-transform)))
-    (svg-lib--image svg :ascent 'center)))
+    (svg-lib--image svg :ascent svg-ascent)))
 
 
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]