Wednesday, February 28, 2007

Rockbox Font Convertor Hybrid Mode - My first attempt.

This is probalby not goign to work AT ALL, but i'll post it here in case someone can check it out and figure out hwo to get it working... not sure if it even does anything anymore.

@echo off
rem # Creates some whitespace between the command and the progress box.
echo.
echo.
rem # Progress Box Header
echo ROCKbox Font Convertor v1.1 (Hybrid Mode Test)
echo \----------------------------------------------------------------------------/
rem # Check if the user requests help or provides no input...
IF [%1] EQU [?] (goto Help) else (IF [%1] EQU [help] (goto Help) else (IF [%1] EQU [] (goto Help))
rem # check for font size argument present: (Wrong - disables multifile support if there's a size - needs fixing)
if %1 LEQ a (goto SetFont) else (goto ManualMode)
:ManualMode
rem # ManualMode is what should be called multifont mode... i need to work on this.
set MANUALMODE=1
set /p FONTSIZE=Enter required font size or 'help' for help:
if [%FONTSIZE%] EQU [help] goto Help
if [%FONTSIZE%] EQU [] set FONTSIZE=8
set AppPath=%~dp1
cd /d %AppPath%
goto :CarryOn
:SetFont
set MANUALMODE=0
set FONTSIZE=%1
set FONTFILE=%2
shift
:FilenameLoop
if [%2] == [] goto CarryOn
set FONTFILE=%FONTFILE% %2
shift
goto FilenameLoop
:CarryOn
if [MANUALMODE] EQU [1] (set FONTFILE=%~nx1)
echo Font Size: %FONTSIZE%pt Input File: "%FONTFILE%"
echo Output File: "%FONTSIZE%-%FONTFILE%.fnt"
echo ----------------------------------------------------------------------------
echo Converting TTF/OTF to BDF...
rem # Syntax: otf2bdf [-p Font Size (pt)] [destination] [source]
otf2bdf -p %FONTSIZE% -o "%FONTSIZE%-%FONTFILE%.bdf" "%FONTFILE%"
echo Done.
echo ----------------------------------------------------------------------------
echo Converting BDF to ROCKbox FNT...
rem # Syntax: convbdf -f [source]
convbdf -f "%FONTSIZE%-%FONTFILE%.bdf"
echo Done.
echo ----------------------------------------------------------------------------
echo Deleting temporary file(s) ("%FONTSIZE%-%FONTFILE%.bdf")...
del "%FONTSIZE%-%FONTFILE%.bdf"
echo Done.
if [MANUALMODE] EQU [1] (if [%2] == [] (goto end) else (shift & goto MultiInputLoopStart)) else (goto end)
:Help
echo Help/About Mode
echo Version 1.1 (Hybrid Mode Test - HELP DETAIL IS OLD)
echo - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
echo.
echo syntax: makefont [fontsize] [filename]
echo.
echo Fontsize: Set the size of the converted font. 8 is recommended for most, and
echo is the default if you do not specify a value.
echo Filename: Set the file to be converted. Can have as many words as you want.
echo *Doesn't like filenames with a number as the first word*
echo **This has been tested with a filename of 10 words, and worked.**
echo.
echo --DRAG 'N DROP FUNCTIONALITY WAS NOT TESTED--
echo.
echo - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
echo You can copy, modify and redistribute this file as you wish.
echo All I ask is that if you make an update (i.e, add one of the features listed
echo on the forum as a priority), that you upload the updated file and add your
echo name to the contributor section so I can update the posts about it with
echo credit to you. That's all!
echo - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
echo Contributors:
echo Geoff Stokes (Original Coding, Maintainer)
echo bascule (New [v1.1] font size setting and multi-word filename support)
echo JustJohnny (Also helped with font size setting and multi-word filenames)
echo.
:end
rem # Finishing up code.
echo Press any key to exit.
echo --------------------------------------ROCKbox - Open Source Jukebox Firmware-
rem # wait for any key... To allow the user to check the process worked.
pause>nul

That's it. Have fun playing if you find this.


I'll be posting a link to the proper version and deleting this later, but i'm in the middle of updating, so bear with me for a while.

0 comments: