0

How to autoinstall fonts to system (e.g. for all-the-icon support) on first init run like autoinstalling emacs packages. I need crossplatfom solution (mac and linux). Or what is best practice to avoid it? For example, I don't remember that I installed fonts manually when I tried spacemacs. Thanks!

  • "yes" and "no" would be valid answers, yet probably wouldn't satisfy you, so better rephrase this to make it clear what kind of answer you're looking for (e.g. "how <blablabla>?"). – Stefan Feb 28 '17 at 12:51
  • I'm not sure if it can be done easily on every operating system. From what I recall, it's not possible to do on windows without admin access, so might not work there. I don't know how it's done on macOS, so I can't help with it. The documentation mentions only double clicking fonts, and I don't have a mac to figure it out. A good pointer to start might be the system-type variable, and when it comes to checking if fonts were already installed, the file-exists-p function should be the right one to use. – DoMiNeLa10 Mar 2 '17 at 17:38
  • To the extent the O.P. is referring ["all-the icon support"] to the ability to use certain icons like XPM or SVG, this is not related to installing fonts. Instead, Emacs needs to be built with certain image support. To see whether Emacs has been built to support certain image types, see image-type-available-p – lawlist Mar 6 '17 at 22:51
2
+50

Installing fonts can be done in many different ways and needs to be done in different ways in different cases (depending on the underlying system, depending on whether you want it to be available globally or not). You can probably come up with some ad-hoc code which tries to handle the most common cases, but it would probably be better to do it as a shell script than as an Elisp program (so that it can be reused elsewhere, since it's fundamentally unrelated to Emacs itself).

I don't think such a script/tool exists already, sadly.

As for the best practice to deal with the problem, it likely depends on why you need to install a font, but I'd guess that the best practice is to arrange for your package not to depend on the presence of a particular font (e.g. just use standard and common Unicode chars and nothing more exotic).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.