Class FontMgr

  • All Implemented Interfaces:
    java.lang.AutoCloseable
    Direct Known Subclasses:
    TypefaceFontProvider

    public class FontMgr
    extends RefCnt
    • Constructor Detail

      • FontMgr

        @Internal
        public FontMgr​(long ptr)
      • FontMgr

        @Internal
        public FontMgr​(long ptr,
                       boolean allowClose)
    • Method Detail

      • getFamiliesCount

        public int getFamiliesCount()
      • getFamilyName

        public java.lang.String getFamilyName​(int index)
      • makeStyleSet

        public FontStyleSet makeStyleSet​(int index)
      • matchFamily

        public FontStyleSet matchFamily​(java.lang.String familyName)
        The caller must call Managed.close() on the returned object. Never returns null; will return an empty set if the name is not found. Passing null as the parameter will return the default system family. Note that most systems don't have a default system family, so passing null will often result in the empty set. It is possible that this will return a style set not accessible from makeStyleSet(int) due to hidden or auto-activated fonts.
      • matchFamilyStyle

        @Nullable
        public @Nullable Typeface matchFamilyStyle​(java.lang.String familyName,
                                                   FontStyle style)
        Find the closest matching typeface to the specified familyName and style and return a ref to it. The caller must call Managed.close() on the returned object. Will return null if no 'good' match is found. Passing null as the parameter for `familyName` will return the default system font. It is possible that this will return a style set not accessible from makeStyleSet(int) or matchFamily(String) due to hidden or auto-activated fonts.
      • matchFamiliesStyle

        @Nullable
        public @Nullable Typeface matchFamiliesStyle​(java.lang.String[] families,
                                                     FontStyle style)
      • matchFamilyStyleCharacter

        public Typeface matchFamilyStyleCharacter​(@Nullable
                                                  @Nullable java.lang.String familyName,
                                                  FontStyle style,
                                                  @Nullable
                                                  @Nullable java.lang.String[] bcp47,
                                                  int character)
        Use the system fallback to find a typeface for the given character. Note that bcp47 is a combination of ISO 639, 15924, and 3166-1 codes, so it is fine to just pass a ISO 639 here. Will return null if no family can be found for the character in the system fallback. Passing `null` as the parameter for `familyName` will return the default system font. bcp47[0] is the least significant fallback, bcp47[bcp47.length-1] is the most significant. If no specified bcp47 codes match, any font with the requested character will be matched.
      • matchFamiliesStyleCharacter

        @Nullable
        public @Nullable Typeface matchFamiliesStyleCharacter​(java.lang.String[] families,
                                                              FontStyle style,
                                                              @Nullable
                                                              @Nullable java.lang.String[] bcp47,
                                                              int character)
      • makeFromData

        public Typeface makeFromData​(Data data)
        Create a typeface for the specified data and TTC index (pass 0 for none) or null if the data is not recognized. The caller must call Managed.close() on the returned object if it is not null.
      • makeFromData

        public Typeface makeFromData​(Data data,
                                     int ttcIndex)
      • getDefault

        public static FontMgr getDefault()
        Return the default fontmgr.
      • _nGetFamiliesCount

        public static int _nGetFamiliesCount​(long ptr)
      • _nGetFamilyName

        public static java.lang.String _nGetFamilyName​(long ptr,
                                                       int index)
      • _nMakeStyleSet

        public static long _nMakeStyleSet​(long ptr,
                                          int index)
      • _nMatchFamily

        public static long _nMatchFamily​(long ptr,
                                         java.lang.String familyName)
      • _nMatchFamilyStyle

        public static long _nMatchFamilyStyle​(long ptr,
                                              java.lang.String familyName,
                                              int fontStyle)
      • _nMatchFamilyStyleCharacter

        public static long _nMatchFamilyStyleCharacter​(long ptr,
                                                       java.lang.String familyName,
                                                       int fontStyle,
                                                       java.lang.String[] bcp47,
                                                       int character)
      • _nMakeFromData

        public static long _nMakeFromData​(long ptr,
                                          long dataPtr,
                                          int ttcIndex)
      • _nDefault

        public static long _nDefault()