@Test(expected = RuntimeException.class) public void testGetTypefaceForNotExistingPath() { final Font font = new Font("not_existing_font.ttf"); font.getTypeface(context); }
@NonNull public Typeface getTypeface(@NonNull final Context context) { if (typeFace == null) { try { this.typeFace = Typeface.createFromAsset(context.getAssets(), filePath); } catch (Exception e) { throw new IllegalArgumentException( "Cannot create Typeface for font at path(" + filePath + "). " + "Font file at the specified path does not exist or it is not a valid .ttf file.", e ); } } return typeFace; }
Font { @NonNull public Typeface getTypeface(@NonNull final Context context) { if (typeFace == null) { try { this.typeFace = Typeface.createFromAsset(context.getAssets(), filePath); } catch (Exception e) { throw new IllegalArgumentException( "Cannot create Typeface for font at path(" + filePath + "). " + "Font file at the specified path does not exist or it is not a valid .ttf file.", e ); } } return typeFace; } }
Font { @NonNull public Typeface getTypeface(@NonNull final Context context) { if (typeFace == null) { try { this.typeFace = Typeface.createFromAsset(context.getAssets(), filePath); } catch (Exception e) { throw new IllegalArgumentException( "Cannot create Typeface for font at path(" + filePath + "). " + "Font file at the specified path does not exist or it is not a valid .ttf file.", e ); } } return typeFace; } Font(@NonNull final String filePath); }
Font { @NonNull public Typeface getTypeface(@NonNull final Context context) { if (typeFace == null) { try { this.typeFace = Typeface.createFromAsset(context.getAssets(), filePath); } catch (Exception e) { throw new IllegalArgumentException( "Cannot create Typeface for font at path(" + filePath + "). " + "Font file at the specified path does not exist or it is not a valid .ttf file.", e ); } } return typeFace; } Font(@NonNull final String filePath); static void setLogLevel(final int level); static void setBasePath(@Nullable final String basePath); @Nullable static Font create(
			@NonNull final Context context,
			@Nullable final AttributeSet attrs,
			@AttrRes final int defStyleAttr,
			@StyleRes final int defStyleRes
	); @Nullable static Font create(@NonNull final Context context, @StyleRes final int style); @NonNull static Font create(@NonNull final String filePath); static void clearCache(); @NonNull String getFilePath(); @NonNull Typeface getTypeface(@NonNull final Context context); }
Font { @NonNull public Typeface getTypeface(@NonNull final Context context) { if (typeFace == null) { try { this.typeFace = Typeface.createFromAsset(context.getAssets(), filePath); } catch (Exception e) { throw new IllegalArgumentException( "Cannot create Typeface for font at path(" + filePath + "). " + "Font file at the specified path does not exist or it is not a valid .ttf file.", e ); } } return typeFace; } Font(@NonNull final String filePath); static void setLogLevel(final int level); static void setBasePath(@Nullable final String basePath); @Nullable static Font create(
			@NonNull final Context context,
			@Nullable final AttributeSet attrs,
			@AttrRes final int defStyleAttr,
			@StyleRes final int defStyleRes
	); @Nullable static Font create(@NonNull final Context context, @StyleRes final int style); @NonNull static Font create(@NonNull final String filePath); static void clearCache(); @NonNull String getFilePath(); @NonNull Typeface getTypeface(@NonNull final Context context); static final String TTF_SUFFIX; static final String FONT_DIR; }