Package com.mta.tehreer.font
Class FontFile
java.lang.Object
com.mta.tehreer.font.FontFile
A
FontFile
object represents the file of a specific font format.-
Constructor Summary
ConstructorDescriptionFontFile
(AssetManager assetManager, String filePath) Constructs a font file instance representing the specified asset.Constructs a font file instance representing the specified file path.FontFile
(InputStream stream) Constructs a font file instance from the specified input stream by copying its data into a native memory buffer. -
Method Summary
Modifier and TypeMethodDescriptionReturns named typefaces of this font file.
-
Constructor Details
-
FontFile
Constructs a font file instance representing the specified asset. The data of the asset is not copied to an in-memory buffer. Rather, it is directly read from a stream of the asset when needed. So the typefaces obtained from resulting font file might be slower and should be used with caution.- Parameters:
assetManager
- The application's asset manager.filePath
- The path of the font in the assets directory.- Throws:
NullPointerException
- ifassetManager
orfilePath
is null.RuntimeException
- if an error occurred while initialization.
-
FontFile
Constructs a font file instance representing the specified file path. The data of the font is directly read from a stream of the file when needed.- Parameters:
file
- The file describing the path of the font.- Throws:
NullPointerException
- iffile
is null.RuntimeException
- if an error occurred while initialization.
-
FontFile
Constructs a font file instance from the specified input stream by copying its data into a native memory buffer. It may take time to create the instance if the stream holds larger data.- Parameters:
stream
- The input stream that contains the data of the font.- Throws:
NullPointerException
- ifstream
is null.RuntimeException
- if an error occurred while initialization.
-
-
Method Details
-
getTypefaces
Returns named typefaces of this font file.- Returns:
- Named typefaces of this font file.
-