This commit is contained in:
Isaiah Odhner 2023-05-17 17:38:31 -04:00
parent 3892dc503e
commit b9f5f00480

View File

@ -1195,7 +1195,7 @@ class AnsiArtDocument:
raise ValueError("No rect elements found in SVG.") raise ValueError("No rect elements found in SVG.")
# Find the cell size, removing outliers until all cells are within # Find the cell size, removing outliers until all cells are within
# a certain relative difference from the average size. # a certain relative difference from the average size.
max_relative_difference = 0.1 max_relative_difference = 0.3
for attribute in ["width", "height"]: for attribute in ["width", "height"]:
settled = False settled = False
while not settled: while not settled:
@ -1260,7 +1260,6 @@ class AnsiArtDocument:
y = int((float(text.attrib["y"]) - min_y) / cell_height) y = int((float(text.attrib["y"]) - min_y) / cell_height)
ch = text.text ch = text.text
if ch is None: if ch is None:
# look for tspan element(s)
tspans = text.findall(".//{http://www.w3.org/2000/svg}tspan") tspans = text.findall(".//{http://www.w3.org/2000/svg}tspan")
if len(tspans) == 0: if len(tspans) == 0:
print("Warning: text element has no text or tspan: " + ET.tostring(text, encoding="unicode")) print("Warning: text element has no text or tspan: " + ET.tostring(text, encoding="unicode"))