DEVTOOLS: BLADERUNNER: Abort on unsupported optimization of PNG input

Also revert the sample pngs to the non-optimized versions.
This commit is contained in:
antoniou79 2020-12-31 16:14:47 +02:00
parent 06eaa5e700
commit d925d62f4f
8 changed files with 16 additions and 9 deletions

View File

@ -102,7 +102,7 @@ else:
structLibFound = True
try:
from PIL import Image
from PIL import Image
except ImportError:
print "[Error] Image python library (PIL) is required to be installed!"
else:
@ -129,7 +129,7 @@ from struct import *
from fonFileLib import *
COMPANY_EMAIL = "classic.adventures.in.greek@gmail.com"
APP_VERSION = "1.00"
APP_VERSION = "1.10"
APP_NAME = "grabberFromPNGHHBR"
APP_WRAPPER_NAME = "fontCreator.py"
APP_NAME_SPACED = "Blade Runner Font Creator/Exporter"
@ -484,6 +484,11 @@ class grabberFromPNG:
if startCol != 0:
break
for y in range(0, imheight): # we search all rows (for each column)
if type(loadedImag[x, y]) is not tuple or len(loadedImag[x, y]) < 4:
#print type(loadedImag[x, y]), len(loadedImag[x, y])
print "[Error] Bad format for pixel type -- probable cause: unsupported PNG optimization"
return -2
r1,g1,b1,a1 = loadedImag[x, y]
if a1 != 0: # if pixel not completely transparent -- this is not necessarily the *top* left pixel of a font letter though! -- the startRow is still to be determined.
#if gTraceModeEnabled:
@ -646,8 +651,8 @@ class grabberFromPNG:
errorFound = True
if not errorFound:
#debug
#if gTraceModeEnabled:
# print "[Debug] ", self.imageRowFilePNG, im.format, "%dx%d" % im.size, im.mode
if gTraceModeEnabled:
print "[Debug] ", self.imageRowFilePNG, im.format, "%dx%d" % im.size, im.mode
w1, h1 = im.size
trimTopPixels = 0
trimBottomPixels = 0

Binary file not shown.

Before

Width:  |  Height:  |  Size: 870 B

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 26 KiB

View File

@ -125,12 +125,14 @@ void Subtitles::init(void) {
// Loading subtitles versioning info if available
TextResource versionTxtResource(_vm);
if ( versionTxtResource.open(SUBTITLES_VERSION_TRENAME, false)) {
_subtitlesInfo.credits = versionTxtResource.getText((uint32)0);
_subtitlesInfo.versionStr = versionTxtResource.getText((uint32)1);
_subtitlesInfo.credits = versionTxtResource.getText((uint32)0);
_subtitlesInfo.versionStr = versionTxtResource.getText((uint32)1);
_subtitlesInfo.dateOfCompile = versionTxtResource.getText((uint32)2);
_subtitlesInfo.languageMode = versionTxtResource.getText((uint32)3);
Common::String fontType = versionTxtResource.getText((uint32)4);
_subtitlesInfo.fontName = versionTxtResource.getText((uint32)5);
_subtitlesInfo.languageMode = versionTxtResource.getText((uint32)3);
Common::String fontType = versionTxtResource.getText((uint32)4);
_subtitlesInfo.fontName = versionTxtResource.getText((uint32)5);
Common::String license = versionTxtResource.getText((uint32)6);
Common::String licenseLink = versionTxtResource.getText((uint32)7);
if (fontType.equalsIgnoreCase("ttf")) {
_subtitlesInfo.fontType = Subtitles::kSubtitlesFontTypeTTF;