I am attempting to place text within a certain space within a layout. I want the text to automatically wrap to fit within the space, and I want the font size to shrink automatically if the height of the text goes beyond that space.
I can specify an envelope and create texts that automatically wraps by creating a paragraph text element like this:
Coordinate2D lowerLeftPoint = new Coordinate2D(xPosition, yPosition);
Coordinate2D upperRightPoint = new Coordinate2D(xPosition + maxTextWidth, yPosition+maxTextHeight);
Envelope textEnvelope = EnvelopeBuilder.CreateEnvelope(lowerLeftPoint, upperRightPoint);
GraphicElement renderedText = LayoutElementFactory.Instance.CreateRectangleParagraphGraphicElement(_layout, textEnvelope, text, textSymbol);
However, as this link explains, paragraph text does not auto-size to fit its envelope. The link also points out that point text does automatically resize, but will not wrap automatically.
With the code above, I end up with text that will get cut off when it goes beyond the envelope. Pro will add an ellipsis graphic to the end of the text to indicate that it got cut off, but I'm not seeing any property that indicates whether or not the text was cut off.
Ideally, I could just set some property to tell the paragraph text to auto-size to fit within the envelope. If such a property does not exist, is there a way to programmatically check whether or not the text fit within the envelope or got cut off? If so, I could manually iterate through smaller and smaller font sizes until the text fits. I'm also open to trying a different approach entirely as long as the text will both wrap and shrink to fit within some specified space.