diff --git a/mitreattack/navlayers/exporters/svg_objects.py b/mitreattack/navlayers/exporters/svg_objects.py index a3f5375a..86203c1d 100644 --- a/mitreattack/navlayers/exporters/svg_objects.py +++ b/mitreattack/navlayers/exporters/svg_objects.py @@ -115,7 +115,7 @@ def recurse(breakset_inherit, depth, break_count): return breaks -def _optimalFontSize(st, width, height, config, maxFontSize=12): +def _optimalFontSize(st, width, height, maxFontSize=12): """Calculate the optimal fontsize and word layout for a box of width x height. :param st: string to fit @@ -293,7 +293,7 @@ def build( theight = height - 8 if bu: theight = theight / 2 - fs, patch_text = _optimalFontSize(t1text, width, theight, config, maxFontSize=28) + fs, patch_text = _optimalFontSize(t1text, width, theight, maxFontSize=28) lines = len(patch_text) y = theight / 2 + 2.1 if lines > 1: @@ -307,7 +307,7 @@ def build( upper_fs = fs lower_offset = theight + 2.1 lower = G(tx=0, ty=lower_offset) - fs, patch_text = _optimalFontSize(t2text, width, (height - (height / 3 + upper_fs)), config, maxFontSize=28) + fs, patch_text = _optimalFontSize(t2text, width, (height - (height / 3 + upper_fs)), maxFontSize=28) y = theight / 2 + 5.1 lines = len(patch_text) adju = "\n".join(patch_text) @@ -343,7 +343,7 @@ def build( off = (block_width - (5 * (1 + len(tblob)))) / 2 if off < 0: off = 0 - fs, _ = _optimalFontSize("0", width / len(gradient_colors), height, config) + fs, _ = _optimalFontSize("0", width / len(gradient_colors), height) label = Text(tblob, fs, ctype="label", ty=25, tx=off) cell.append(label) if len(legend_colors): @@ -370,7 +370,7 @@ def build( off = (block_width - (5 * (1 + len(legendLabel)))) / 2 if off < 0: off = 0 - fs, _ = _optimalFontSize("0", width / len(legend_colors), height, config) + fs, _ = _optimalFontSize("0", width / len(legend_colors), height) textLabel = Text(legendLabel, fs, ctype="label", ty=25, tx=off) cell.append(textLabel) return g @@ -477,7 +477,7 @@ def _block(technique, height, width, config, tBC): """ tech = Cell(height, width, technique["color"], ctype=technique["id"], tBC=tBC) - fs, patch_text = _optimalFontSize(technique["name"], width, height, config, config.fontSize) + fs, patch_text = _optimalFontSize(technique["name"], width, height, config.fontSize) adjusted = "\n".join(patch_text) lines = adjusted.count("\n") diff --git a/mitreattack/navlayers/exporters/svg_templates.py b/mitreattack/navlayers/exporters/svg_templates.py index 46f94bcb..7ad12c72 100644 --- a/mitreattack/navlayers/exporters/svg_templates.py +++ b/mitreattack/navlayers/exporters/svg_templates.py @@ -436,7 +436,7 @@ def export(self, showName, showID, layer, config, sort=0, scores=[], colors=[], # create header text header_glob = G(tx=index, ty=header_offset) text_glob = G(tx=technique_width / 2, ty=technique_height / 2) - font_size, _ = _optimalFontSize(displayStr, technique_width, technique_height, config, config.fontSize) + font_size, _ = _optimalFontSize(displayStr, technique_width, technique_height, config.fontSize) text = Text(ctype="TacticName", font_size=font_size, text=displayStr, position="middle") text_glob.append(text) header_glob.append(text_glob)