unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Re: master 4351722: Make shr render text with superscripts prettier
       [not found] ` <20211120104250.84A13209FD@vcs0.savannah.gnu.org>
@ 2021-11-20 13:26   ` Stefan Monnier
  2021-11-21  8:23     ` Lars Ingebrigtsen
  0 siblings, 1 reply; 4+ messages in thread
From: Stefan Monnier @ 2021-11-20 13:26 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: emacs-devel

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)




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: master 4351722: Make shr render text with superscripts prettier
  2021-11-20 13:26   ` master 4351722: Make shr render text with superscripts prettier Stefan Monnier
@ 2021-11-21  8:23     ` Lars Ingebrigtsen
  2021-11-21 14:24       ` Stefan Monnier
  0 siblings, 1 reply; 4+ messages in thread
From: Lars Ingebrigtsen @ 2021-11-21  8:23 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel

Stefan Monnier <monnier@iro.umontreal.ca> writes:

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

tex-mode has an entire machinery to figure out all that stuff (with a
bunch of user options, functions and faces).  I don't think bringing all
that into shr makes sense.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: master 4351722: Make shr render text with superscripts prettier
  2021-11-21  8:23     ` Lars Ingebrigtsen
@ 2021-11-21 14:24       ` Stefan Monnier
  2021-11-21 19:27         ` Lars Ingebrigtsen
  0 siblings, 1 reply; 4+ messages in thread
From: Stefan Monnier @ 2021-11-21 14:24 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: emacs-devel

Lars Ingebrigtsen [2021-11-21 09:23:28] wrote:
> Stefan Monnier <monnier@iro.umontreal.ca> writes:
>> We should share the script size (and the script's raise/lower) with the
>> settings used in `tex-mode.el`.
> tex-mode has an entire machinery to figure out all that stuff (with a
> bunch of user options, functions and faces).  I don't think bringing all
> that into shr makes sense.

I wasn't thinking of bringing it into shr.el as much as moving it into
a shared place.  If you think it's over-engineered then you can streamline
it along the way ;-)


        Stefan




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: master 4351722: Make shr render text with superscripts prettier
  2021-11-21 14:24       ` Stefan Monnier
@ 2021-11-21 19:27         ` Lars Ingebrigtsen
  0 siblings, 0 replies; 4+ messages in thread
From: Lars Ingebrigtsen @ 2021-11-21 19:27 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel

Stefan Monnier <monnier@iro.umontreal.ca> writes:

> I wasn't thinking of bringing it into shr.el as much as moving it into
> a shared place.  If you think it's over-engineered then you can streamline
> it along the way ;-)

The 'sup.el library. 

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-11-21 19:27 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20211120104249.11206.17692@vcs0.savannah.gnu.org>
     [not found] ` <20211120104250.84A13209FD@vcs0.savannah.gnu.org>
2021-11-20 13:26   ` master 4351722: Make shr render text with superscripts prettier Stefan Monnier
2021-11-21  8:23     ` Lars Ingebrigtsen
2021-11-21 14:24       ` Stefan Monnier
2021-11-21 19:27         ` Lars Ingebrigtsen

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).