public interface FontWidget
Font that may be specified via
setFont(Font).| Modifier and Type | Interface and Description |
|---|---|
static interface |
FontWidget.TypefaceStyle
Defines an annotation for determining available typeface styles that may be passed to
setTypeface(Typeface, int) method. |
| Modifier and Type | Method and Description |
|---|---|
Context |
getContext()
Returns the context in which is this font widget created.
|
void |
setFont(Font font)
Sets a font to be applied to this font widget.
|
void |
setFont(String fontPath)
Sets a path to the font file of which font should be applied to this font widget.
|
void |
setTypeface(Typeface typeface)
Sets a typeface in which the text of this font widget should be displayed.
|
void |
setTypeface(Typeface typeface,
int style)
Sets a typeface and style in which the text of this font widget should be displayed and turns
on the fake bold and italic bits in the Paint if the Typeface that you provided does not have
all the bits in the style that you specified.
|
@NonNull Context getContext()
void setFont(@NonNull String fontPath)
fontPath - Path to the font file from which to create the desired font and apply it to
this font widget.ui:uiFont,
Font.create(String)void setFont(@NonNull Font font)
font - The desired font to be applied to this font widget.setFont(String),
Font.getTypeface(Context)void setTypeface(@Nullable Typeface typeface)
Note, that not all Typeface families actually have bold and italic variants, so you may
need to use setTypeface(Typeface, int) to get the appearance that you actually want.
typeface - The desired typeface. May be null to use a default one.void setTypeface(@Nullable Typeface typeface, int style)
typeface - The desired typeface. May be null to create default one according to
the specified style.style - One of styles defined by @TypefaceStyle annotation.setTypeface(Typeface)