FontFallBackRule

Inheritance: java.lang.Object

All Implemented Interfaces: com.aspose.slides.IFontFallBackRule

public class FontFallBackRule implements IFontFallBackRule

Represents font fallback rule

Constructors

Constructor Description
FontFallBackRule(long startIndex, long endIndex, String fontNames) Creates new instance.
FontFallBackRule(long startIndex, long endIndex, String[] fontNames) Creates new instance.

Methods

Method Description
addFallBackFonts(String fontName) Adds a new font(s) to the list of FallBack fonts.
addFallBackFonts(String[] fontNames) Adds a new fonts to the list of FallBack fonts.
getRangeStartIndex() Get first index of continuous unicode range.
setRangeStartIndex(long value) Get first index of continuous unicode range.
getRangeEndIndex() Get last index of continuous unicode range.
setRangeEndIndex(long value) Get last index of continuous unicode range.
getCount() Gets the number of fonts actually defined for range.
get_Item(int index) Gets the font name at the specified index.
clear() Removes all fonts from the list.
remove(String fontName) Removes the first occurrence of a specific FallBack font from the list.
removeAt(int index) Removes the FallBack font at the specified index of the list.
toArray() Creates and returns an array with all FallBack fonts for this rule.
toArray(int startIndex, int count) Creates and returns an array with all FallBack fonts from the specified range in list.
indexOf(String fontName) Returns an index of the specified rule in the collection.

FontFallBackRule(long startIndex, long endIndex, String fontNames)

public FontFallBackRule(long startIndex, long endIndex, String fontNames)

Creates new instance.


// Create new instance of FantFallBackRule with one font.
 IFontFallBackRule newRule = new FontFallBackRule(0x3040, 0x309F, "MS Mincho");
 // Create new instance of FantFallBackRule with several fonts.
 IFontFallBackRule newRule = new FontFallBackRule(0x3040, 0x309F, "MS Mincho, MS Gothic, Tahoma");

Parameters:

Parameter Type Description
startIndex long Start index of unicode range
endIndex long End index of unicode range
fontNames java.lang.String Font’s name or names (delimited by comma) for FallBack

FontFallBackRule(long startIndex, long endIndex, String[] fontNames)

public FontFallBackRule(long startIndex, long endIndex, String[] fontNames)

Creates new instance.


// Create new instance of FantFallBackRule with two fonts
 IFontFallBackRule newRule = new FontFallBackRule(0x3040, 0x309F, new String[] { "MS Mincho", "MS Gothic"});
 // Create new instance of FantFallBackRule with several fonts.
 IFontFallBackRule newRule = new FontFallBackRule(0x3040, 0x309F, new String[] { "MS Gothic", "Tahoma, Times New Roman" });

Parameters:

Parameter Type Description
startIndex long Start index of unicode range
endIndex long End index of unicode range
fontNames java.lang.String[] Font’s name or names (delimited by comma) for FallBack

addFallBackFonts(String fontName)

public final void addFallBackFonts(String fontName)

Adds a new font(s) to the list of FallBack fonts.


// Create new instance of FontFallBackRule
 IFontFallBackRule newRule = new FontFallBackRule(0x3040, 0x309F, "MS Mincho");
 //Add a second font to the rule 
 newRule.addFallBackFonts("MS Gothic");
 //Add a third and fourth fonts to the rule 
 newRule.addFallBackFonts("Tahoma, Times New Roman");

Parameters:

Parameter Type Description
fontName java.lang.String Font’s name or names (delimited by comma) for FallBack

addFallBackFonts(String[] fontNames)

public final void addFallBackFonts(String[] fontNames)

Adds a new fonts to the list of FallBack fonts.


//Create new instance of FontFallBackRule
 IFontFallBackRule newRule = new FontFallBackRule(0x3040, 0x309F, "MS Mincho");
 //Add of another three fonts to the rule 
 newRule.addFallBackFonts(new String [] {"MS Gothic","Tahoma, Times New Roman"});

Parameters:

Parameter Type Description
fontNames java.lang.String[] Font’s name or names (delimited by comma) for FallBack

getRangeStartIndex()

public final long getRangeStartIndex()

Get first index of continuous unicode range.

Returns: long

setRangeStartIndex(long value)

public final void setRangeStartIndex(long value)

Get first index of continuous unicode range.

Parameters:

Parameter Type Description
value long

getRangeEndIndex()

public final long getRangeEndIndex()

Get last index of continuous unicode range.

Returns: long

setRangeEndIndex(long value)

public final void setRangeEndIndex(long value)

Get last index of continuous unicode range.

Parameters:

Parameter Type Description
value long

getCount()

public final int getCount()

Gets the number of fonts actually defined for range. Read-only int.

Returns: int

get_Item(int index)

public final String get_Item(int index)

Gets the font name at the specified index. Read-only IFontFallBackRule.

Parameters:

Parameter Type Description
index int

Returns: java.lang.String

clear()

public final void clear()

Removes all fonts from the list.

remove(String fontName)

public final void remove(String fontName)

Removes the first occurrence of a specific FallBack font from the list.


// Create a rule contains a list of fonts.
 IFontFallBackRule newRule = new FontFallBackRule(0x3040, 0x309F, "MS Mincho, MS Gothic, Tahoma, Times New Roman");
 // Remove Tahoma from the list.
 newRule.remove("Tahoma");

Parameters:

Parameter Type Description
fontName java.lang.String The font’s name to remove from the list.

removeAt(int index)

public final void removeAt(int index)

Removes the FallBack font at the specified index of the list.


// Create a rule contains a list of fonts.
 IFontFallBackRule newRule = new FontFallBackRule(0x3040, 0x309F, "MS Mincho, MS Gothic, Tahoma, Times New Roman");
 //Removing Tahoma from the list.
 newRule.remove(2);

Parameters:

Parameter Type Description
index int The zero-based index of the font to remove.

toArray()

public final String[] toArray()

Creates and returns an array with all FallBack fonts for this rule.


// Create a rule contains a list of fonts.
 IFontFallBackRule newRule = new FontFallBackRule(0x3040, 0x309F, "MS Mincho, MS Gothic, Tahoma, Times New Roman");
 // Get all font names as array.
 String[] fontNames = newRule.toArray();

Returns: java.lang.String[] - Array of String

toArray(int startIndex, int count)

public final String[] toArray(int startIndex, int count)

Creates and returns an array with all FallBack fonts from the specified range in list.

// Create a rule contains a list of fonts.
 IFontFallBackRule newRule = new FontFallBackRule(0x3040, 0x309F, "MS Mincho, MS Gothic, Tahoma, Times New Roman");
 // Get a last two font names as array.
 String[] fontNames = newRule.toArray(2, 2);

Parameters:

Parameter Type Description
startIndex int An index of a first font to add.
count int A number of fonts to add.

Returns: java.lang.String[] - Array of String

indexOf(String fontName)

public final int indexOf(String fontName)

Returns an index of the specified rule in the collection.


// Create a rule contains a list of fonts.
 IFontFallBackRule newRule = new FontFallBackRule(0x3040, 0x309F, "MS Mincho, MS Gothic, Tahoma, Times New Roman");
 // Get index of Tahoma.
 int tahomaIndex = newRule.indexOf("Tahoma");

Parameters:

Parameter Type Description
fontName java.lang.String Font’s name to find.

Returns: int - Index of a font or -1 if font not found in list.