alexmurray / flycheck-posframe

Show flycheck errors via posframe.el
60 stars 9 forks source link

childframe uses a different font #3

Closed CSRaghunandan closed 6 years ago

CSRaghunandan commented 6 years ago

Screenshot for reference:

screen shot 2018-03-04 at 7 53 07 pm

The childframe uses a different font than the one I'm using for emacs. Is this a design choice ?

alexmurray commented 6 years ago

Can you please try with the latest version (https://github.com/alexmurray/flycheck-posframe/commit/50ddda67f74a04c78642c756baf47edd0488035b) - I just made a change which allows the face to be customised and removes the previously hardcoded face settings.

CSRaghunandan commented 6 years ago

@alexmurray It's still displaying with a different font

alexmurray commented 6 years ago

Ok how are you configuring your normal font for emacs? Can you please provide some instructions on how to reproduce?

CSRaghunandan commented 6 years ago

This is my font configuration. I always run emacs in daemon-mode and connect using emacsclient.

;; set PragmataPro font only if it available
(defun rag-set-face (frame)
  "Configure faces on frame creation"
  (select-frame frame)
  (if (display-graphic-p)
      (progn
        (when (member "PragmataPro" (font-family-list))
          (progn
            (require 'setup-pragmatapro)
            (set-frame-font "PragmataPro-13"))))))
(add-hook 'after-make-frame-functions 'rag-set-face)

;; set frame font when running emacs normally
(when (member "PragmataPro" (font-family-list))
  (progn
    (require 'setup-pragmatapro)
    (set-frame-font "PragmataPro-13")))
alexmurray commented 6 years ago

Instead of using set-frame-font you could use:

(set-face-attribute 'default nil :font "PragmataPro" :height 13)

Since flycheck-posframe-face inherits from the default face.

Or you could just customize flycheck-posframe-face?

alexmurray commented 6 years ago

See https://www.emacswiki.org/emacs/SetFonts#toc2 for more details

CSRaghunandan commented 6 years ago

(set-face-attribute 'default nil :font "PragmataPro" :height 13)

When I put this in my init file, emacs won't load the font any font all when I'm running as emacsclient. Not sure whats going on. I get a completely blank emacs.

I guess i'll just set the flycheck-posframe-face manually. What is a sane default value for this variable?

alexmurray commented 6 years ago

You could try setting it in a after-make-frame-functions and server-visit-hook - this is how I do it to work with emacsclient: https://github.com/alexmurray/dot_emacs.d/blob/master/init.el#L232

CSRaghunandan commented 6 years ago

Agh found out why I was having issues. I guess 13 is too less of a value for font height in (set-face-attribute 'default nil :font "PragmataPro" :height 13)

I set it to 125 and now it's working fine. Though for some reason emacs is now not maximizing window size automatically when run as emacsclient. Not sure whats going on there

Any idea what is the equivalent font height I should set for a font size of 13?

alexmurray commented 6 years ago

Ahh my bad - 130 or something close to that should be the equivalent as far as I know.

CSRaghunandan commented 6 years ago

But now flycheck-posframe is using the same font as my frame 👍

alexmurray commented 6 years ago

Awesome - can you please comment with what the solution was in the end so other can benefit if they have a similar problem - and feel free to close the issue then too.

CSRaghunandan commented 6 years ago

Had to replace (set-frame-font "PragmataPro-13") with (set-face-attribute 'default nil :font "PragmataPro" :height 125), but that caused emacs to not start in fullscreen anymore. Had to add a call to toggle-frame-maximized after that. Not sure if that's an idiomatic way of handling things. I also have (add-to-list 'default-frame-alist '(fullscreen . maximized)). But looks like that's not effecting emacsclient.

Commit in my .emacs.d

CSRaghunandan commented 6 years ago

But I'm curious. Why does (set-frame-font "PragmataPro-13") not have effect for flycheck-posframe?

alexmurray commented 6 years ago

We specify the face to inherit from default - I can only assume set-frame-font does not change the default face but something else...

CSRaghunandan commented 6 years ago

By looking at the documentation, adding this to my init file fixed the issue: (set-frame-font "PragmataPro-13" nil t)

need to set the 3rd parameter to set-frame-font:


If FRAMES is non-nil, it should be a list of frames to act upon,
or t meaning all existing graphical frames.```