55
66try :
77 from exporters .matrix_gen import MatrixGen
8- from exporters .svg_objects import G , SVG_HeaderBlock , SVG_Technique , Text , convertToPx ,_optimalFontSize
8+ from exporters .svg_objects import G , SVG_HeaderBlock , SVG_Technique , Text , convertToPx ,_optimalFontSize , \
9+ _getstringwidth
910 from core .gradient import Gradient
1011 from core .filter import Filter
1112except ModuleNotFoundError :
1213 from ..exporters .matrix_gen import MatrixGen
13- from ..exporters .svg_objects import G , SVG_HeaderBlock , SVG_Technique , Text , convertToPx , _optimalFontSize
14+ from ..exporters .svg_objects import G , SVG_HeaderBlock , SVG_Technique , Text , convertToPx , _optimalFontSize , \
15+ _getstringwidth
1416 from ..core .gradient import Gradient
1517 from ..core .filter import Filter
1618
@@ -232,7 +234,6 @@ def export(self, showName, showID, lhandle, config, sort=0, scores=[], colors=[]
232234 tech_height = (convertToPx (config .height , config .unit ) - header_offset -
233235 convertToPx (config .border , config .unit )) / max (lengths )
234236 incre = tech_width + 10
235- set = 0
236237 for x in self .codex :
237238 disp = ''
238239 if showName and showID :
@@ -243,12 +244,11 @@ def export(self, showName, showID, lhandle, config, sort=0, scores=[], colors=[]
243244 disp = x .tactic .id
244245
245246 g = G (tx = index , ty = header_offset )
246- gt = G ( tx = ( tech_width / 2 ) + 2 )
247+
247248 index += incre
248249 fs , _ = _optimalFontSize (disp , tech_width , tech_height + 10 , maxFontSize = 28 )
249- if set == 0 :
250- set = fs
251- tx = Text (ctype = 'TacticName' , font_size = set , text = disp , position = 'middle' )
250+ tx = Text (ctype = 'TacticName' , font_size = fs , text = disp , position = 'middle' )
251+ gt = G (tx = (tech_width )/ 2 )
252252 gt .append (tx )
253253 a = self .get_tactic (x , tech_height , tech_width , colors = colors , subtechs = subtechs , exclude = exclude ,
254254 mode = (showName , showID ), scores = scores , config = config )
0 commit comments