Border around formatted text in Inkscape
I'm trying to create a block of text with formatting and I want to surround it with a border. I've tried the "Flow into frame" feature, but that removes formatting (I would like line breaks, spaces, bold, etc...).
Right now, I'm manually drawing a rectangle around it and aligning it (using the align and distribute functions). Is there a way to automate this and produce consistent results? My current technique does not guarantee even spacing from the border to text of multiple boxes like these.
Yes! Here is the end result:
Step by step:
- Create some flowed text by using the text tool to first drag a rectangle and then type.
- Separately, create a rectangle roughly around the text (really, the rectangle can be anywhere)
- With the rectangle selected, chose "Path" > "Linked Offset". Then grab the small diamond and drag it in to make a second, smaller rectangle.
- Select the text and the smaller rectangle and choose "Text" > "Flow into frame". Then select the smaller rectangle and remove the stroke to make it invisible. Now the text will flow within the smaller (invisible) rectangle, which is dynamically linked to the shape of the larger (visible) rectangle.
- Then, if you like, you can add a small border radius on the visible rectangle and you get this nice looking result.
- If you do need to modify the space between the text and the rectangle, you can carefully select it by grabbing it with the text and the subtracting the text from the selection, or you can drill down to it within the XML Editor. When you do get it selected, then you can adjust the margin as follows:
- Finally, group the text and the two rectangles, and you're all set!