Skip to content

Most visited

Recently visited

navigation

FontVariationAxis

public final class FontVariationAxis
extends Object

java.lang.Object
   ↳ android.graphics.fonts.FontVariationAxis


Class that holds information about single font variation axis.

Summary

Public constructors

FontVariationAxis(String tagString, float styleValue)

Construct FontVariationAxis.

Public methods

static FontVariationAxis[] fromFontVariationSettings(String settings)

Construct FontVariationAxis array from font variation settings.

float getStyleValue()

Returns the style value associated to the given axis for this font.

String getTag()

Returns the variable font axis tag associated to this axis.

static String toFontVariationSettings(FontVariationAxis[] axes)

Stringify the array of FontVariationAxis.

String toString()

Returns a valid font variation setting string for this object.

Inherited methods

From class java.lang.Object

Public constructors

FontVariationAxis

FontVariationAxis (String tagString, 
                float styleValue)

Construct FontVariationAxis. The axis tag must contain four ASCII characters. Tag string that are longer or shorter than four characters, or contains characters outside of U+0020..U+007E are invalid.

Parameters
tagString String

This value must never be null.

styleValue float

Throws
IllegalArgumentException If given tag string is invalid.

Public methods

fromFontVariationSettings

FontVariationAxis[] fromFontVariationSettings (String settings)

Construct FontVariationAxis array from font variation settings. The settings string is constructed from multiple pairs of axis tag and style values. The axis tag must contain four ASCII characters and must be wrapped with single quotes (U+0027) or double quotes (U+0022). Axis strings that are longer or shorter than four characters, or contain characters outside of U+0020..U+007E are invalid. If a specified axis name is not defined in the font, the settings will be ignored.

   FontVariationAxis.fromFontVariationSettings("'wdth' 1.0");
   FontVariationAxis.fromFontVariationSettings("'AX  ' 1.0, 'FB  ' 2.0");
 

Parameters
settings String: font variation settings.

This value may be null.

Returns
FontVariationAxis[] FontVariationAxis[] the array of parsed font variation axis. null if settings has no font variation settings.

This value may be null.

Throws
IllegalArgumentException If given string is not a valid font variation settings format.

getStyleValue

float getStyleValue ()

Returns the style value associated to the given axis for this font.

Returns
float

getTag

String getTag ()

Returns the variable font axis tag associated to this axis.

Returns
String

toFontVariationSettings

String toFontVariationSettings (FontVariationAxis[] axes)

Stringify the array of FontVariationAxis.

Parameters
axes FontVariationAxis: an array of FontVariationAxis.

This value may be null.

Returns
String String a valid font variation settings string.

This value will never be null.

toString

String toString ()

Returns a valid font variation setting string for this object.

Returns
String a string representation of the object.

This value will never be null.

This site uses cookies to store your preferences for site-specific language and display options.

Get the latest Android developer news and tips that will help you find success on Google Play.

* Required Fields

Hooray!

Browse this site in ?

You requested a page in , but your language preference for this site is .

Would you like to change your language preference and browse this site in ? If you want to change your language preference later, use the language menu at the bottom of each page.

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.

Take a one-minute survey?
Help us improve Android tools and documentation.