Convert some more exceptions to warnings to allow attempts to render some BishiBashi content.
This commit is contained in:
parent
de5dfd2421
commit
700e63a001
@ -1,7 +1,7 @@
|
|||||||
from typing import Any, Dict, List, Tuple, Optional
|
from typing import Any, Dict, List, Tuple, Optional
|
||||||
from PIL import Image # type: ignore
|
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 .types import Color, Matrix, Point
|
||||||
from .geo import Shape
|
from .geo import Shape
|
||||||
from .util import VerboseOutput
|
from .util import VerboseOutput
|
||||||
@ -157,6 +157,12 @@ class AFPRenderer(VerboseOutput):
|
|||||||
elif isinstance(tag, AP2DoActionTag):
|
elif isinstance(tag, AP2DoActionTag):
|
||||||
print("WARNING: Unhandled DO_ACTION tag!")
|
print("WARNING: Unhandled DO_ACTION tag!")
|
||||||
return []
|
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:
|
else:
|
||||||
raise Exception(f"Failed to process tag: {tag}")
|
raise Exception(f"Failed to process tag: {tag}")
|
||||||
|
|
||||||
|
@ -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)])
|
unk, font_id, fontname_offset, xml_prefix_offset, data_offset, data_count = struct.unpack("<HHHHHH", ap2data[dataoffset:(dataoffset + 12)])
|
||||||
self.add_coverage(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)
|
fontname = self.__get_string(fontname_offset)
|
||||||
xml_prefix = self.__get_string(xml_prefix_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] = []
|
heights: List[int] = []
|
||||||
for i in range(data_count):
|
for i in range(data_count):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user