mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-20 15:08:51 +00:00
Fixed bug with multiline text in svg
Insertion position at <text> instead of <tspan> creates unnecessary x offsets between tspans
This commit is contained in:
@@ -723,14 +723,14 @@ class SvgWriter:
|
|||||||
**{
|
**{
|
||||||
"transform": transform,
|
"transform": transform,
|
||||||
"style": "font-size: 0;",
|
"style": "font-size: 0;",
|
||||||
"insert": text_position_svg,
|
|
||||||
},
|
},
|
||||||
**get_box_alignment_parameters(text_literal.BoxAlignment),
|
**get_box_alignment_parameters(text_literal.BoxAlignment),
|
||||||
)
|
)
|
||||||
self.svg.add(text_tag)
|
self.svg.add(text_tag)
|
||||||
|
|
||||||
for line_number, text_line in enumerate(text.replace("\\n", "\n").split("\n")):
|
for line_number, text_line in enumerate(text.replace("\\n", "\n").split("\n")):
|
||||||
t_span = self.svg.tspan(text_line, class_=classes_str)
|
# position has to be inserted at tspan to avoid x offset between tspans
|
||||||
|
t_span = self.svg.tspan(text_line, class_=classes_str, insert=text_position_svg)
|
||||||
# doing it here and not in tspan constructor because constructor adds unnecessary spaces
|
# doing it here and not in tspan constructor because constructor adds unnecessary spaces
|
||||||
t_span.update({"dy": f"{line_number}em"})
|
t_span.update({"dy": f"{line_number}em"})
|
||||||
text_tag.add(t_span)
|
text_tag.add(t_span)
|
||||||
|
|||||||
Reference in New Issue
Block a user