Function for computing size of symbols

This commit is contained in:
Julien Duponchelle committed 2016-08-17 10:49:31 +02:00
1 parent 796ebf7210
commit 4d8cf8460e
7 files changed
+95 -16

No files matched your search

+2 -2
View File
@@ -72,8 +72,8 @@ class Drawing:
try:
return data.decode()
except UnicodeError:
width, height = get_size(data)
return "<svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" height=\"{height}\" width=\"{width}\">\n<image height=\"{height}\" width=\"{width}\" xlink:href=\"data:image/{extension};base64,{b64}\" />\n</svg>".format(b64=base64.b64encode(data).decode(), extension=filename.split(".")[1], width=width, height=width)
width, height, filetype = get_size(data)
return "<svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" height=\"{height}\" width=\"{width}\">\n<image height=\"{height}\" width=\"{width}\" xlink:href=\"data:image/{filetype};base64,{b64}\" />\n</svg>".format(b64=base64.b64encode(data).decode(), filetype=filetype, width=width, height=width)
except OSError:
log.warning("Image file %s missing", filename)
return "<svg></svg>"