IFontsManager
public interface IFontsManager
Manages fonts across the presentation.
Methods
Method | Description |
---|---|
getFontSubstRuleList() | Font substitutions to use when rendering Read/write IFontSubstRuleCollection. |
setFontSubstRuleList(IFontSubstRuleCollection value) | Font substitutions to use when rendering Read/write IFontSubstRuleCollection. |
getFontFallBackRulesCollection() | Represents a user’s collection of FontFallBack rules for managing of collections of fonts for proper substitutions by fallback functionality Read/write IFontFallBackRulesCollection. |
setFontFallBackRulesCollection(IFontFallBackRulesCollection value) | Represents a user’s collection of FontFallBack rules for managing of collections of fonts for proper substitutions by fallback functionality Read/write IFontFallBackRulesCollection. |
getFonts() | Returns the fonts used in the presentation |
getSubstitutions() | Gets the information about fonts that will be replaced on the presentation’s rendering. |
getEmbeddedFonts() | Returns the fonts embedded in the presentation |
removeEmbeddedFont(IFontData fontData) | Removes the embedded font |
addEmbeddedFont(IFontData fontData, int embedFontRule) | Adds the embedded font. |
addEmbeddedFont(byte[] fontData, int embedFontRule) | Adds the embedded font |
replaceFont(IFontData sourceFont, IFontData destFont) | Replace font in presentation |
replaceFont(IFontSubstRule substRule) | Replace font in presentation using information provided in IFontSubstRule |
replaceFont(IFontSubstRuleCollection substRules) | Replace font in presentation using information provided in collection of IFontSubstRule |
getFontBytes(IFontData fontData, int fontStyle) | Retrieves the byte array representing the font data for a specified font style and font data. |
getFontEmbeddingLevel(byte[] fontBytes, String fontName) | Determines the embedding level of a font from the given byte array and font name. |
getFontSubstRuleList()
public abstract IFontSubstRuleCollection getFontSubstRuleList()
Font substitutions to use when rendering Read/write IFontSubstRuleCollection.
Returns: IFontSubstRuleCollection
setFontSubstRuleList(IFontSubstRuleCollection value)
public abstract void setFontSubstRuleList(IFontSubstRuleCollection value)
Font substitutions to use when rendering Read/write IFontSubstRuleCollection.
Parameters:
Parameter | Type | Description |
---|---|---|
value | IFontSubstRuleCollection |
getFontFallBackRulesCollection()
public abstract IFontFallBackRulesCollection getFontFallBackRulesCollection()
Represents a user’s collection of FontFallBack rules for managing of collections of fonts for proper substitutions by fallback functionality Read/write IFontFallBackRulesCollection.
Presentation pres = new Presentation(); try { // Getting of empty or preinitialized rules collection from FontsManager IFontFallBackRulesCollection rulesList = pres.getFontsManager().getFontFallBackRulesCollection(); // adding of rules to collection rulesList.add(new FontFallBackRule(0x400,0x4FF, "Times New Roman")); // or // initialization of new instance of rules collection IFontFallBackRulesCollection rulesList = new FontFallBackRulesCollection(); // adding of rules to collection rulesList.add(new FontFallBackRule(0x400,0x4FF, "Times New Roman")); // and replacing of existing collection by the new one in FontsManager pres.getFontsManager().setFontFallBackRulesCollection(rulesList); } finally { if (pres != null) pres.dispose(); }
Returns: IFontFallBackRulesCollection
setFontFallBackRulesCollection(IFontFallBackRulesCollection value)
public abstract void setFontFallBackRulesCollection(IFontFallBackRulesCollection value)
Represents a user’s collection of FontFallBack rules for managing of collections of fonts for proper substitutions by fallback functionality Read/write IFontFallBackRulesCollection.
Presentation pres = new Presentation(); try { // Getting of empty or preinitialized rules collection from FontsManager IFontFallBackRulesCollection rulesList = pres.getFontsManager().getFontFallBackRulesCollection(); // adding of rules to collection rulesList.add(new FontFallBackRule(0x400,0x4FF, "Times New Roman")); // or // initialization of new instance of rules collection IFontFallBackRulesCollection rulesList = new FontFallBackRulesCollection(); // adding of rules to collection rulesList.add(new FontFallBackRule(0x400,0x4FF, "Times New Roman")); // and replacing of existing collection by the new one in FontsManager pres.getFontsManager().setFontFallBackRulesCollection(rulesList); } finally { if (pres != null) pres.dispose(); }
Parameters:
Parameter | Type | Description |
---|---|---|
value | IFontFallBackRulesCollection |
getFonts()
public abstract IFontData[] getFonts()
Returns the fonts used in the presentation
Returns: com.aspose.slides.IFontData[] - An array of fonts
getSubstitutions()
public abstract System.Collections.Generic.IGenericEnumerable<FontSubstitutionInfo> getSubstitutions()
Gets the information about fonts that will be replaced on the presentation’s rendering.
Presentation pres = new Presentation("pres.pptx"); try { for (FontSubstitutionInfo fontSubstitution : pres.getFontsManager().getSubstitutions()) { System.out.println(fontSubstitution.getOriginalFontName() + " -> " + fontSubstitution.getSubstitutedFontName()); } } finally { if (pres != null) pres.dispose(); }
Returns: com.aspose.ms.System.Collections.Generic.IGenericEnumerable<com.aspose.slides.FontSubstitutionInfo> - Collection of all fonts substitution FontSubstitutionInfo.
getEmbeddedFonts()
public abstract IFontData[] getEmbeddedFonts()
Returns the fonts embedded in the presentation
Returns: com.aspose.slides.IFontData[] - Embedded fonts IFontData[]
removeEmbeddedFont(IFontData fontData)
public abstract void removeEmbeddedFont(IFontData fontData)
Removes the embedded font
Parameters:
Parameter | Type | Description |
---|---|---|
fontData | IFontData | Font data object IFontData |
addEmbeddedFont(IFontData fontData, int embedFontRule)
public abstract void addEmbeddedFont(IFontData fontData, int embedFontRule)
Adds the embedded font.
Parameters:
Parameter | Type | Description |
---|---|---|
fontData | IFontData | Font data object IFontData |
embedFontRule | int | Embedded font rule EmbedFontCharacters |
Keep in mind when copying any fonts that most fonts are copyrighted. First locate the license of a font before hand and verify they can be freely transferred to another machine. |
addEmbeddedFont(byte[] fontData, int embedFontRule)
public abstract void addEmbeddedFont(byte[] fontData, int embedFontRule)
Adds the embedded font
Parameters:
Parameter | Type | Description |
---|---|---|
fontData | byte[] | Font data byte[] |
embedFontRule | int | Embedded font rule EmbedFontCharacters |
Keep in mind when adding any fonts that most fonts are copyrighted. First locate the license of a font before hand and verify they can be freely transferred to another machine. |
replaceFont(IFontData sourceFont, IFontData destFont)
public abstract void replaceFont(IFontData sourceFont, IFontData destFont)
Replace font in presentation
Parameters:
Parameter | Type | Description |
---|---|---|
sourceFont | IFontData | Source font |
destFont | IFontData | Destination font |
replaceFont(IFontSubstRule substRule)
public abstract void replaceFont(IFontSubstRule substRule)
Replace font in presentation using information provided in IFontSubstRule
Parameters:
Parameter | Type | Description |
---|---|---|
substRule | IFontSubstRule | Font substitution info |
replaceFont(IFontSubstRuleCollection substRules)
public abstract void replaceFont(IFontSubstRuleCollection substRules)
Replace font in presentation using information provided in collection of IFontSubstRule
Parameters:
Parameter | Type | Description |
---|---|---|
substRules | IFontSubstRuleCollection | Font substitution info collection |
getFontBytes(IFontData fontData, int fontStyle)
public abstract byte[] getFontBytes(IFontData fontData, int fontStyle)
Retrieves the byte array representing the font data for a specified font style and font data.
Presentation pres = new Presentation ("Presentation.pptx"); try { // Retrieve all fonts used in the presentation IFontData[] fonts = pres.getFontsManager().getFonts(); // Get the byte array representing the regular style of the first font in the presentation byte[] fontBytes = pres.getFontsManager().getFontBytes(fonts[0], FontStyle.Regular); } finally { if (pres != null) pres.dispose(); }
Parameters:
Parameter | Type | Description |
---|---|---|
fontData | IFontData | The font data object containing the information about the font IFontData. |
fontStyle | int | The style of the font for which the data is to be retrieved FontStyle. |
Returns: byte[] - A byte array containing the font data for the specified font style. If the font data or style is not found, returns null.
getFontEmbeddingLevel(byte[] fontBytes, String fontName)
public abstract int getFontEmbeddingLevel(byte[] fontBytes, String fontName)
Determines the embedding level of a font from the given byte array and font name.
Presentation pres = new Presentation(pptxFileName); try { // Retrieve all fonts used in the presentation IFontData[] fontDatas = pres.getFontsManager().getFonts(); // Get the byte array representing the regular style of the first font in the presentation byte[] bytes = pres.getFontsManager().getFontBytes(fontDatas[0], FontStyle.Regular); // Determine the embedding level of the font int embeddingLevel = pres.getFontsManager().getFontEmbeddingLevel(bytes, fontDatas[0].getFontName()); } finally { if (pres != null) pres.dispose(); }
Parameters:
Parameter | Type | Description |
---|---|---|
fontBytes | byte[] | The byte array containing the font data. |
fontName | java.lang.String | The name of the font. |
Returns: int - The embedding level of the specified font.