Tuesday, May 10, 2011

How to create a boxed-label in Xfig

27 Jamadil Awal 1432H

Thank you to Brian V. Smith for his speedy reply on how to create a boxed-label using Xfig.

Pic 1 - An example of a boxed-label created using OpenOffice Writer.
See the box containing the text Sharp nose? Because i don't know what the correct term is, that's what i call a boxed-label... :P


1. Run Xfig. From the Panel > Applications > Graphics > Xfig. Refer Pic 2.

Pic 2 - Refer Step 1.


2. In the Drawing Mode panel (refer Pic 3), click the POLYLINE drawing icon (refer Pic 4).

Pic 3 - Refer Step 2. The Drawing Mode panel.


Pic 4 - Refer Step 2. The POLYLINE drawing icon in the Drawing Mode panel.


3. Near the bottom-right corner, there is a box labelled Dimension line (refer Pic 5). Click it.

Pic 5 - Refer Step 3. The Dimension line icon.


4. A pop-up window labelled Xfig: Dimension Line Settings appears. Set it as follows:

in the Line section:
- set the Thickness = 0

in the Arrows section:
- set the Types = (NONE) (NONE)
*Click + hold on the arrowhead icon. A pop-up menu appears. At the top of the menu, select (NONE).

in the Box section:
- set the Thickness = 0
 *This is the case if you want a border-less box.
 
- set the Color = pick a color (this will be the fill color of the label)
 *Since the canvas is white, it is probably a good practise for the time being to change the color to something visible. For this example, i use Pink4.

 in the Ticks section:
- make sure the Show ticks checkbox is empty.
*Ticks are the right-angled line at both ends of the line we will be drawing later.
 
in the Text section:
- put a tick in the User defined text (not actual length) checkbox.
- select the Font, Size, and Color for the text. i use the default settings.

Then click the Ok button at the bottom of the window.

Pic 6 - Refer Step 4. Changing the properties in the Xfig: Dimension Line Settings pop-up window.


5. Hold down the Shift button. Left-click the mouse button on the canvas to create the first point. Release the Shift button.


6. Left-click the mouse button again to create the final (end) point.


7. A pop-up window titled Xfig: Edit panel appears. At the bottom of this window is the Text section for you to input your text.

*When typing-in your text, make sure the cross-hair/cursor rests within the text field itself; otherwise nothing appears when you type. Think of it as a way of activating that particular field.

Pic 7 - Refer Step 7. Typing in the text.


8. When you want to see the changes, click the Apply button.

When you're satisfied with the changes, click the Done button.

Pic 8 - Refer Step 8. Previewing and confirming the changes made.


9. To make further edits to your label, click the CHANGE OBJECT via EDIT panel icon (refer Pic 10) in the Editing Mode panel (refer Pic 9). Go to your label and left-click it. The Xfig: Edit panel pop-up window (refer Pic 7, and Pic 8) appears.

Pic 9 - Refer Step 9. The Editing Mode panel.


Pic 10 - Refer Step 9. The CHANGE OBJECT via EDIT panel icon.



Note:
The height of the boxed-label follows the height of the text. You aren't able to change the height of the box. Refer Pic 11.

Pic 11 - Example how boxed-label height follows the text height.



Just in case anyone is interested to read in Brian's own words, here are excerpt from the emails.

Here is my question:
Was wondering if there is an automated feature to add boxed-labels like the one shown in the attached file Screenshot-13.png. What i understand up to now, the only way to created a boxed-label takes 3 steps: 1- create a box, 2- add the text, and 3- compound the box and text. Is there such a thing that the box automatically expands as text is typed + we can change the background color + line size? Similar to the "Insert text" feature in Microsoft Word.


And here is his reply:
That's a very good question.  xfig doesn't have exactly such a feature, but you can use the "dimension line" object to do it.

Select the line drawing tool and on the bottom panel scroll to the "Dimension line" button at the right edge. Click on it and set the following properties:

Line/Thickness = 0
Arrows/Types = (None) (None)
Box/Thickness = 0
Box/Color = your choice (this will be the color behind the text)
Uncheck Ticks/Show ticks
Under "Text" check "User defined text..."
Select the font, size and color for the text

Click Ok

To make a text box, hold the shift key and click on the canvas where you want the left edge of the text box to be and click anywhere to the right of that.
The edit panel will pop up and you can enter the text at the bottom of that.
Click Ok and voila!

The widths of the boxes will be equal to the length of the text string, so if you want them all the same width you will need to add padding spaces.

It's a little out of the ordinary, but I tried it here and it looks ok.
Once you've set up the dimension like attribute panel you just need to click twice and enter the text to make them.

No comments:

Post a Comment