Interface FontManager

  • All Implemented Interfaces:

    
    public interface FontManager
    
                        

    Gives you access to all the fonts available on the system.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Constructor Summary

      Constructors 
      Constructor Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      abstract List<Font> getAvailableFonts() This lists all the fonts available to use with PSPDFKit.
      abstract Font getFontByName(@Nullable() String name) Gets the font specified by the given name or null.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

    • Method Detail

      • getAvailableFonts

        @NonNull() abstract List<Font> getAvailableFonts()

        This lists all the fonts available to use with PSPDFKit.

        Returns:

        All available fonts or an empty list if the user hasn't granted us storage access permission.

      • getFontByName

        @Nullable() abstract Font getFontByName(@Nullable() String name)

        Gets the font specified by the given name or null. This function returns fonts for which getName matches (i.e. where the font family name matches) and also fonts where any of the actual font files (including the font style suffix) matches the given font name.

        
        final Font font1 = fontManager.getFontByName("Roboto");
        final Font font2 = fontManager.getFontByName("Roboto-Bold");
        
        // This method returns the same font object for both inputs.
        assert font1 == font2;
        
        Parameters:
        name - The name of the font to get.
        Returns:

        The font of the given name or null if no font for the name exists.