Skip to content
⌘ NSIS Forum Archive

How to use FontRegAdv to install fonts

5 posts

mohessaid#

How to use FontRegAdv to install fonts

Hi,

I am using NSIS to build an installer for my application, but I need to install also some fonts to use them in the app. I am using the fonts macros here. But I get an error in the un.Fonts section (uninstalling the fonts) here is my code

This one for the uninstall:

Section "un.Fonts"
StrCpy $FONT_DIR $FONTS

!insertmacro RemoveTTF '$FONT_DIR\digital-7(italic).ttf'
!insertmacro RemoveTTF '$FONT_DIR\digital-7 (mono italic).ttf'
!insertmacro RemoveTTF '$FONT_DIR\digital-7 (mono).ttf'
!insertmacro RemoveTTF '$FONT_DIR\digital-7.ttf'
!insertmacro RemoveTTF '$FONT_DIR\DIGITALDREAM.ttf'
!insertmacro RemoveTTF '$FONT_DIR\DroidKufi-Bold.ttf'
!insertmacro RemoveTTF '$FONT_DIR\DroidKufi-Regular.ttf'
!insertmacro RemoveTTF '$FONT_DIR\DroidNaskh-Bold.ttf'
!insertmacro RemoveTTF '$FONT_DIR\DroidNaskh-Regular.ttf'
!insertmacro RemoveTTF '$FONT_DIR\NotoKufiArabic-Bold.ttf'
!insertmacro RemoveTTF '$FONT_DIR\NotoKufiArabic-Regular.ttf'
!insertmacro RemoveTTF '$FONT_DIR\NotoNaskhArabicUI-Bold.ttf'
!insertmacro RemoveTTF '$FONT_DIR\NotoNaskhArabicUI-Regular.ttf'
!insertmacro RemoveTTF '$FONT_DIR\NotoNastaliqUrduDraft.ttf'
!insertmacro RemoveTTF '$FONT_DIR\Thabit.ttf'
!insertmacro RemoveTTF '$FONT_DIR\Thabit-Bold.ttf'
!insertmacro RemoveTTF '$FONT_DIR\Thabit-BoldOblique.ttf'
!insertmacro RemoveTTF '$FONT_DIR\Thabit-Oblique.ttf'

SendMessage ${HWND_BROADCAST} ${WM_FONTCHANGE} 0 0 /TIMEOUT=5000
SectionEnd
And this one for the install :

the "New folder (2)\Resdources\Fonts\" is the path where the font file in my machine.

Section "Fonts"

StrCpy $FONT_DIR $FONTS

!insertmacro InstallTTF "New folder (2)\Resdources\Fonts\digital-7 (italic).ttf"
!insertmacro InstallTTF "New folder (2)\Resdources\Fonts\digital-7 (mono italic).ttf"
!insertmacro InstallTTF "New folder (2)\Resdources\Fonts\digital-7 (mono).ttf"
!insertmacro InstallTTF "New folder (2)\Resdources\Fonts\digital-7.ttf"
!insertmacro InstallTTF "New folder (2)\Resdources\Fonts\DIGITALDREAM.ttf"
!insertmacro InstallTTF "New folder (2)\Resdources\Fonts\DroidKufi-Bold.ttf"
!insertmacro InstallTTF "New folder (2)\Resdources\Fonts\DroidKufi-Regular.ttf"
!insertmacro InstallTTF "New folder (2)\Resdources\Fonts\DroidNaskh-Bold.ttf"
!insertmacro InstallTTF "New folder (2)\Resdources\Fonts\DroidNaskh-Regular.ttf"
!insertmacro InstallTTF "New folder (2)\Resdources\Fonts\NotoKufiArabic-Bold.ttf"
!insertmacro InstallTTF "New folder (2)\Resdources\Fonts\NotoKufiArabic-Regular.ttf"
!insertmacro InstallTTF "New folder (2)\Resdources\Fonts\NotoNaskhArabicUI-Bold.ttf"
!insertmacro InstallTTF "New folder (2)\Resdources\Fonts\NotoNaskhArabicUI-Regular.ttf"
!insertmacro InstallTTF "New folder (2)\Resdources\Fonts\NotoNastaliqUrduDraft.ttf"
!insertmacro InstallTTF "New folder (2)\Resdources\Fonts\Thabit.ttf"
!insertmacro InstallTTF "New folder (2)\Resdources\Fonts\Thabit-Bold.ttf"
!insertmacro InstallTTF "New folder (2)\Resdources\Fonts\Thabit-BoldOblique.ttf"
!insertmacro InstallTTF "New folder (2)\Resdources\Fonts\Thabit-Oblique.ttf"

SendMessage ${HWND_BROADCAST} ${WM_FONTCHANGE} 0 0 /TIMEOUT=5000
SectionEnd
And this is the error message :


Section: "un.Fonts"
StrCpy $FONT_DIR "$FONTS" () ()
!insertmacro: RemoveTTF
Push: $0
Push: $R0
Push: $R1
Push: $R2
Push: $R3
Push: $R4
!define: "Index"="Line775.8"
!insertmacro: GetFileNameCall
Push: $FONT_DIR\digital-7(italic).ttf
Call must be used with function names starting with "un." in the uninstall section.
Usage: Call function_name | [:label_name]
Error in macro GetFileNameCall on macroline 2
Error in macro RemoveTTF on macroline 11
Error in script "D:\Other\ZADTVSCM.nsi" on line 775 -- aborting creation process
Can anybody give me a hint?
Anders#
Did you see this part on the wiki:
Font removal function do not seem to work at the momment
I made some changes to the code on the wiki, you can try it again now...
mohessaid#
I read a lots of pages in the wiki and forum concerning this topic but I never encounter this one, can you give me a link to check please, at the moment I omitted the un.Fonts section to compile the installer but I need to add it in the future.
Anders#
Originally Posted by mohessaid View Post
I read a lots of pages in the wiki and forum concerning this topic but I never encounter this one, can you give me a link to check please, at the moment I omitted the un.Fonts section to compile the installer but I need to add it in the future.
I changed the page you linked to in your first post...