pitkali / pos-tip

Show tooltip at point
37 stars 14 forks source link

Invalid face attribute :font "-unknown-DejaVu Sans Mono-normal-normal-normal-*-15-*-*-*-m-0-iso10646-1" #10

Closed wasamasa closed 9 years ago

wasamasa commented 9 years ago

Reproduction steps:

  1. emacs -Q
  2. M-: (package-initialize)
  3. M-: (require 'pos-tip)
  4. M-: (pos-tip-show "foobar")

Expected result: Display of a popup without any warnings. Actual result: Display of a popup with warnings.

To be more precise, the warning seems to be triggered by either the font attribute for the face used for the popup or the font parameter for the popup. It seems a bit silly to set these considering the value of the attribute is derived from the current frame font. Is there any special reason for doing things that way or can it be dropped?

pitkali commented 9 years ago

As a person that did not implement any of it, as previously explained, I can't immediately tell. I'll have to investigate.

pitkali commented 9 years ago

FWIW, it seems to be triggered by propertizing string using string as a :font. If I remove that property from the list passed to pos-tip-show-no-propertize, or wrap around the value with (find-font (font-spec :name )), I get no warning.

So the way this seems to be working right now (or, rather, is supposed to be working) is that pos-tip-show sets the :font for the text to be frame font, which is now semi-obsolete and equivalent to :font attribute of the default face. Then it passes that to pos-tip-show-no-propertize, which additionally copies :font parameter from the target frame, and provides it to x-show-tip.

The thing that has me slightly worried is that x-show-tip uses mframe for the frame argument, which is obtained from mouse-pixel-position, and at least theoretically may thus not be the same as the frame used for getting the face. In which case the font needs to be set to ensure current behaviour, and what needs to be fixed is the way it is done.

Apparently font parameter of a frame will always return a string with font name. It should not be passed verbatim to propertize then, and instead converted to a proper font object with font-spec & find-font.