Text Boxes and Images

The textbox and image elements allow you to embed multi-line text blocks and images into any FypML figure. Prior to their introduction in version 4.4.1, you had to construct a multi-line text block using a series of tediously positioned single-line label nodes, and the heatmap node was the only avenue for displaying image-like data.

The screenshot on the right shows the property editors for these two element classes. Both define a "bounding box" [X Y W H], where (X, Y) is the bottom-left corner of the box in the parent container and (W, H) are the box's horizontal and vertical extents. θ is the angle by which the box is rotated about its bottom-left corner (in degrees), and M is the size of an inner margin that separates the content (text or image) from the edges of the bounding box. The box's border will be drawn in accordance with the node's stroke styles (the bottom row of widgets on the editor panel); if you don't want the border drawn, set the stroke width to 0 inches.

A background fill widget -- the large button-like control to the right of the bounding box parameters -- chooses the background fill for the text box or image. The widget supports the selection of a solid-color fill (opaque, translucent or transparent), an axial gradient, or a radial gradient. The gradient fills are defined such that a single cycle of the gradient spans the object's bounding box. In the examples shown, the text box has an axial gradient fill that varies between white and orange and is oriented at a 45-degree angle with respect to the bounding box; the image has a solid green fill.

The lines of text that appear in a textbox node are entered in the text component at the top of the Text Box Properties editor. You can enter any length of text. The horizontal alignment indicates how each line in the text block is positioned: starting on the left margin, ending on the right margin, or centered within the bounding box. The vertical alignment indicates how the entire block is positioned vertically: first line of block is aligned with the top margin, last line is aligned with bottom margin, or the block is centered vertically with respect to the bounding box. All text within the text block is rendered in the same font and text/fill color, as specified in the properties editor. It is not possible to apply different font styling to different portions of the text block.

Line breaks in the text block always respect the width of the bounding box, less the left and right margins. If any single word is too long to fit, it will be broken across two or more consecutive lines. After determining the line breaks, if there are too many lines to fit within the bounding box, then the text block will flow past the bottom margin, top margin, or both margins -- depending on the chosen vertical alignment. The Line Ht property (new in V4.5.2) specifies the baseline to baseline spacing from one text line to the next (as a fraction of the font size). If the Clip? flag is set, then any text outside the margins is cut off.

If you want to introduce a line break at a particular point in the text content, hit the Enter key when inputting text into the editor's text area. Of course, this means that Enter does not trigger an update of the textbox node's definition, as happens when you enter a string into a single-line text field. To redraw the text box after entering new text content, click on the "update" button just to the right of the text area. Alternatively, use the keyboard shortcut Shift+Enter when the focus is on the text area (also, if you move the focus to another widget, the text box content is automatically updated).

Note the text field labeled "ID (optional)" underneath the text content area in the Text Box Properties editor. The notion of a "graphic object ID" was introduced in version 4.6.2 for select object types: text labels, text boxes, and graphs. If the ID is a non-empty string, it serves to uniquely identify the label, text box, or graph among all the graphic objects that comprise a figure. The ID is never rendered in any way. It is really intended for use outside of Figure Composer --it provides a way to programmatically locate a particular label, text box or graph within an existing FypML figure, so that you can modify the content of the label or text box, replace the graph with a different one, and so on. If you have no need for the object ID, simply leave it blank.

When you first create an image node, there's no image data associated with it. On screen, Figure Composer uses a typical "broken image" icon to indicate this state. Click on the Load Image... pushbutton in the Image Properties editor to load an image from file. While the image data is stored in the FypML document in PNG format, Figure Composer lets you embed any JPEG or PNG source image. The image is scaled to fit within the target rectangle defined by the bounding box, minus any margin specified; unlike the text box, the image content is not clipped. However, you can elect to crop the image so that only the cropped portion is displayed. You can crop the image by specifying the top-left corner coordinates and dimensions of the crop rectangle in the text fields near the top of the editor panel. Alternatively -- and more conveniently, you can crop the image interactively on the figure canvas. The original image data is always maintained in the FypML document, so nothing is lost when you crop it. If you're not happy with the cropped image, simply click the Reset button to restore the original image.

If the aspect ratio of the image does not match that of the target rectangle, the scale factor and location of the image are adjusted so that its aspect ratio is preserved and it appears centered both horizontally and vertically within the target rectangle.

Text Box and Image Properties