Skip to end of metadata
Go to start of metadata

Description

How do I Center the text in a field?

Solution

Padding
Loftware Label Manager Design Mode provides a setting in the Properties Box for adjusting the location of the information in the text field on the label. The setting is called 'Padding' in the Properties Box, and the setting choices are:

  • None - Default option, whereby the characters begin on the left side of the field.
  • Leading Zeros - Zeros fill in all unused character spaces before the first character of the field. Example: Let us say that the Max # Chars in a "Ship_To_Name" field equals 22, and the entry name for this field is 6 characters long. With the Leading Zeros option chosen, there are 16 zeros printed before the 6 character company name.
  • Leading Spaces - The result is the same as outlined above, only instead of zeros, there are spaces before the name in the field.
  • Trailing Spaces - The result is similar to the previous option, except that the spaces are inserted after the name rather than before.
  • Center with Spaces - This option centers the text in the field.

To center text in the field

  1. Click on "Padding" and the drop-down box to view the options.
  2. Select "Center with Spaces" from the list.

When printed, the text is well centered on the field.


However, there are some finer points to keep in mind. In the example, the maximum number of characters (Max # Chars) for this field is 22, and the Ship_To_Name for this label has only six letters. (ABCDEF) Loftware Label Manager subtracts the number of characters in the field (6) from the Max # Chars, (22), and divides the remainder (16) by 2 (8). Thus, in this case, the field is printed with 8 spaces, followed by the Ship_To_Name (6 letters), followed by 8 more spaces. The Ship_To_Name is centered precisely in the field.


This works great if the result of the subtraction of the Max # Chars from the number of characters in the field is an even number. However, if the result of the subtraction is an odd number, then the division by 2 results in a remainder. Since Loftware does not adjust text in half-space increments, an odd number creates a centered field that is one space off.


Note: The information in the field is not shown as centered when displayed in Print Preview, however, it does print as specified.

More About Centering
The centering of text is dependent upon the type of font chosen, and the printer you are using. Some fonts are Proportional, while others are Monospace.Proportional Fonts - A Proportional font is one in which each character is a different size. The spacing is proportional to the character size.

Example
Five W's take up much more space than five i's.
WWWWW
iiiii

Monospace Fonts - All Monospace fonts are evenly spaced. Using the previous example, the W's and the i's take up the same amount of space.
W WWWW
 i   i   i   i   I

The "Center with Spaces" option in Padding only works well with Monospace Fonts. Since the "Center with Spaces " option is based upon the number of characters as opposed to the physical width of the field and characters, attempting to use centering with Proportional Fonts creates unpredictable results.

The only way to know for sure whether or not a font is Proportional or Monospace is to print with it. (Do not rely on the view on your screen) Even though you may be able to choose one of these options from the 'Spacing' property in the Properties Box, the font itself or the printer may not support the option you have chosen. Thermal Transfer printers generally have proportional fonts.

A hands-on example follows using TrueType fonts:Courier New is a Monospace Font. Type 20 W's in a text field (with 20 Max # Chars, Padding set to "None") in an On-Demand Print Form. In the next field, also with 20 Max # Chars, but Padding set to "Center with Spaces", type in 4 W's. The results are seen as quite accurate; as the text in the second field is well centered:Change the font to 'Arial'; a Proportional Font, and use the same Padding options as well as the same typing as described above. You see the result is a field that is not centered correctly:It is to your advantage to experiment with centering using your particular printers, and using various fonts, to see what combinations work best in your application.
See the Loftware Label Manager's User's Guide more information.

Article Number

 2009302

Versions

 All versions of Loftware

Environment

All supported installation environments.