mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-26 02:07:36 +00:00
Fixed blurred text with background after bfbced3
before commit - https://user-images.githubusercontent.com/9417531/233907917-f86ad10b-0227-4180-9488-a8b71a00f099.png after commit https://user-images.githubusercontent.com/9417531/233907920-d100c73a-e206-42fd-bb41-f7257ea6f98c.png Tested it on firefox too
This commit is contained in:
@@ -710,23 +710,28 @@ class SvgWriter:
|
|||||||
"transform": transform,
|
"transform": transform,
|
||||||
"style": "font-size: 0;",
|
"style": "font-size: 0;",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def add_text_tag(add_fill_bg):
|
||||||
|
text_tag = self.svg.text(
|
||||||
|
"",
|
||||||
|
**(attribs | {"filter": "url(#fill-background)"}) if add_fill_bg else attribs,
|
||||||
|
**self.get_box_alignment_parameters(text_literal.BoxAlignment),
|
||||||
|
)
|
||||||
|
self.svg.add(text_tag)
|
||||||
|
|
||||||
|
text_lines = text.replace("\\n", "\n").split("\n")
|
||||||
|
|
||||||
|
for line_number, text_line in enumerate(text_lines):
|
||||||
|
# position has to be inserted at tspan to avoid x offset between tspans
|
||||||
|
tspan = 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
|
||||||
|
tspan.update({"dy": f"{line_number}em"})
|
||||||
|
text_tag.add(tspan)
|
||||||
|
|
||||||
if "fill-bg" in classes:
|
if "fill-bg" in classes:
|
||||||
attribs["filter"] = "url(#fill-background)"
|
add_text_tag(True)
|
||||||
text_tag = self.svg.text(
|
add_text_tag(False)
|
||||||
"",
|
|
||||||
**attribs,
|
|
||||||
**self.get_box_alignment_parameters(text_literal.BoxAlignment),
|
|
||||||
)
|
|
||||||
self.svg.add(text_tag)
|
|
||||||
|
|
||||||
text_lines = text.replace("\\n", "\n").split("\n")
|
|
||||||
|
|
||||||
for line_number, text_line in enumerate(text_lines):
|
|
||||||
# position has to be inserted at tspan to avoid x offset between tspans
|
|
||||||
tspan = 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
|
|
||||||
tspan.update({"dy": f"{line_number}em"})
|
|
||||||
text_tag.add(tspan)
|
|
||||||
|
|
||||||
def draw_break_annotations(self, obj):
|
def draw_break_annotations(self, obj):
|
||||||
x_offset = self.raw_width / 2
|
x_offset = self.raw_width / 2
|
||||||
|
|||||||
Reference in New Issue
Block a user