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

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

[elpa] externals/engrave-faces e063673 32/36: html: add support for weig


From: ELPA Syncer
Subject: [elpa] externals/engrave-faces e063673 32/36: html: add support for weight and height
Date: Tue, 31 Aug 2021 01:57:29 -0400 (EDT)

branch: externals/engrave-faces
commit e063673cf6896a902d17386cf425a39090119a11
Author: TEC <tec@tecosaur.com>
Commit: TEC <tec@tecosaur.com>

    html: add support for weight and height
---
 engrave-faces-html.el | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)

diff --git a/engrave-faces-html.el b/engrave-faces-html.el
index d4ce0fc..ee32412 100644
--- a/engrave-faces-html.el
+++ b/engrave-faces-html.el
@@ -56,7 +56,8 @@ See `engrave-faces-preset-styles' and 
`engrave-faces-html-output-style'."
         (st    (plist-get attrs      :strike-through))
         (ul    (plist-get attrs      :underline))
         (it    (eql (plist-get attrs :slant) 'italic))
-        (wt    (plist-get attrs      :weight)))
+        (wt    (plist-get attrs      :weight))
+        (ht    (plist-get attrs      :height)))
     (mapconcat
      #'identity
      (delq nil
@@ -66,9 +67,23 @@ See `engrave-faces-preset-styles' and 
`engrave-faces-html-output-style'."
             (when st "text-decoration: line-through;")
             (when ul "text-decoration: underline;")
             (when it "text-decoration: italic;")
-            (when wt (format "font-weight: %s;" wt))))
+            (when wt (format "font-weight: %s;" (engrave-faces-html-css-weight 
wt)))
+            (when (and ht (floatp ht)) (format "font-size: %sem" ht))))
      seperator)))
 
+(defun engrave-faces-html-css-weight (weight)
+  (pcase weight
+    ('ultra-light 100) ('extra-light 100)
+    ('light 200) ('thin 200)
+    ('semi-light 300)
+    ('book 400) ('normal 400) ('regular 400)
+    ('medium 500)
+    ('semi-bold 600) ('demi-bold 600)
+    ('bold 700)
+    ('extra-bold 800)
+    ('heavy 900) ('ultra-bold 900)
+    ('black 950)))
+
 (defun engrave-faces-html-face-apply (faces content)
   (let ((attrs (engrave-faces-merge-attributes faces)))
     (concat "<span style=\"" (engrave-faces-html-gen-style-css attrs " ") "\">"



reply via email to

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