Language

Typeface.Builder.SetFallback(String) Method

Definition

Sets a fallback family name.

[Android.Runtime.Register("setFallback", "(Ljava/lang/String;)Landroid/graphics/Typeface$Builder;", "", ApiSince=26)]
public Android.Graphics.Typeface.Builder? SetFallback(string? familyName);
[<Android.Runtime.Register("setFallback", "(Ljava/lang/String;)Landroid/graphics/Typeface$Builder;", "", ApiSince=26)>]
member this.SetFallback : string -> Android.Graphics.Typeface.Builder

Parameters

familyName
String

The fallback family name to use if the provided font cannot be used. If the font cannot be used and the fallback family name is null, Build() returns null. The fallback family name is null by default.

Returns

The builder after setting the fallback family.

Attributes

Remarks

Sets a fallback family name. By specifying a fallback family name, a fallback Typeface will be returned if the build() method fails to create a Typeface from the provided font. The fallback family will be resolved with the provided weight and italic information specified by setWeight(int) and setItalic(boolean). If setWeight(int) is not called, the fallback family keeps the default weight. Similarly, if setItalic(boolean) is not called, the fallback family keeps the default italic information. For example, calling builder.setFallback("sans-serif-light") is equivalent to calling builder.setFallback("sans-serif").setWeight(300) in terms of fallback. The default weight and italic information are overridden by calling setWeight(int) and setItalic(boolean). For example, if a Typeface is constructed using builder.setFallback("sans-serif-light").setWeight(700), the fallback text will render as sans serif bold.

Android reference for android.graphics.Typeface.Builder.setFallback.

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to