Function: hfy-flatten-style
hfy-flatten-style is a byte-compiled function defined in
htmlfontify.el.gz.
Signature
(hfy-flatten-style STYLE)
Documentation
Take STYLE and merge any multiple attributes appropriately.
For the format of STYLE, see hfy-face-to-style-i and
hfy-face-to-style. Return a hfy-style-assoc.
Currently only font-size is merged down to a single occurrence - others may need special handling, but I haven't encountered them yet.
Source Code
;; Defined in /usr/src/emacs/lisp/htmlfontify.el.gz
;; size is different, in that in order to get it right at all,
;; we have to trawl the inheritance path, accumulating modifiers,
;; _until_ we get to an absolute (pt) specifier, then combine the lot
(defun hfy-flatten-style (style)
"Take STYLE and merge any multiple attributes appropriately.
For the format of STYLE, see `hfy-face-to-style-i' and
`hfy-face-to-style'. Return a `hfy-style-assoc'.
Currently only font-size is merged down to a single occurrence -
others may need special handling, but I haven't encountered them
yet."
;;(message "(hfy-flatten-style %S)" style) ;;DBUG
(let ((m (list 1))
(x nil)
(r nil))
(dolist (css style)
(if (string= (car css) "font-size")
(progn
(when (not x) (push (hfy--size-to-int (cdr css)) m))
(when (string-match "pt" (cdr css)) (setq x t)))
(push css r)))
;;(message "r: %S" r)
(let ((n (apply #'* m)))
(nconc (nreverse r) (hfy-size (if x (round n) (float n)))))))