Skip to content
⌘ NSIS Forum Archive

Install and register font

4 posts

fabiochelly#

Install and register font

Hi,

Is there an internal command or a plugin to install and register a font without reboot?
fabiochelly#
Thank you very much.
Do I need to copy the file or anything else before calling the dll?
Or just calling the dll will also copy the file in $FONTS folder?
fabiochelly#
Here is my code:
  IfFileExists "$FONTS\andalemo.ttf" nofont
  SetOutPath "$FONTS"
  File "C:\WINDOWS\Fonts\andalemo.ttf"
  ReadRegStr $0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" "CurrentVersion"
  IfErrors 0 lbl_nt
    WriteRegStr HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Fonts" "Andale Mono (TrueType)" "andalemo.ttf"
    Goto regfont
  lbl_nt:
    WriteRegStr HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts" "Andale Mono (TrueType)" "andalemo.ttf"
  regfont:
    fonts::registerFont "Andale Mono (TrueType)"
  nofont: 
Can I simplify it? Do I really need to do all of this for each font I want to install?
Isn't it possible to create an single internal command that will install and register a font like in Innosetup?