Typeface.Create Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
Create(Typeface, TypefaceStyle) |
Create a typeface object that best matches the specified existing typeface and the specified Style. |
Create(String, TypefaceStyle) |
Create a typeface object given a family name, and option style information. |
Create(Typeface, Int32, Boolean) |
Creates a typeface object that best matches the specified existing typeface and the specified weight and italic style |
Create(Typeface, TypefaceStyle)
Create a typeface object that best matches the specified existing typeface and the specified Style.
[Android.Runtime.Register("create", "(Landroid/graphics/Typeface;I)Landroid/graphics/Typeface;", "")]
public static Android.Graphics.Typeface? Create (Android.Graphics.Typeface? family, Android.Graphics.TypefaceStyle style);
[<Android.Runtime.Register("create", "(Landroid/graphics/Typeface;I)Landroid/graphics/Typeface;", "")>]
static member Create : Android.Graphics.Typeface * Android.Graphics.TypefaceStyle -> Android.Graphics.Typeface
Parameters
- family
- Typeface
An existing Typeface
object. In case of null
, the default
typeface is used instead.
- style
- TypefaceStyle
The style (normal, bold, italic) of the typeface. e.g. NORMAL, BOLD, ITALIC, BOLD_ITALIC
Returns
The best matching typeface.
- Attributes
Remarks
Create a typeface object that best matches the specified existing typeface and the specified Style. Use this call if you want to pick a new style from the same family of an existing typeface object. If family is null, this selects from the default font's family.
This method is not thread safe on API 27 or before. This method is thread safe on API 28 or after.
Java documentation for android.graphics.Typeface.create(android.graphics.Typeface, int)
.
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
Create(String, TypefaceStyle)
Create a typeface object given a family name, and option style information.
[Android.Runtime.Register("create", "(Ljava/lang/String;I)Landroid/graphics/Typeface;", "")]
public static Android.Graphics.Typeface? Create (string? familyName, Android.Graphics.TypefaceStyle style);
[<Android.Runtime.Register("create", "(Ljava/lang/String;I)Landroid/graphics/Typeface;", "")>]
static member Create : string * Android.Graphics.TypefaceStyle -> Android.Graphics.Typeface
Parameters
- familyName
- String
May be null. The name of the font family.
- style
- TypefaceStyle
The style (normal, bold, italic) of the typeface. e.g. NORMAL, BOLD, ITALIC, BOLD_ITALIC
Returns
The best matching typeface.
- Attributes
Remarks
Create a typeface object given a family name, and option style information. If null is passed for the name, then the "default" font will be chosen. The resulting typeface object can be queried (getStyle()) to discover what its "real" style characteristics are.
Java documentation for android.graphics.Typeface.create(java.lang.String, int)
.
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
Create(Typeface, Int32, Boolean)
Creates a typeface object that best matches the specified existing typeface and the specified weight and italic style
[Android.Runtime.Register("create", "(Landroid/graphics/Typeface;IZ)Landroid/graphics/Typeface;", "", ApiSince=28)]
public static Android.Graphics.Typeface Create (Android.Graphics.Typeface? family, int weight, bool italic);
[<Android.Runtime.Register("create", "(Landroid/graphics/Typeface;IZ)Landroid/graphics/Typeface;", "", ApiSince=28)>]
static member Create : Android.Graphics.Typeface * int * bool -> Android.Graphics.Typeface
Parameters
- family
- Typeface
An existing Typeface
object. In case of null
, the default
typeface is used instead.
- weight
- Int32
The desired weight to be drawn.
- italic
- Boolean
true
if italic style is desired to be drawn. Otherwise, false
Returns
A Typeface
object for drawing specified weight and italic style. Never
returns null
- Attributes
Remarks
Creates a typeface object that best matches the specified existing typeface and the specified weight and italic style
Below are numerical values and corresponding common weight names.
<table> <thead> <tr><th>Value</th><th>Common weight name</th></tr> </thead> <tbody> <tr><td>100</td><td>Thin</td></tr> <tr><td>200</td><td>Extra Light</td></tr> <tr><td>300</td><td>Light</td></tr> <tr><td>400</td><td>Normal</td></tr> <tr><td>500</td><td>Medium</td></tr> <tr><td>600</td><td>Semi Bold</td></tr> <tr><td>700</td><td>Bold</td></tr> <tr><td>800</td><td>Extra Bold</td></tr> <tr><td>900</td><td>Black</td></tr> </tbody> </table>
This method is thread safe.
Java documentation for android.graphics.Typeface.create(android.graphics.Typeface, int, boolean)
.
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.