PROBLEM

Changing text size in a layout legend with Avenue is not permanent

Last Published: April 25, 2020

Description

Resizing legend text with the Symbol Window Font Manager works permanently. Text size changes made to the legend with Avenue, however, revert to the original size when closing and reopening the project.

Cause

This is a known issue.

Solution or Workaround

Reset the bounds for the LegendFrame with the SetBounds request. The example below demonstrates how to incorporate this request into a script that resizes legend text.

  1. Open a new script window.

    A. Activate the Project window.
    B. Click the Scripts icon.
    C. Click New.

  2. Copy the following code into the new window:

    Code:
    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)
    end
    conversionfactor = newpointsize.asnumber/oldtextsize
    newrectsize = (oldrectsize*(conversionfactor@conversionfactor))
    myrect = rect.make(oldrectorigin,newrectsize)
    g.setbounds(myrect)
    end
    g.Invalidate
    end
    end
    theLayout.invalidate

  3. Attach the script to a button on the Layout GUI.

    A. Compile the script.
    B. Switch to the Project window.
    C. Select Customize from the Project menu.
    D. On the Customize dialog, select Layout under Type dropdown.
    E. Select Buttons under Category.
    F. Click the New button.
    G. Double-click the Click property in the Customize dialog box.
    H. Enter the name of the script in the Script Manager and click Select.
    I. Close the Customize dialog box.

    For more information, see 'Customize dialog box' in ArcView Help.

  4. Open the layout and click the new button

Article ID:000004208

Software:
  • Legacy Products

Get help from ArcGIS experts

Contact technical support

Download the Esri Support App

Go to download options

Discover more on this topic