Skip to content

Commit

Permalink
Added missed ability to set Typeface font
Browse files Browse the repository at this point in the history
  • Loading branch information
kbiakov committed Sep 2, 2017
1 parent 60bfb03 commit dd718d1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -366,13 366,19 @@ data class Options(
withTheme(theme)
}

fun withFont(fontPath: String): Options {
this.font = FontCache.get(context).getTypeface(context, fontPath)
fun withFont(font: Font): Options {
this.font = FontCache.get(context).getTypeface(context, font)
return this
}

fun withFont(font: Font): Options {
this.font = FontCache.get(context).getTypeface(context, font)
fun withFont(font: Typeface): Options {
FontCache.get(context).saveTypeface(font)
this.font = font
return this
}

fun withFont(fontPath: String): Options {
this.font = FontCache.get(context).getTypeface(context, fontPath)
return this
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,4 77,8 @@ public Typeface getTypeface(Context context, String fontPath) {
return font;
}
}

public void saveTypeface(Typeface fontTypeface) {
fonts.put(fontTypeface.toString(), fontTypeface);
}
}

0 comments on commit dd718d1

Please sign in to comment.