Udostępnij za pośrednictwem


Paint.SetFontVariationSettings(String) Method

Definition

Sets TrueType or OpenType font variation settings.

[Android.Runtime.Register("setFontVariationSettings", "(Ljava/lang/String;)Z", "GetSetFontVariationSettings_Ljava_lang_String_Handler", ApiSince=26)]
public virtual bool SetFontVariationSettings (string? fontVariationSettings);
[<Android.Runtime.Register("setFontVariationSettings", "(Ljava/lang/String;)Z", "GetSetFontVariationSettings_Ljava_lang_String_Handler", ApiSince=26)>]
abstract member SetFontVariationSettings : string -> bool
override this.SetFontVariationSettings : string -> bool

Parameters

fontVariationSettings
String

font variation settings. You can pass null or empty string as no variation settings.

Returns

true if the given settings is effective to at least one font file underlying this typeface. This function also returns true for empty settings string. Otherwise returns false

Attributes

Remarks

Sets TrueType or OpenType 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.

Examples, <ul> <li>Set font width to 150.

<code>
              Paint paint = new Paint();
              paint.setFontVariationSettings("'wdth' 150");
</code>

</li>

<li>Set the font slant to 20 degrees and ask for italic style.

<code>
              Paint paint = new Paint();
              paint.setFontVariationSettings("'slnt' 20, 'ital' 1");
</code>

</li> </ul>

Java documentation for android.graphics.Paint.setFontVariationSettings(java.lang.String).

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