emacs-devel
[Top][All Lists]
Advanced

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

Re: master 4351722: Make shr render text with superscripts prettier


From: Stefan Monnier
Subject: Re: master 4351722: Make shr render text with superscripts prettier
Date: Sat, 20 Nov 2021 08:26:59 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

We should share the script size (and the script's raise/lower) with the
settings used in `tex-mode.el`.


        Stefan


Lars Ingebrigtsen [2021-11-20 05:42:50] wrote:

> branch: master
> commit 4351722477cda59d88e5b1a90aa92cd6902021a8
> Author: Lars Ingebrigtsen <larsi@gnus.org>
> Commit: Lars Ingebrigtsen <larsi@gnus.org>
>
>     Make shr render text with superscripts prettier
>     
>     * lisp/net/shr.el (shr-sup): New face.
>     (shr-tag-sup, shr-tag-sub): Use it to make the super/subscripts
>     slightly smaller so that we don't get uneven line heights with
>     text that uses these.
> ---
>  lisp/net/shr.el | 11 +++++++++--
>  1 file changed, 9 insertions(+), 2 deletions(-)
>
> diff --git a/lisp/net/shr.el b/lisp/net/shr.el
> index 5a36f19..87bacd4 100644
> --- a/lisp/net/shr.el
> +++ b/lisp/net/shr.el
> @@ -183,6 +183,11 @@ temporarily blinks with this face."
>    "Face for <abbr> elements."
>    :version "27.1")
>  
> +(defface shr-sup
> +  '((t :height 0.8))
> +  "Face for <sup> and <sub> elements."
> +  :version "29.1")
> +
>  (defface shr-h1
>    '((t :height 1.3 :weight bold))
>    "Face for <h1> elements."
> @@ -1464,12 +1469,14 @@ ones, in case fg and bg are nil."
>  (defun shr-tag-sup (dom)
>    (let ((start (point)))
>      (shr-generic dom)
> -    (put-text-property start (point) 'display '(raise 0.2))))
> +    (put-text-property start (point) 'display '(raise 0.2))
> +    (add-face-text-property start (point) 'shr-sup)))
>  
>  (defun shr-tag-sub (dom)
>    (let ((start (point)))
>      (shr-generic dom)
> -    (put-text-property start (point) 'display '(raise -0.2))))
> +    (put-text-property start (point) 'display '(raise -0.2))
> +    (add-face-text-property start (point) 'shr-sup)))
>  
>  (defun shr-tag-p (dom)
>    (shr-ensure-paragraph)




reply via email to

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