1
0
mirror of synced 2025-01-31 04:03:45 +01:00

Convert some more exceptions to warnings to allow attempts to render some BishiBashi content.

This commit is contained in:
Jennifer Taylor 2021-04-16 21:28:53 +00:00
parent de5dfd2421
commit 700e63a001
2 changed files with 8 additions and 5 deletions

View File

@ -1,7 +1,7 @@
from typing import Any, Dict, List, Tuple, Optional
from PIL import Image # type: ignore
from .swf import SWF, Frame, Tag, AP2ShapeTag, AP2DefineSpriteTag, AP2PlaceObjectTag, AP2RemoveObjectTag, AP2DoActionTag
from .swf import SWF, Frame, Tag, AP2ShapeTag, AP2DefineSpriteTag, AP2PlaceObjectTag, AP2RemoveObjectTag, AP2DoActionTag, AP2DefineFontTag, AP2DefineEditTextTag
from .types import Color, Matrix, Point
from .geo import Shape
from .util import VerboseOutput
@ -157,6 +157,12 @@ class AFPRenderer(VerboseOutput):
elif isinstance(tag, AP2DoActionTag):
print("WARNING: Unhandled DO_ACTION tag!")
return []
elif isinstance(tag, AP2DefineFontTag):
print("WARNING: Unhandled DEFINE_FONT tag!")
return []
elif isinstance(tag, AP2DefineEditTextTag):
print("WARNING: Unhandled DEFINE_EDIT_TEXT tag!")
return []
else:
raise Exception(f"Failed to process tag: {tag}")

View File

@ -736,13 +736,10 @@ class SWF(TrackedCoverage, VerboseOutput):
unk, font_id, fontname_offset, xml_prefix_offset, data_offset, data_count = struct.unpack("<HHHHHH", ap2data[dataoffset:(dataoffset + 12)])
self.add_coverage(dataoffset, 12)
if unk != 0:
raise Exception(f"Unexpected value {unk} in Font tag!")
fontname = self.__get_string(fontname_offset)
xml_prefix = self.__get_string(xml_prefix_offset)
self.vprint(f"{prefix} Tag ID: {font_id}, Font Name: {fontname}, XML Prefix: {xml_prefix}, Entries: {data_count}")
self.vprint(f"{prefix} Tag ID: {font_id}, Unknown: {unk}, Font Name: {fontname}, XML Prefix: {xml_prefix}, Entries: {data_count}")
heights: List[int] = []
for i in range(data_count):