{I+=codeWee;}
[NSIS] How to install Font using NSIS

Section "Basic" SecDummy

	; install font
	IfFileExists "$FONTS\NotoSansCJKkr-Regular.otf" FontOK
	SetOutPath "$FONTS" 
	File "NotoSansCJKkr-hinted\NotoSansCJKkr-Regular.otf" 

	System::Call "gdi32::AddFontResource(t 'NotoSansCJKkr-Regular.otf')"  

	Push 'NotoSansCJKkr-Regular.otf' 
	Call GetFontName 
	Pop $R0 

	${If} $R0 != 'error' 
	WriteRegStr HKLM "Software\Microsoft\Windows NT\CurrentVersion\Fonts" '$R0 (TrueType)' 'NotoSansCJKkr-Regular.otf' 
	${Else} 
	System::Call "gdi32::RemoveFontResource(t 'NotoSansCJKkr-Regular.otf')" 
	${EndIf} 
	FontOK:

SectionEnd

Function GetFontName 
    Exch $R0 
    Push $R1 
    Push $R2 

    System::Call *(i${NSIS_MAX_STRLEN})i.R1 
    System::Alloc ${NSIS_MAX_STRLEN} 
    Pop $R2 
    System::Call gdi32::GetFontResourceInfoW(wR0,iR1,iR2,i1)i.R0 
    ${If} $R0 == 0 
    StrCpy $R0 error 
    ${Else} 
    System::Call *$R2(&w${NSIS_MAX_STRLEN}.R0) 
    ${EndIf} 
    System::Free $R1 
    System::Free $R2 

    Pop $R2 
    Pop $R1 
    Exch $R0 
FunctionEnd 
HTML | PHP | C++ | DirectX11 | Javascript | C# | HTML5 | ASP | SQL | General | CSS | Oculus Rift | Unity3d | Virtools SDK | Tip | NSIS | PowerShell | node.js | Web API | RTSP | All
Copyright© 2016 CodeWee.com All rights reserved.