NumSpacing

Inheritance: java.lang.Object

public class NumSpacing

Specifies possible values in which numeral spacing can be displayed.

Examples:

Shows how to set the spacing type of the numeral.


 Document doc = new Document();
 DocumentBuilder builder = new DocumentBuilder(doc);

 // This effect is only supported in newer versions of MS Word.
 doc.getCompatibilityOptions().optimizeFor(MsWordVersion.WORD_2019);

 builder.write("1 ");
 builder.write("This is an example");

 Run run = doc.getFirstSection().getBody().getFirstParagraph().getRuns().get(0);
 if (run.getFont().getNumberSpacing() == NumSpacing.DEFAULT)
     run.getFont().setNumberSpacing(NumSpacing.PROPORTIONAL);

 doc.save(getArtifactsDir() + "Fonts.NumberSpacing.docx");
 

Fields

FieldDescription
DEFAULTSpecifies that numerals are displayed in the font\u2019s default form.
PROPORTIONALSpecifies that the forms of the numerals designed as proportionally spaced are displayed if supported by the font.
TABULARSpecifies that the forms of the numerals designed as tabular are displayed if supported by the font.
length

Methods

MethodDescription
fromName(String numSpacingName)
getName(int numSpacing)
getValues()
toString(int numSpacing)

DEFAULT

public static int DEFAULT

Specifies that numerals are displayed in the font\u2019s default form.

PROPORTIONAL

public static int PROPORTIONAL

Specifies that the forms of the numerals designed as proportionally spaced are displayed if supported by the font.

TABULAR

public static int TABULAR

Specifies that the forms of the numerals designed as tabular are displayed if supported by the font.

length

public static int length

fromName(String numSpacingName)

public static int fromName(String numSpacingName)

Parameters:

ParameterTypeDescription
numSpacingNamejava.lang.String

Returns: int

getName(int numSpacing)

public static String getName(int numSpacing)

Parameters:

ParameterTypeDescription
numSpacingint

Returns: java.lang.String

getValues()

public static int[] getValues()

Returns: int[]

toString(int numSpacing)

public static String toString(int numSpacing)

Parameters:

ParameterTypeDescription
numSpacingint

Returns: java.lang.String