diff options
-rw-r--r-- | devtools/create_bladerunner/subtitles/README.md | 28 | ||||
-rw-r--r-- | devtools/create_bladerunner/subtitles/fontCreator/grabberFromPNG17BR.py | 19 |
2 files changed, 24 insertions, 23 deletions
diff --git a/devtools/create_bladerunner/subtitles/README.md b/devtools/create_bladerunner/subtitles/README.md index 12df03c170..10d504f0eb 100644 --- a/devtools/create_bladerunner/subtitles/README.md +++ b/devtools/create_bladerunner/subtitles/README.md @@ -3,7 +3,7 @@ # Blade Runner (1997) Subtitles Support Some tools written in Python 2.7 to help add support for subtitles in Westwood's point and click adventure game Blade Runner (1997) for PC. -## quotesSpreadsheetCreator (sortBladeRunnerWavs##) +## quotesSpreadsheetCreator (quoteSpreadsheetCreator.py) (requires python lib *xlwt*, *wave*) A tool to gather all the speech audio filenames in an Excel file which will include a column with links to the audio file location on the PC. By Ctrl+MouseClick on that column's entries you should be able to listen to the corresponding wav file. The output excel file *out.xls* should help with the transcription of all the spoken *in-game* quotes. It also provides extra quote information such as the corresponding actor ID and quote ID per quote. @@ -16,33 +16,33 @@ Note 2: Using the "-xwav" switch, this tool will export __ALL__ game's audio fil Usage: ``` -python2.7 sortBladeRunnerWavs02.py -ip <folderpath_for_TLK_Files> -op <folderpath_for_extracted_wav_Files> -m <stringPathToReplaceFolderpathInExcelLinks> [-xwav] [-xtre] +python2.7 quoteSpreadsheetCreator.py -op folderpath_for_extracted_wav_Files [-ip folderpath_for_TLK_Files] [-ian pathToActorNamesTxt] [-m stringPathToReplaceFolderpathInExcelLinks] [-xwav] [-xtre] [--trace] ``` -The tool __requires__ the actornames.txt file, which is included in the samples folder, to be in the same folder as the tool's source (.py) file. +The tool __requires__ the actornames.txt file, which is included in the samples folder. -## mixResourceCreator (packBladeRunnerMIXFromPCTLKXLS-##) +## mixResourceCreator (mixResourceCreator.py) (requires python lib *xlrd*) A tool to process the aforementioned Excel file with the dialogue transcriptions and output text resource files (TRE) that will be packed along with the external font (see fontCreator tool) into a SUBTITLES.MIX file. Currently, a modified version of the ScummVM's BladeRunner engine is required for this MIX file to work in-game. Multiple TRE files will be created intermediately in order to fully support subtitles in the game. One TRE file includes all in-game spoken quotes and the rest of them correspond to any VQA video sequence that contain voice acting. Usage: ``` -python2.7 packBladeRunnerMIXFromPCTLKXLS-04.py -x <excelWithTranscriptSheets.xls> +python2.7 mixResourceCreator.py -x excelWithTranscriptSheets.xls [-ian ./common/actornames.txt] [-cft pathToConfigureFontsTranslationTxt] [--trace] ``` -The tool __requires__ the actornames.txt file, which is included in the samples folder, to be in the same folder as the tool's source (.py) file. +The tool __requires__ the actornames.txt file, which is included in the samples folder. -## fontCreator (grabberFromPNG##BR) -(requires python image library *PIL*) +## fontCreator (fontCreator.py) +(requires python Image library *PIL*) A tool to support __both__ the extraction of fonts from the game __and__ the creation of a font file (FON) for use with (currently) a modified version of ScummVM's BladeRunner engine (WIP) in order to resolve various issues with the available fonts (included in the game's own resource files). These issues include alignment, kerning, corrupted format, limited charset and unsupported characters -- especially for languages with too many non-Latin symbols in their alphabet. This font tool's code is based off the Monkey Island Special Edition's Translator (https://github.com/ShadowNate/MISETranslator). Usage: ``` -Syntax A - To export game fonts: -python2.7 grabberFromPNG17BR.py -ip <folderpathForMIXFiles> +Syntax A - To export game fonts to PNG images: +python2.7 fontCreator.py -ip folderpathForMIXFiles Syntax B - To create subtitle font: -python2.7 grabberFromPNG17BR.py -im <imageRowPNGFilename> -om <targetFONfilename> -pxLL <minSpaceBetweenLettersInRowLeftToLeft> -pxTT <minSpaceBetweenLettersInColumnTopToTop> -pxKn <kerningForFirstDummyFontLetter> -pxWS <whiteSpaceWidthInPixels> +python2.7 fontCreator.py -im imageRowPNGFilename -om targetFONfilename -oe pathToOverrideEncodingTxt -pxLL minSpaceBetweenLettersInRowLeftToLeft -pxTT minSpaceBetweenLettersInColumnTopToTop -pxKn kerningForFirstDummyFontLetter -pxWS whiteSpaceWidthInPixels [--trace] ``` -This tool also __requires__ an overrideEncoding.txt file to be in the same folder as the tool's source (.py) file. +This tool also __requires__ an overrideEncoding.txt file in its Syntax B mode (subtitle font creation). The overrideEncoding.txt is a __text file that should be saved in a UTF-8 encoding (no BOM)__, that contains the following: 1. A key "targetEncoding" with a value of the name of the ASCII codepage that should be used for the character fonts (eg windows-1253). 2. A key "asciiCharList" with value the "all-characters" string with all the printable characters that will be used in-game, from the specified codepage. Keep in mind that: @@ -66,8 +66,8 @@ The overrideEncoding.txt is a __text file that should be saved in a UTF-8 encodi There is a sample of such file in the source folder for the fontCreator tool. -__For the exporting the game fonts mode__, the valid syntax expects only one (1) argument: -1. folderpathForMIXFiles: is the path where the game's MIX files are located (STARTUP.MIX is required). The exported font files will be: 10PT.FON, TAHOMA18.FON, TAHOMA24.FON and KIA6PT.FON. +__For the exporting the game fonts (to PNG) mode__, the valid syntax expects only one (1) argument: +1. folderpathForMIXFiles: is the path where the game's MIX files are located (STARTUP.MIX is required). The exported font files will be: 10PT.FON.PNG, TAHOMA18.FON.PNG, TAHOMA24.FON.PNG and KIA6PT.FON.PNG. __For the creation of subtitles' font mode__, there are six (6) mandatory launch arguments for the fontCreator tool: 1. imageRowPNGFilename: is the filename of the input PNG image file which should contain a row of (preferably) tab separated glyphs. Example: "Tahoma_18ShdwTranspThreshZero003-G5.png". Keep in mind that: diff --git a/devtools/create_bladerunner/subtitles/fontCreator/grabberFromPNG17BR.py b/devtools/create_bladerunner/subtitles/fontCreator/grabberFromPNG17BR.py index 4687c01c7e..c7ad8dc963 100644 --- a/devtools/create_bladerunner/subtitles/fontCreator/grabberFromPNG17BR.py +++ b/devtools/create_bladerunner/subtitles/fontCreator/grabberFromPNG17BR.py @@ -113,6 +113,7 @@ from fonFileLib import * company_email = "classic.adventures.in.greek@gmail.com" app_version = "0.70" app_name = "grabberFromPNGHHBR" +app_wrapper_name = "fontCreator.py" app_name_spaced = "Blade Runner Font Creator/Extractor" app_short_desc = "Extract or create Font Files (.FON) for Blade Runner" @@ -214,7 +215,7 @@ class grabberFromPNG: overrideEncodingTextFile = u'overrideEncoding.txt' relPath = u'.' self.overrideEncodingPath = os.path.join(relPath,overrideEncodingTextFile) - print "Warning:: Font Creation Override Encoding file not found in arguments. Attempting to open local file %s if it exists" % (configureFontsTranslationTextFile) + print "Warning:: Font Creation Override Encoding file not found in arguments. Attempting to open local file %s if it exists" % (overrideEncodingTextFile) if os.access(self.overrideEncodingPath, os.F_OK): ## debug @@ -1092,10 +1093,10 @@ def main(argsCL): print "Preparatory steps:" print "1. Put overrideEncoding.txt file in the same folder with this tool. (Recommended, but not obligatory step)" print "--------------------" - print "Valid syntax A - export game fonts:" - print "%s -ip folderpath_for_MIX_Files [--trace]\n" % (app_name) + print "Valid syntax A - export game fonts to PNG images:" + print "%s -ip folderpath_for_MIX_Files [--trace]\n" % (app_wrapper_name) print "Valid syntax B - create subtitle font:" - print "%s -im image_Row_PNG_Filename -om output_FON_filename -pxLL minSpaceBetweenLettersInRowLeftToLeft -pxTT minSpaceBetweenLettersInColumnTopToTop -pxKn kerningForFirstDummyFontLetter -pxWS whiteSpaceWidthInPixels [--noSpecialGlyphs] [--noAutoTabCalculation] [--trace]\n" % (app_name) # deductKerningPixels" + print "%s -im image_Row_PNG_Filename -om output_FON_filename -pxLL minSpaceBetweenLettersInRowLeftToLeft -pxTT minSpaceBetweenLettersInColumnTopToTop -pxKn kerningForFirstDummyFontLetter -pxWS whiteSpaceWidthInPixels [--noSpecialGlyphs] [--noAutoTabCalculation] [--trace]\n" % (app_wrapper_name) # deductKerningPixels" print "The -ip switch has an argument that is the path for the input (MIX) files folder (can be the same as the Blade Runner installation folder)." print "The -oe switch has an argument that is the input overrideEncoding file to use for the particular font creation." print "The -im switch has an argument that is the input PNG image with a row of the font glyphs spaced apart." @@ -1154,7 +1155,7 @@ def main(argsCL): if (extractFonMode == False) and (not TMPTargetFONfilename or not TMPimageRowFilePNG or TMPminSpaceBetweenLettersInRowLeftToLeft <= 0 or TMPminSpaceBetweenLettersInColumnTopToTop <= 0 or TMPkerningForFirstDummyFontLetter <= 0 or TMPSpaceWidthInPixels <= 0) : # this argument is mandatory invalidSyntax = True - if (extractFonMode == True) and ( (not TMPinputPathForMixFiles) or not TMPOverrideEncodingFilePath ): + if (extractFonMode == True) and ( (not TMPinputPathForMixFiles) ): # not needed for extraction mode -- or not TMPOverrideEncodingFilePath ): invalidSyntax = True else: invalidSyntax = True @@ -1174,21 +1175,21 @@ def main(argsCL): myGrabInstance.setSpecialGlyphMode(TMPSpecialGlyphMode) myGrabInstance.setAutoTabCalculation(TMPAutoTabCalculation) myGrabInstance.setOverrideEncodingPath(TMPOverrideEncodingFilePath) - myGrabInstance.initOverrideEncoding() # myGrabInstance.setDeductKerningPixels(TMPdeductKerningPixels) if extractFonMode: myGrabInstance.extractFonFilesFromMix() else: + myGrabInstance.initOverrideEncoding() myGrabInstance.generateModFiles(TMPcustomBaseLineOffset) else: invalidSyntax = True if invalidSyntax == True: - print "Invalid syntax\n Try: \n %s --help for more info \n %s --version for version info " % (app_name, app_name) + print "Invalid syntax\n Try: \n %s --help for more info \n %s --version for version info " % (app_wrapper_name, app_wrapper_name) print "Valid syntax A - export game fonts:" - print "%s -ip folderpath_for_MIX_Files [--trace]\n" % (app_name) + print "%s -ip folderpath_for_MIX_Files [--trace]\n" % (app_wrapper_name) print "Valid syntax B - create subtitle font:" - print "%s -im image_Row_PNG_Filename -om output_FON_filename -pxLL minSpaceBetweenLettersInRowLeftToLeft -pxTT minSpaceBetweenLettersInColumnTopToTop -pxKn kerningForFirstDummyFontLetter -pxWS whiteSpaceWidthInPixels [--noSpecialGlyphs] [--noAutoTabCalculation] [--trace]\n" % (app_name) # deductKerningPixels" + print "%s -im image_Row_PNG_Filename -om output_FON_filename -pxLL minSpaceBetweenLettersInRowLeftToLeft -pxTT minSpaceBetweenLettersInColumnTopToTop -pxKn kerningForFirstDummyFontLetter -pxWS whiteSpaceWidthInPixels [--noSpecialGlyphs] [--noAutoTabCalculation] [--trace]\n" % (app_wrapper_name) # deductKerningPixels" tmpi = 0 for tmpArg in argsCL: if tmpi==0: #skip first argument |