public class FolderFontSource extends FontSourceBase
To learn more, visit the Working with Fonts documentation article.
Examples:
Shows how to use a local system folder which contains fonts as a font source.
// Create a font source from a folder that contains font files.
FolderFontSource folderFontSource = new FolderFontSource(getFontsDir(), false, 1);
Document doc = new Document();
doc.setFontSettings(new FontSettings());
doc.getFontSettings().setFontsSources(new FontSourceBase[]{folderFontSource});
Assert.assertEquals(getFontsDir(), folderFontSource.getFolderPath());
Assert.assertEquals(false, folderFontSource.getScanSubfolders());
Assert.assertEquals(FontSourceType.FONTS_FOLDER, folderFontSource.getType());
Assert.assertEquals(1, folderFontSource.getPriority());
| Constructor and Description |
|---|
FolderFontSource(java.lang.String folderPath,
boolean scanSubfolders)
Ctor.
|
FolderFontSource(java.lang.String folderPath,
boolean scanSubfolders,
int priority)
Ctor.
|
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
getFolderPath()
Path to the folder.
|
java.lang.Iterable |
getFontDataInternal() |
boolean |
getScanSubfolders()
Determines whether or not to scan the subfolders.
|
int |
getType()
Returns the type of the font source.
|
getAvailableFonts, getPriority, getPriorityInternal, getWarningCallback, setWarningCallbackpublic FolderFontSource(java.lang.String folderPath,
boolean scanSubfolders)
Examples:
Shows how to use a local system folder which contains fonts as a font source.
// Create a font source from a folder that contains font files.
FolderFontSource folderFontSource = new FolderFontSource(getFontsDir(), false, 1);
Document doc = new Document();
doc.setFontSettings(new FontSettings());
doc.getFontSettings().setFontsSources(new FontSourceBase[]{folderFontSource});
Assert.assertEquals(getFontsDir(), folderFontSource.getFolderPath());
Assert.assertEquals(false, folderFontSource.getScanSubfolders());
Assert.assertEquals(FontSourceType.FONTS_FOLDER, folderFontSource.getType());
Assert.assertEquals(1, folderFontSource.getPriority());
folderPath - Path to folder.scanSubfolders - Determines whether or not to scan subfolders.public FolderFontSource(java.lang.String folderPath,
boolean scanSubfolders,
int priority)
Examples:
Shows how to use a local system folder which contains fonts as a font source.
// Create a font source from a folder that contains font files.
FolderFontSource folderFontSource = new FolderFontSource(getFontsDir(), false, 1);
Document doc = new Document();
doc.setFontSettings(new FontSettings());
doc.getFontSettings().setFontsSources(new FontSourceBase[]{folderFontSource});
Assert.assertEquals(getFontsDir(), folderFontSource.getFolderPath());
Assert.assertEquals(false, folderFontSource.getScanSubfolders());
Assert.assertEquals(FontSourceType.FONTS_FOLDER, folderFontSource.getType());
Assert.assertEquals(1, folderFontSource.getPriority());
folderPath - Path to folder.scanSubfolders - Determines whether or not to scan subfolders.priority - Font source priority. See the FontSourceBase.getPriority() property description for more information.public java.lang.String getFolderPath()
Examples:
Shows how to use a local system folder which contains fonts as a font source.
// Create a font source from a folder that contains font files.
FolderFontSource folderFontSource = new FolderFontSource(getFontsDir(), false, 1);
Document doc = new Document();
doc.setFontSettings(new FontSettings());
doc.getFontSettings().setFontsSources(new FontSourceBase[]{folderFontSource});
Assert.assertEquals(getFontsDir(), folderFontSource.getFolderPath());
Assert.assertEquals(false, folderFontSource.getScanSubfolders());
Assert.assertEquals(FontSourceType.FONTS_FOLDER, folderFontSource.getType());
Assert.assertEquals(1, folderFontSource.getPriority());
String value.public boolean getScanSubfolders()
Examples:
Shows how to use a local system folder which contains fonts as a font source.
// Create a font source from a folder that contains font files.
FolderFontSource folderFontSource = new FolderFontSource(getFontsDir(), false, 1);
Document doc = new Document();
doc.setFontSettings(new FontSettings());
doc.getFontSettings().setFontsSources(new FontSourceBase[]{folderFontSource});
Assert.assertEquals(getFontsDir(), folderFontSource.getFolderPath());
Assert.assertEquals(false, folderFontSource.getScanSubfolders());
Assert.assertEquals(FontSourceType.FONTS_FOLDER, folderFontSource.getType());
Assert.assertEquals(1, folderFontSource.getPriority());
boolean value.public int getType()
Examples:
Shows how to use a local system folder which contains fonts as a font source.
// Create a font source from a folder that contains font files.
FolderFontSource folderFontSource = new FolderFontSource(getFontsDir(), false, 1);
Document doc = new Document();
doc.setFontSettings(new FontSettings());
doc.getFontSettings().setFontsSources(new FontSourceBase[]{folderFontSource});
Assert.assertEquals(getFontsDir(), folderFontSource.getFolderPath());
Assert.assertEquals(false, folderFontSource.getScanSubfolders());
Assert.assertEquals(FontSourceType.FONTS_FOLDER, folderFontSource.getType());
Assert.assertEquals(1, folderFontSource.getPriority());
getType in class FontSourceBaseFontSourceType constants.public java.lang.Iterable getFontDataInternal()
getFontDataInternal in class FontSourceBase