branch: externals/svg-tag-mode commit 4fdc7ffbb30175fc483dc4078664b95a5299e150 Author: Nicolas P. Rougier <nicolas.roug...@inria.fr> Commit: Nicolas P. Rougier <nicolas.roug...@inria.fr>
Fixed font weights --- example-2.el | 18 +++++++----------- svg-tag-mode.el | 14 +++++++++++++- 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/example-2.el b/example-2.el index 0e98fd8acc..a5f54c978e 100644 --- a/example-2.el +++ b/example-2.el @@ -17,17 +17,17 @@ (defface svg-tag-todo-face '((t :foreground "#ffffff" :background "#FFAB91" :box "#FFAB91" - :family "Roboto Mono" :weight light :height 120)) + :family "Roboto Mono" :weight regular :height 120)) "Face for TODO svg tag" :group nil) (defface svg-tag-next-face '((t :foreground "white" :background "#673AB7" :box "#673AB7" - :family "Roboto Mono" :weight light :height 120)) + :family "Roboto Mono" :weight regular :height 120)) "Face for NEXT svg tag" :group nil) (defface svg-tag-done-face '((t :foreground "white" :background "#B0BEC5" :box "#B0BEC5" - :family "Roboto Mono" :weight light :height 120)) + :family "Roboto Mono" :weight regular :height 120)) "Face for DONE svg tag" :group nil) (defface svg-tag-date-face @@ -37,7 +37,7 @@ (defface svg-tag-org-face '((t :foreground "black" :background "white" :box "black" - :family "Roboto Mono" :weight light :height 120)) + :family "Roboto Mono" :weight regular :height 120)) "Default face for svg tag" :group nil) (setq radius 2) @@ -75,10 +75,6 @@ ;; Priorities: [#A] [#B] [#C] ;; Date: <2020-11-07 Sat> -;; DONE Make a pull request on melpa <2020-11-07 Sat> -;; NEXT Wait for review -;; TODO Post on Reddit - - - - +;; DONE Make a pull request on melpa <2020-11-07 Sat> +;; NEXT Wait for review +;; TODO Post on Reddit diff --git a/svg-tag-mode.el b/svg-tag-mode.el index a15a1aeefd..9c664e0402 100644 --- a/svg-tag-mode.el +++ b/svg-tag-mode.el @@ -112,6 +112,16 @@ allows to create dynamic tags." :type '(repeat (cons (string :tag "Keyword") (sexp :tag "Tag")))) +;; SVG font weights translation +(setq svg-tag--font-weights '((thin . 100) + (ultralight . 200) + (light . 300) + (regular . 400) + (medium . 500) + (semibold . 600) + (bold . 700) + (extrabold . 800) + (black . 900))) (defun svg-tag-make (text &optional face inner-padding outer-padding radius) "Create a SVG image displaying TEXT in a rounded box using FACE style. @@ -126,7 +136,9 @@ INNER-PADDING, OUTER-PADDING and RADIUS controls the visual aspect of the box." (line-width (or (plist-get (face-attribute face :box) :line-width) svg-tag-default-line-width)) (family (face-attribute face :family)) - (weight (face-attribute face :weight)) +;; (weight (face-attribute face :weight)) + (weight (cdr (assoc (face-attribute face :weight) + svg-tag--font-weights))) (size (/ (face-attribute face :height) 10)) (tag-char-width (window-font-width nil face))