Introduction: Inkscape: How to Center a Text in a Rectangle ? (~ 8 Skills)

Skill list:

  • Zooming in/out
  • Coloring of an object
  • Transparency of an object
  • Rectangle tool
  • Text tool
  • Re-sizing an object
  • Centering an object in relation to another object
  • Picture export

Supplies

Inkscape is available on Linux, macOS and Microsoft, free of charge.

Step 1: Centering/Zooming In/Zooming Out of the Document If Needed

When the document is opened,

  • click on “5” if you would like the document centered,
  • click on “” to zoom out,
  • click on “+” to zoom in.

Step 2: Creation of a Rectangle

You can find the tool to create a rectangle in the toolbar.
You can also select the tool by pressing the "R" key.

You can choose the color filling from the palette.
You can also open the "Fill and Stroke" menu from the keyboard shortcut "Ctrl"+"Shift"+"F".

Before being able to modify the rectangle color,
the rectangle needs to be selected.
To select the rectangle, press the "S" key,
or click on the "Select" tool in the tool menu.

Once the rectangle is selected, arrow-shaped handles appear.

The RGB (Red-Green-Blue) data gives the amount of red, green and blue in the final color.

If the values for Red and Green are 0, and the value for Blue is between 1 and 255,
the final color will be blue,
potentially a really dark blue, for example if 1 is the value.

When the value for "A" is 100, there is no transparency applied to the object.

The illustration uses 249 for value of Red, Green and Blue
and 30 for A, meaning that the rectangle is somewhat transparent.

Step 3: Adding Text to the Project

The text tool can be selected by pressing the key "T",
or by clicking on its icon in the tool menu.

The keyboard shortcut "Alt"+"Enter" is useful to end the current line of text and to start a new one.

"Comic Sans MS" is the font used in the example, to be mindful of accessibility for persons with dyslexia.

The keyboard shortcut to access the "Text and Font" settings is
"Ctrl"+"Shift"+"T".

If your operating system is produced by Microsoft,
by typing "Fonts" in the search bar, you can open the fonts control panel,
and have a quick overview of all the fonts.

The aim in this example is to center the text inside the rectangular box.

First, the size of the text needs to be reduced.
To select the text element, press the "S" key,
or click on the "Select" tool in the tool menu.

Then, to maintain the proportions of the element while reducing its size,
press the "Ctrl" key, and while pressing the key, click one of the corner arrow-shaped handle,
and while clicking, move the handle to reduce the size of the element.

Step 4: Centering the Elements

The "Align and Distribute" settings helps to make sure that the text is well aligned within the rectangle.
The keyboard shortcut "Ctrl"+"Shift"+"A" opens the settings.

To select both text and rectangle, press the "Shift" key and click on both elements.
A dotted line should appear around both elements.

Make sure to have the "Relative to" setting set on "Biggest object", and not the default "Page" setting.
Then click on the third icon of both rows of the alignment settings,
to center the text both vertically and horizontally inside the rectangle.

When both elements are selected,
clicking on the keyboard shortcut "Ctrl"+"G" groups the two elements into a single one.
The keyboard shortcut "Shift"+"Ctrl"+"G" would undo the previous action.

If you want to center the rectangle within the page,
you can do so by modifying the "Relative to" setting from "Biggest object" to "Page",
and by clicking on the same row icons.

Step 5: Producing an Image From the Work Done

The keyboard shortcut "Ctrl"+"Shift"+"E" opens the "Export PNG Image" settings.

Select the "Drawing" button if you want a picture made of all elements added to the page.

The "Export As" setting is used to define where to save the picture,
under what name, and with what format.
The default PNG format should meet most of your needs.

The "Export" button launches the process that creates the picture.