Open gaetgu opened 1 year ago
No, it's a recurrent problem that I've hard time fixing. Do you use any kind of magnification on your os?
I have the exactly the same problem in macOS with default configurations of monitor.
@ronisbr Do you have a second monitor ? What is your version of Emacs ?
@rougier Yes, I do! I am using Emacs 29. I will try removing the second monitor.
No, removing the second monitor did not change anything.
@ronisbr Could you tr the various fixes pointed by @gaetgu (#12 and #10) and the fork?
Hi @rougier !
I found the problem here! Everything started to work if I change this line:
(font-info (font-info (format "%s-%d" font-family font-size)))
to
(font-info (font-info "JetBrainsMono Nerd Font Mono"))
The problem is that the name of my font does not appear to follow the expected format! By default, font-size
is set to 10 whereas my font size is 13. If I change font-size
to 13, everything works perfectly.
EDIT:
I found the problem! The library is picking the default font probably at a stage where my current font is not defined. The following screenshot shows the default values:
I user JetBrainsMono with size 13.
The final fix for me is just to set the configuration as follows (Doom emacs):
(use-package! svg-tag-mode
:config
(plist-put svg-lib-style-default :font-family "JetBrainsMono Nerd Font")
(plist-put svg-lib-style-default :font-size 13))
After the modification:
Fantastic! Thanks for the very helpful debug! This size problem has plagued the library from the start without any obvious solution. Now the question is why do I not pick the right size when required? Do you know when your default font size is actually set?
Hi @rougier !
I have no idea. Since I use Doom Emacs, it has its own method to customize the default fonts. This is the code where I set the font in Doom: https://github.com/ronisbr/doom.d/blob/25c12efa4dc90ca2b6b2824047c33fc4f2b596d4/settings/setup-theme.el#L3 It is a variable that is used to set Emacs fonts at some stage.
If we manage to find a hook that runs after that, we might just add comments to the README here instructing the users to add a specific function to that hook setting the fonts in svg-tag-mode.
I see. Then maybe a warning/howto in the README would be our best option since I don't think it's possible to have a hook on default font change.
Re: above regarding hooks and such, for temp fix I'm doing the following:
(use-package! svg-lib
:init (add-hook 'after-setting-font-hook (lambda () (setq svg-lib-style-default (svg-lib-style-compute-default)))))
Which seems to alleviate the issue for me.
Will try to add more debug info i've found soon
(presumably same thing if using svg-tag-mode directly just replace as necessary)
Oh, the after-setting-font-hook
is really useful. Maybe we could include your fix in the lib.
Could you make a PR (for this and svg-lib as well since it may suffer from the same problem)
I am trying to get svg-tags set up with org mode (using org-modern and doom emacs). However, I am having some issues. Here is what the tags look like:
I have looked through some of the other issues (mostly #12 and #10) and I have tried using the fork from PR #14, with no success. I am wondering if there is anything obvious that I am missing?