Package com.mta.tehreer.graphics
Class TypefaceManager
java.lang.Object
com.mta.tehreer.graphics.TypefaceManager
The
TypefaceManager
class provides management activities related to typefaces.-
Method Summary
Modifier and TypeMethodDescriptionstatic List<TypeFamily>
Returns a list of available type families sorted by their names in ascending order.Returns a list of available typefaces sorted by their family and style names in ascending order.static Typeface
getTypeface
(Object tag) Returns the typeface registered against the specified tag.static Typeface
getTypefaceByName
(String fullName) Looks for a registered typeface having specified full name.static Object
getTypefaceTag
(Typeface typeface) Returns the tag of a registered typeface.static TypeFamily
getTypeFamily
(String familyName) Looks for a type family having specified family name.static void
registerTypeface
(Typeface typeface, Object tag) Registers a typeface inTypefaceManager
.static void
unregisterTypeface
(Typeface typeface) Unregisters a typeface inTypefaceManager
.
-
Method Details
-
registerTypeface
Registers a typeface inTypefaceManager
.- Parameters:
typeface
- The typeface that will be registered.tag
- An optional tag to identify the typeface.- Throws:
IllegalArgumentException
- iftypeface
is already registered, ortag
is already taken.
-
unregisterTypeface
Unregisters a typeface inTypefaceManager
.- Parameters:
typeface
- The typeface to unregister.- Throws:
IllegalArgumentException
- iftypeface
is not registered.
-
getTypeface
Returns the typeface registered against the specified tag.- Parameters:
tag
- The tag object that identifies the typeface.- Returns:
- The registered typeface, or
null
if no typeface is registered against the specified tag.
-
getTypefaceTag
Returns the tag of a registered typeface.- Parameters:
typeface
- The typeface whose tag is returned.- Returns:
- The tag of the typeface, or
null
if no tag was specified while registration. - Throws:
IllegalArgumentException
- iftypeface
is not registered.
-
getTypeFamily
Looks for a type family having specified family name.- Parameters:
familyName
- The name of the family.- Returns:
- A type family having specified family name.
-
getTypefaceByName
Looks for a registered typeface having specified full name.- Parameters:
fullName
- The full name of the typeface.- Returns:
- The typeface having specified full name, or
null
if no such typeface is registered.
-
getAvailableFamilies
Returns a list of available type families sorted by their names in ascending order.- Returns:
- A list of available type families.
-
getAvailableTypefaces
Returns a list of available typefaces sorted by their family and style names in ascending order.- Returns:
- A list of available typefaces.
-