unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* DPS font backend uses the wrong font
       [not found] <875ytvbxec.fsf.ref@yahoo.com>
@ 2021-10-17 13:20 ` Po Lu
  2021-10-17 13:35   ` Po Lu
  2021-10-17 17:32   ` Alan Third
  0 siblings, 2 replies; 5+ messages in thread
From: Po Lu @ 2021-10-17 13:20 UTC (permalink / raw)
  To: emacs-devel


As of 2028df78, font backends are required to use s->font instead of
s->face->font, even in the NS port, because s->face is now set to mouse
face by redisplay independently of terminal specific code.

Every font backend except for nsfont already does that, so it would make
sense to change nsfont to do it correctly as well.  But is there
something I'm missing here?

IOW, I'm suggesting to change the following snippet of nsfont_draw:

  font = (struct nsfont_info *)s->face->font;
  if (font == NULL)
    font = (struct nsfont_info *)FRAME_FONT (s->f);

to

  font = (struct nsfont_info *)s->font;
  if (font == NULL)
    font = (struct nsfont_info *)FRAME_FONT (s->f);

Thanks.



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

* Re: DPS font backend uses the wrong font
  2021-10-17 13:20 ` DPS font backend uses the wrong font Po Lu
@ 2021-10-17 13:35   ` Po Lu
  2021-10-17 17:35     ` Alan Third
  2021-10-17 17:32   ` Alan Third
  1 sibling, 1 reply; 5+ messages in thread
From: Po Lu @ 2021-10-17 13:35 UTC (permalink / raw)
  To: emacs-devel

Po Lu <luangruo@yahoo.com> writes:

> As of 2028df78, font backends are required to use s->font instead of
> s->face->font, even in the NS port, because s->face is now set to mouse
> face by redisplay independently of terminal specific code.

BTW, this also means a great deal of code in the NS port that looks
like:

      if (s->hl == DRAW_MOUSE_FACE)
        {
          face = FACE_FROM_ID_OR_NULL (s->f,
                                       MOUSE_HL_INFO (s->f)->mouse_face_face_id);
          if (!face)
            face = FACE_FROM_ID (s->f, MOUSE_FACE_ID);
        }
      else
        face = FACE_FROM_ID (s->f, s->first_glyph->face_id);

Can be removed now, because it's no longer necessary for
terminal-specific code to worry about the mouse face like this.



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

* Re: DPS font backend uses the wrong font
  2021-10-17 13:20 ` DPS font backend uses the wrong font Po Lu
  2021-10-17 13:35   ` Po Lu
@ 2021-10-17 17:32   ` Alan Third
  1 sibling, 0 replies; 5+ messages in thread
From: Alan Third @ 2021-10-17 17:32 UTC (permalink / raw)
  To: Po Lu; +Cc: emacs-devel

On Sun, Oct 17, 2021 at 09:20:43PM +0800, Po Lu wrote:
> 
> As of 2028df78, font backends are required to use s->font instead of
> s->face->font, even in the NS port, because s->face is now set to mouse
> face by redisplay independently of terminal specific code.
> 
> Every font backend except for nsfont already does that, so it would make
> sense to change nsfont to do it correctly as well.  But is there
> something I'm missing here?
> 
> IOW, I'm suggesting to change the following snippet of nsfont_draw:
> 
>   font = (struct nsfont_info *)s->face->font;
>   if (font == NULL)
>     font = (struct nsfont_info *)FRAME_FONT (s->f);
> 
> to
> 
>   font = (struct nsfont_info *)s->font;
>   if (font == NULL)
>     font = (struct nsfont_info *)FRAME_FONT (s->f);

Feel free to do whatever is required in nsfont.m, it's been basically
unmaintained for a decade or so afaict. My changes were simply to fix
crashes and remove macOS code that's no longer used (macOS builds use
macfont.m).

We really need someone to update nsfont to actually support things
like bold and italics and ideally use harfbuzz, but I've really
struggled with it, and I don't think anyone actually uses GNUstep
Emacs.
-- 
Alan Third



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

* Re: DPS font backend uses the wrong font
  2021-10-17 13:35   ` Po Lu
@ 2021-10-17 17:35     ` Alan Third
  2021-10-18  0:15       ` Po Lu
  0 siblings, 1 reply; 5+ messages in thread
From: Alan Third @ 2021-10-17 17:35 UTC (permalink / raw)
  To: Po Lu; +Cc: emacs-devel

On Sun, Oct 17, 2021 at 09:35:21PM +0800, Po Lu wrote:
> Po Lu <luangruo@yahoo.com> writes:
> 
> > As of 2028df78, font backends are required to use s->font instead of
> > s->face->font, even in the NS port, because s->face is now set to mouse
> > face by redisplay independently of terminal specific code.
> 
> BTW, this also means a great deal of code in the NS port that looks
> like:
> 
>       if (s->hl == DRAW_MOUSE_FACE)
>         {
>           face = FACE_FROM_ID_OR_NULL (s->f,
>                                        MOUSE_HL_INFO (s->f)->mouse_face_face_id);
>           if (!face)
>             face = FACE_FROM_ID (s->f, MOUSE_FACE_ID);
>         }
>       else
>         face = FACE_FROM_ID (s->f, s->first_glyph->face_id);
> 
> Can be removed now, because it's no longer necessary for
> terminal-specific code to worry about the mouse face like this.

Hmm, I wonder if this means mouse face will be honoured in SVG images
now...?

That would be nice because I couldn't work out how to find the mouse
face where we construct the image struct.
-- 
Alan Third



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

* Re: DPS font backend uses the wrong font
  2021-10-17 17:35     ` Alan Third
@ 2021-10-18  0:15       ` Po Lu
  0 siblings, 0 replies; 5+ messages in thread
From: Po Lu @ 2021-10-18  0:15 UTC (permalink / raw)
  To: Alan Third; +Cc: emacs-devel

Alan Third <alan@idiocy.org> writes:

> Hmm, I wonder if this means mouse face will be honoured in SVG images
> now...?

No, because it's applied in fill_XXX_glyph_string, which is after any
work image.c does, almost right before the glyph string is actually
drawn.



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

end of thread, other threads:[~2021-10-18  0:15 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <875ytvbxec.fsf.ref@yahoo.com>
2021-10-17 13:20 ` DPS font backend uses the wrong font Po Lu
2021-10-17 13:35   ` Po Lu
2021-10-17 17:35     ` Alan Third
2021-10-18  0:15       ` Po Lu
2021-10-17 17:32   ` Alan Third

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).