all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* display-supports-face-attributes-p question
       [not found] <87lf4kzkf7.fsf.ref@yahoo.com>
@ 2021-08-29  9:09 ` Po Lu
  2021-08-29 10:58   ` Eli Zaretskii
  0 siblings, 1 reply; 8+ messages in thread
From: Po Lu @ 2021-08-29  9:09 UTC (permalink / raw)
  To: emacs-devel


I can't seem to make `display-supports-face-attribute-p' return non-nil
for '(:slant italic) on window-system frames in the Haiku terminal
backend I'm working on.

If my understanding is correct, it should return t if a font driver is able
to find a font matching the spec (:slant italic), but it's not working.

Does anyone know what could be wrong here?  Thanks.



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

* Re: display-supports-face-attributes-p question
  2021-08-29  9:09 ` display-supports-face-attributes-p question Po Lu
@ 2021-08-29 10:58   ` Eli Zaretskii
  2021-08-29 11:22     ` Po Lu
  0 siblings, 1 reply; 8+ messages in thread
From: Eli Zaretskii @ 2021-08-29 10:58 UTC (permalink / raw)
  To: Po Lu; +Cc: emacs-devel

> From: Po Lu <luangruo@yahoo.com>
> Date: Sun, 29 Aug 2021 17:09:48 +0800
> 
> 
> I can't seem to make `display-supports-face-attribute-p' return non-nil
> for '(:slant italic) on window-system frames in the Haiku terminal
> backend I'm working on.
> 
> If my understanding is correct, it should return t if a font driver is able
> to find a font matching the spec (:slant italic), but it's not working.
> 
> Does anyone know what could be wrong here?  Thanks.

Not working in what sense?  Does it fail in
gui_supports_face_attributes_p or does it fail elsewhere?  If it's in
gui_supports_face_attributes_p, can you step through the code there
with a debugger and describe what exactly doesn't work?

Thanks.



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

* Re: display-supports-face-attributes-p question
  2021-08-29 10:58   ` Eli Zaretskii
@ 2021-08-29 11:22     ` Po Lu
  2021-08-29 12:05       ` Eli Zaretskii
  0 siblings, 1 reply; 8+ messages in thread
From: Po Lu @ 2021-08-29 11:22 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel

Eli Zaretskii <eliz@gnu.org> writes:

> Not working in what sense?  Does it fail in
> gui_supports_face_attributes_p or does it fail elsewhere?  If it's in
> gui_supports_face_attributes_p, can you step through the code there
> with a debugger and describe what exactly doesn't work?

It appears that gui_face_attributes_p can't find properties differing
between the :slant italic font and the default font; the EQ comparison
at xfaces.c:5163 always evaluates to true.  What confuses me is how this
is possible, as, if I understand correctly, (struct font *)->props
should be populated by `make_font_object' from the contents of the
entity, and if the font driver finds a font with :slant italic, the
entity should also have it's slant set to italic.

TIA



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

* Re: display-supports-face-attributes-p question
  2021-08-29 11:22     ` Po Lu
@ 2021-08-29 12:05       ` Eli Zaretskii
  2021-08-29 13:54         ` Po Lu
  0 siblings, 1 reply; 8+ messages in thread
From: Eli Zaretskii @ 2021-08-29 12:05 UTC (permalink / raw)
  To: Po Lu; +Cc: emacs-devel

> From: Po Lu <luangruo@yahoo.com>
> Cc: emacs-devel@gnu.org
> Date: Sun, 29 Aug 2021 19:22:44 +0800
> 
> It appears that gui_face_attributes_p can't find properties differing
> between the :slant italic font and the default font; the EQ comparison
> at xfaces.c:5163 always evaluates to true.  What confuses me is how this
> is possible, as, if I understand correctly, (struct font *)->props
> should be populated by `make_font_object' from the contents of the
> entity, and if the font driver finds a font with :slant italic, the
> entity should also have it's slant set to italic.

When the call to lookup_face in gui_supports_face_attributes_p gets
into realize_gui_face, please show the results of

  (gdb) pp attrs[LFACE_FONT_INDEX]

before and after the call to font_load_for_lface in this snippet:

      if (! FONT_OBJECT_P (attrs[LFACE_FONT_INDEX]))
	attrs[LFACE_FONT_INDEX]
	  = font_load_for_lface (f, attrs, Ffont_spec (0, NULL));



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

* Re: display-supports-face-attributes-p question
  2021-08-29 12:05       ` Eli Zaretskii
@ 2021-08-29 13:54         ` Po Lu
  2021-08-29 14:30           ` Eli Zaretskii
  0 siblings, 1 reply; 8+ messages in thread
From: Po Lu @ 2021-08-29 13:54 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel

Eli Zaretskii <eliz@gnu.org> writes:

> When the call to lookup_face in gui_supports_face_attributes_p gets
> into realize_gui_face, please show the results of
>
>   (gdb) pp attrs[LFACE_FONT_INDEX]
>
> before and after the call to font_load_for_lface in this snippet:
>
>       if (! FONT_OBJECT_P (attrs[LFACE_FONT_INDEX]))
> 	attrs[LFACE_FONT_INDEX]
> 	  = font_load_for_lface (f, attrs, Ffont_spec (0, NULL));

Before:
    #<font-spec nil haiku Noto\ Sans\ Mono nil iso8859-1 normal nil normal 12 nil 100 0 ((:user-spec . "monospace"))>

And after:
    #<font-object "-haiku-Noto Sans Mono-normal-normal-normal-*-12-*-*-*-m-0-iso8859-1">

I don't exactly understand what the code does, but that seems wrong.  I
think both the spec and the object should be italic?



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

* Re: display-supports-face-attributes-p question
  2021-08-29 13:54         ` Po Lu
@ 2021-08-29 14:30           ` Eli Zaretskii
  2021-08-30  1:11             ` Po Lu
  0 siblings, 1 reply; 8+ messages in thread
From: Eli Zaretskii @ 2021-08-29 14:30 UTC (permalink / raw)
  To: Po Lu; +Cc: emacs-devel

> From: Po Lu <luangruo@yahoo.com>
> Cc: emacs-devel@gnu.org
> Date: Sun, 29 Aug 2021 21:54:38 +0800
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> >       if (! FONT_OBJECT_P (attrs[LFACE_FONT_INDEX]))
> > 	attrs[LFACE_FONT_INDEX]
> > 	  = font_load_for_lface (f, attrs, Ffont_spec (0, NULL));
> 
> Before:
>     #<font-spec nil haiku Noto\ Sans\ Mono nil iso8859-1 normal nil normal 12 nil 100 0 ((:user-spec . "monospace"))>
> 
> And after:
>     #<font-object "-haiku-Noto Sans Mono-normal-normal-normal-*-12-*-*-*-m-0-iso8859-1">
> 
> I don't exactly understand what the code does, but that seems wrong.  I
> think both the spec and the object should be italic?

No, only the second one.  The first one is generic, with the :slant
slot unspecified.

So it looks like the problem is inside font_load_for_lface.  Please
step into it, then into font_find_for_lface that one calls, and tell
what is the value of 'entities' here:

	      for (l = 0; SYMBOLP (adstyle[l]); l++)
		{
		  ASET (work, FONT_ADSTYLE_INDEX, adstyle[l]);
		  entities = font_list_entities (f, work); <<<<<<<<<<<<<<<
		  if (! NILP (entities))

It should be a list of font-entity objects, at least some of which
have the 'italic' value in the :slant slot.

Or maybe the code behaves differently in your case, and doesn't even
get to that place?  If so, please try to figure out why.



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

* Re: display-supports-face-attributes-p question
  2021-08-29 14:30           ` Eli Zaretskii
@ 2021-08-30  1:11             ` Po Lu
  2021-08-30 11:47               ` Eli Zaretskii
  0 siblings, 1 reply; 8+ messages in thread
From: Po Lu @ 2021-08-30  1:11 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel

Eli Zaretskii <eliz@gnu.org> writes:

> It should be a list of font-entity objects, at least some of which
> have the 'italic' value in the :slant slot.

Thanks for the help, I think I've found the problem: my code doesn't
have problems detecting italic styles, but it can't detect italic styles
when monospace is explictly specified.  There are indeed no
font-entities with :slant italic.



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

* Re: display-supports-face-attributes-p question
  2021-08-30  1:11             ` Po Lu
@ 2021-08-30 11:47               ` Eli Zaretskii
  0 siblings, 0 replies; 8+ messages in thread
From: Eli Zaretskii @ 2021-08-30 11:47 UTC (permalink / raw)
  To: Po Lu; +Cc: emacs-devel

> From: Po Lu <luangruo@yahoo.com>
> Cc: emacs-devel@gnu.org
> Date: Mon, 30 Aug 2021 09:11:46 +0800
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> > It should be a list of font-entity objects, at least some of which
> > have the 'italic' value in the :slant slot.
> 
> Thanks for the help, I think I've found the problem: my code doesn't
> have problems detecting italic styles, but it can't detect italic styles
> when monospace is explictly specified.  There are indeed no
> font-entities with :slant italic.

Glad I was able to help.  This area (font selection) of the Emacs code
is notoriously under-documented, and I don't consider myself an expert
on its inner workings.



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

end of thread, other threads:[~2021-08-30 11:47 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <87lf4kzkf7.fsf.ref@yahoo.com>
2021-08-29  9:09 ` display-supports-face-attributes-p question Po Lu
2021-08-29 10:58   ` Eli Zaretskii
2021-08-29 11:22     ` Po Lu
2021-08-29 12:05       ` Eli Zaretskii
2021-08-29 13:54         ` Po Lu
2021-08-29 14:30           ` Eli Zaretskii
2021-08-30  1:11             ` Po Lu
2021-08-30 11:47               ` Eli Zaretskii

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.