java.lang.Objectcom.aspose.words.FontSettings
public class FontSettings
Aspose.Words uses font settings to resolve the fonts in the document. Fonts are resolved mostly when building document layout
or rendering to fixed page formats. But when loading some formats, Aspose.Words also may require to resolve the fonts. For example, when
loading HTML documents Aspose.Words may resolve the fonts to perform font fallback. So it is recommended that you set the font settings in
By default all documents uses single static font settings instance. It could be accessed by
Changing font settings is safe at any time from any thread. But it is recommended that you do not change the font settings while
processing some documents which uses this settings. This can lead to the fact that the same font will be resolved differently
in different parts of the document.
Constructor Summary |
---|
FontSettings()
Creates new instance with default settings. |
Property Getters/Setters Summary | ||
---|---|---|
java.lang.String | getDefaultFontName() | |
void | setDefaultFontName(java.lang.String value) | |
Gets or sets the default font name. | ||
static FontSettings | getDefaultInstance() | |
Static default font settings. |
Method Summary | ||
---|---|---|
void | addFontSubstitutes(java.lang.String originalFontName, java.lang.String[] substituteFontNames) | |
Adds substitute (alternative) font names for given original font name. | ||
Aspose.Words.Fonts.FontSourceBase[] | getFontsSources() | |
Gets a copy of the array that contains the list of sources where Aspose.Words looks for TrueType fonts. | ||
java.lang.String[] | getFontSubstitutes(java.lang.String originalFontName) | |
Returns array containing alternative font names to be used if original font is not presented in system. | ||
void | resetFontSources() | |
Resets the fonts sources to the system default. | ||
void | setFontsFolder(java.lang.String fontFolder, boolean recursive) | |
Sets the folder where Aspose.Words looks for TrueType fonts when rendering documents or embedding fonts.
This is a shortcut to |
||
void | setFontsFolders(java.lang.String[] fontsFolders, boolean recursive) | |
Sets the folders where Aspose.Words looks for TrueType fonts when rendering documents or embedding fonts. | ||
void | setFontSubstitutes(java.lang.String originalFontName, java.lang.String[] substituteFontNames) | |
Override substitute (alternative) font names for given original font name. |
Constructor Detail |
---|
public FontSettings()
Property Getters/Setters Detail |
---|
getDefaultFontName/setDefaultFontName | |
public java.lang.String getDefaultFontName() / public void setDefaultFontName(java.lang.String value) |
The default font name is used when Aspose.Words can't find requested font in specified sources.
The default value is 'Times New Roman'.
getDefaultInstance | |
public static FontSettings getDefaultInstance() |
Method Detail |
---|
addFontSubstitutes | |
public void addFontSubstitutes(java.lang.String originalFontName, java.lang.String[] substituteFontNames) |
originalFontName
- Original font name.substituteFontNames
- List of alternative font names to be used if original font is not presented in system.getFontsSources | |
public Aspose.Words.Fonts.FontSourceBase[] getFontsSources() |
The returned value is a copy of the data that Aspose.Words uses. If you change the entries
in the returned array, it will have no effect on document rendering. To specify new font sources
use the
getFontSubstitutes | |
public java.lang.String[] getFontSubstitutes(java.lang.String originalFontName) |
originalFontName
- Original font name.resetFontSources | |
public void resetFontSources() |
setFontsFolder | |
public void setFontsFolder(java.lang.String fontFolder, boolean recursive) |
fontFolder
- The folder that contains TrueType fonts.recursive
- True to scan the specified folders for fonts recursively.setFontsFolders | |
public void setFontsFolders(java.lang.String[] fontsFolders, boolean recursive) |
By default, Aspose.Words looks for fonts installed to the system.
Setting this property resets the cache of all previously loaded fonts.
fontsFolders
- An array of folders that contain TrueType fonts.recursive
- True to scan the specified folders for fonts recursively.setFontSubstitutes | |
public void setFontSubstitutes(java.lang.String originalFontName, java.lang.String[] substituteFontNames) |
originalFontName
- Original font name.substituteFontNames
- List of alternative font names to be used if original font is not presented in system.