PROBLEM
The text of the Legend Frame does not retain the new text scale if it is increased.
The new text graphics exceed the limits of the bounding rectangle for the Legend Frame.
Code:
'-- Script
theLayout = av.GetActiveDoc
theGraphics = theLayout.GetGraphics
for each g in theGraphics
if (g.Is(LegendFrame)) then
oldrect = g.getbounds
oldrectorigin = oldrect.returnorigin
oldrectsize = oldrect.returnsize
theSymbols = g.ReturnSymbols
for each s in theSymbols
if (s.Is(TextSymbol)) then
oldtextsize = s.getsize
newpointsize = msgbox.input(
"Enter desired point text size","",oldtextsize.asstring)
s.SetSize(newpointsize.asnumber)
'-- Make a different font
font_family_list = FontManager.THE.ReturnFamilies
font_family = MsgBox.Listasstring(font_family_list,"","")
font_styles_list = FontManager.THE.Returnstyles(font_family)
font_style = MsgBox.Listasstring(font_styles_list,"","")
theFont = Font.Make(font_family,font_style)
s.SetFont(theFont)
end
conversionfactor = newpointsize.asnumber/oldtextsize
newrectsize = (oldrectsize*(conversionfactor@conversionfactor))
myrect = rect.make(oldrectorigin,newrectsize)
g.setbounds(myrect)
end
g.Invalidate
end
end
theLayout.invalidate
Get help from ArcGIS experts
Download the Esri Support App