@ECHO OFF
TITLE Adding Al Kamal Fonts..

IF NOT "%*"=="" SET SRC=%*
ECHO.
ECHO Adding Fonts..
ECHO.
FOR /F %%i in ('dir /b "%~dp0%SRC%*.*tf"') DO CALL :FONT %%i
FOR /F %%i in ('dir /b "%~dp0%SRC%*.*tc"') DO CALL :FONT %%i

REM OPTIONAL REBOOT
REM shutdown -r -f -t 10 -c "Reboot required for Fonts installation"
ECHO.
ECHO Done!
PAUSE
EXIT

:FONT
ECHO.
REM ECHO FILE=%~f1
SET FFILE=%~n1%~x1
SET FNAME=%~n1
SET FNAME=%FNAME:-= %
IF "%~x1"==".otf" SET FTYPE=(OpenType)
IF "%~x1"==".ttf" SET FTYPE=(TrueType)
IF "%~x1"==".ttc" SET FTYPE=(TrueType)

if "%FNAME%"=="01Hd" set FLONGNAME="001 Al Kamal Hadith Regular %FTYPE%"
if "%FNAME%"=="02Hd" set FLONGNAME="001 Al Kamal Hadith Bold %FTYPE%"
if "%FNAME%"=="03Hd" set FLONGNAME="001 Al Kamal Hadith Italic %FTYPE%"
if "%FNAME%"=="04Hd" set FLONGNAME="001 Al Kamal Hadith Bold Italic %FTYPE%"
if "%FNAME%"=="05BQ" set FLONGNAME="BokarieQraan %FTYPE%"
if "%FNAME%"=="06qr" set FLONGNAME="Qraan part30 & Qraan part29 & Qraan part28 & Qraan part27 & Qraan part26 & Qraan part25 %FTYPE%"
if "%FNAME%"=="07qr" set FLONGNAME="Qraan part01 & Qraan part06 & Qraan part05 & Qraan part04 & Qraan part03 & Qraan part02 %FTYPE%"
if "%FNAME%"=="08qr" set FLONGNAME="Qraan part12 & Qraan part11 & Qraan part10 & Qraan part09 & Qraan part08 & Qraan part07 %FTYPE%"
if "%FNAME%"=="09qr" set FLONGNAME="Qraan part18 & Qraan part17 & Qraan part16 & Qraan part15 & Qraan part14 & Qraan part13 %FTYPE%"
if "%FNAME%"=="10qr" set FLONGNAME="Qraan part24 & Qraan part23 & Qraan part22 & Qraan part21 & Qraan part20 & Qraan part19 %FTYPE%"
if "%FNAME%"=="ARABSQ" set FLONGNAME="AGA Arabesque %FTYPE%"


ECHO FILE=%FFILE%
ECHO TYPE=%FTYPE%
ECHO Delete old font..
del "%SystemRoot%\Fonts\%FFILE%"
REG DELETE "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts" /v %FLONGNAME% /f

ECHO Adding font..
COPY /Y "%~dp0%SRC%%~n1%~x1" "%SystemRoot%\Fonts\"
reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts" /v %FLONGNAME% /t REG_SZ /d "%FFILE%" /f
GOTO :EOF