I am using LayoutElementFactory.Instance.CreateRectangleParagraphGraphicElement() to create paragraph text in a layout. The method takes an Envelope argument for drawing the text within. Is there any way to determine whether the rendered text actually fit within the provided envelope?
Hello Brennan. Thanks for your request/idea. There are a couple of things we want to do:
First, in the UI, like with Legends, is to have a fitting strategy for rectangle text. For example, multiple columns, shrink text or enlarge box. The problem enlarging the box is knowing which direction. Perharps we can have options like change only width, change only height or change both by maintaining the aspect ratio.
Second, provide a boolean that returns if a the information fits in its envelope. This can apply to area text, scale bars, legends, etc. Having this before the item above would allow you to iterate through sizes until all text fit.
Hello Jeff Barrette,
Those enhancements sound great and would solve my current problems with text sizing/positioning (assuming these properties can be set with the SDK for programmatically generated elements). With the option to 'Enlarge Box' on 'Only Height', I could create a paragraph text element at the desired width and with a very small height--then the element would automatically set the envelope height to make the text fit. This would also address the other issue I have: How to get size of rendered text? since the envelope would then correspond to the actual size of the rendered text. I hope those changes are in scope for the next SDK release!
Hi, @JeffBarrette. I was thinking about adding "rectangle text fitting strategy" as an idea, but it sounds like this is already on Esri's radar. Do you know when this might be available?
It would be really cool if text fitting strategies for legends and other layout text boxes included options like abbreviations and font width compression (as is already possible for map labels).
This is closely related to an idea I posted about a year ago that hasn't gotten much attention:
Intelligent grouping (flow) for layout elements
Hello @JeffThomasILM , please add the idea. It allows others to see and helps us prioritize. Add your other ideas too.
Jeff - Layout and arcpy.mp teams.