Class TypefaceManager

java.lang.Object
com.mta.tehreer.graphics.TypefaceManager

public class TypefaceManager extends Object
The TypefaceManager class provides management activities related to typefaces.
  • Method Details

    • registerTypeface

      public static void registerTypeface(@NonNull Typeface typeface, @Nullable Object tag)
      Registers a typeface in TypefaceManager.
      Parameters:
      typeface - The typeface that will be registered.
      tag - An optional tag to identify the typeface.
      Throws:
      IllegalArgumentException - if typeface is already registered, or tag is already taken.
    • unregisterTypeface

      public static void unregisterTypeface(@NonNull Typeface typeface)
      Unregisters a typeface in TypefaceManager.
      Parameters:
      typeface - The typeface to unregister.
      Throws:
      IllegalArgumentException - if typeface is not registered.
    • getTypeface

      @Nullable public static Typeface getTypeface(@NonNull Object tag)
      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

      @Nullable public static Object getTypefaceTag(@NonNull Typeface typeface)
      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 - if typeface is not registered.
    • getTypeFamily

      @Nullable public static TypeFamily getTypeFamily(@NonNull String familyName)
      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

      @Nullable public static Typeface getTypefaceByName(@NonNull String fullName)
      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

      @NonNull public static List<TypeFamily> getAvailableFamilies()
      Returns a list of available type families sorted by their names in ascending order.
      Returns:
      A list of available type families.
    • getAvailableTypefaces

      @NonNull public static List<Typeface> getAvailableTypefaces()
      Returns a list of available typefaces sorted by their family and style names in ascending order.
      Returns:
      A list of available typefaces.