# Print output for @column tags ?>
Developers

- Design
- Develop
- Distribute

Developer Console

## Most visited

## Recently visited

## Results for

Summary: Nested Classes | Constants | Fields | Methods | Inherited Methods

# Typeface

`public class Typeface`
`extends Object` ``

java.lang.Object
↳ | android.graphics.Typeface

The Typeface class specifies the typeface and intrinsic style of a font. This is used in the paint, along with optionally Paint settings like textSize, textSkewX, textScaleX to specify how text appears when drawn (and measured).

## Summary

### Nested classes
`class` | `Typeface.Builder` A builder class for creating new Typeface instance.
`class` | `Typeface.CustomFallbackBuilder` A builder class for creating new Typeface instance.

### Constants
`int` | `BOLD`
`int` | `BOLD_ITALIC`
`int` | `ITALIC`
`int` | `NORMAL`

### Fields
`public static final Typeface` | `DEFAULT` The default NORMAL typeface object
`public static final Typeface` | `DEFAULT_BOLD` The default BOLD typeface object.
`public static final Typeface` | `MONOSPACE` The NORMAL style of the default monospace typeface.
`public static final Typeface` | `SANS_SERIF` The NORMAL style of the default sans serif typeface.
`public static final Typeface` | `SERIF` The NORMAL style of the default serif typeface.

### Public methods
`static Typeface` | `create(Typeface family, int weight, boolean italic)` 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.
`static Typeface` | `create(Typeface family, int style)` Create a typeface object that best matches the specified existing typeface and the specified Style.
`static Typeface` | `create(String familyName, int style)` Create a typeface object given a family name, and option style information.
`static Typeface` | `createFromAsset(AssetManager mgr, String path)` Create a new typeface from the specified font data.
`static Typeface` | `createFromFile(File file)` Create a new typeface from the specified font file.
`static Typeface` | `createFromFile(String path)` Create a new typeface from the specified font file.
`static Typeface` | `defaultFromStyle(int style)` Returns one of the default typeface objects, based on the specified style
`boolean` | `equals(Object o)` Indicates whether some other object is "equal to" this one.
`int` | `getStyle()` Returns the typeface's intrinsic style attributes
`int` | `getWeight()` Returns the typeface's weight value
`int` | `hashCode()` Returns a hash code value for the object.
`final boolean` | `isBold()` Returns true if getStyle() has the BOLD bit set.
`final boolean` | `isItalic()` Returns true if getStyle() has the ITALIC bit set.

### Inherited methods
From class `java.lang.Object`
`Object` | `clone()` Creates and returns a copy of this object.
`boolean` | `equals(Object obj)` Indicates whether some other object is "equal to" this one.
`void` | `finalize()` Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.
`final Class<?>` | `getClass()` Returns the runtime class of this `Object`.
`int` | `hashCode()` Returns a hash code value for the object.
`final void` | `notify()` Wakes up a single thread that is waiting on this object's monitor.
`final void` | `notifyAll()` Wakes up all threads that are waiting on this object's monitor.
`String` | `toString()` Returns a string representation of the object.
`final void` | `wait(long timeout, int nanos)` Causes the current thread to wait until another thread invokes the `notify()` method or the `notifyAll()` method for this object, or some other thread interrupts the current thread, or a certain amount of real time has elapsed.
`final void` | `wait(long timeout)` Causes the current thread to wait until either another thread invokes the `notify()` method or the `notifyAll()` method for this object, or a specified amount of time has elapsed.
`final void` | `wait()` Causes the current thread to wait until another thread invokes the `notify()` method or the `notifyAll()` method for this object.

## Constants

### BOLD

    public static final int BOLD

Constant Value: 1 (0x00000001)

### BOLD_ITALIC

    public static final int BOLD_ITALIC

Constant Value: 3 (0x00000003)

### ITALIC

    public static final int ITALIC

Constant Value: 2 (0x00000002)

### NORMAL

    public static final int NORMAL

Constant Value: 0 (0x00000000)

## Fields

### DEFAULT

    public static final Typeface DEFAULT

The default NORMAL typeface object

### DEFAULT_BOLD

    public static final Typeface DEFAULT_BOLD

The default BOLD typeface object. Note: this may be not actually be bold, depending on what fonts are installed. Call getStyle() to know for sure.

### MONOSPACE

    public static final Typeface MONOSPACE

The NORMAL style of the default monospace typeface.

### SANS_SERIF

    public static final Typeface SANS_SERIF

The NORMAL style of the default sans serif typeface.

### SERIF

    public static final Typeface SERIF

The NORMAL style of the default serif typeface.

## Public methods

### create

    public static Typeface create (Typeface family,
                    int weight,
                    boolean italic)

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.

Value | Common weight name
--- | ---
100 | Thin
200 | Extra Light
300 | Light
400 | Normal
500 | Medium
600 | Semi Bold
700 | Bold
800 | Extra Bold
900 | Black

This method is thread safe.

Parameters
`family` | `Typeface`: An existing `Typeface` object. In case of `null`, the default typeface is used instead. This value may be `null`.
`weight` | `int`: The desired weight to be drawn. Value is between 1 and 1000 inclusive
`italic` | `boolean`: `true` if italic style is desired to be drawn. Otherwise, `false`

Returns
`Typeface` | A `Typeface` object for drawing specified weight and italic style. Never returns `null`

See also:

- `getWeight()`
- `isItalic()`

### create

    public static Typeface create (Typeface family,
                    int style)

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.

Parameters
`family` | `Typeface`: An existing `Typeface` object. In case of `null`, the default typeface is used instead.
`style` | `int`: The style (normal, bold, italic) of the typeface. e.g. NORMAL, BOLD, ITALIC, BOLD_ITALIC Value is `NORMAL`, `BOLD`, `ITALIC`, or `BOLD_ITALIC`

Returns
`Typeface` | The best matching typeface.

### create

    public static Typeface create (String familyName,
                    int style)

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.

Parameters
`familyName` | `String`: May be null. The name of the font family.
`style` | `int`: The style (normal, bold, italic) of the typeface. e.g. NORMAL, BOLD, ITALIC, BOLD_ITALIC Value is `NORMAL`, `BOLD`, `ITALIC`, or `BOLD_ITALIC`

Returns
`Typeface` | The best matching typeface.

### createFromAsset

    public static Typeface createFromAsset (AssetManager mgr,
                    String path)

Create a new typeface from the specified font data.

Parameters
`mgr` | `AssetManager`: The application's asset manager
`path` | `String`: The file name of the font data in the assets directory

Returns
`Typeface` | The new typeface.

### createFromFile

    public static Typeface createFromFile (File file)

Create a new typeface from the specified font file.

Parameters
`file` | `File`: The path to the font data. This value may be `null`.

Returns
`Typeface` | The new typeface.

### createFromFile

    public static Typeface createFromFile (String path)

Create a new typeface from the specified font file.

Parameters
`path` | `String`: The full path to the font data. This value may be `null`.

Returns
`Typeface` | The new typeface.

### defaultFromStyle

    public static Typeface defaultFromStyle (int style)

Returns one of the default typeface objects, based on the specified style

Parameters
`style` | `int`: Value is `NORMAL`, `BOLD`, `ITALIC`, or `BOLD_ITALIC`

Returns
`Typeface` | the default typeface that corresponds to the style

### equals

    public boolean equals (Object o)

Indicates whether some other object is "equal to" this one.

The `equals` method implements an equivalence relation on non-null object references:

- It is reflexive: for any non-null reference value `x`, `x.equals(x)` should return `true`.
- It is symmetric: for any non-null reference values `x` and `y`, `x.equals(y)` should return `true` if and only if `y.equals(x)` returns `true`.
- It is transitive: for any non-null reference values `x`, `y`, and `z`, if `x.equals(y)` returns `true` and `y.equals(z)` returns `true`, then `x.equals(z)` should return `true`.
- It is consistent: for any non-null reference values `x` and `y`, multiple invocations of `x.equals(y)` consistently return `true` or consistently return `false`, provided no information used in `equals` comparisons on the objects is modified.
- For any non-null reference value `x`, `x.equals(null)` should return `false`.

The `equals` method for class `Object` implements the most discriminating possible equivalence relation on objects; that is, for any non-null reference values `x` and `y`, this method returns `true` if and only if `x` and `y` refer to the same object (`x == y` has the value `true`).

Note that it is generally necessary to override the `hashCode` method whenever this method is overridden, so as to maintain the general contract for the `hashCode` method, which states that equal objects must have equal hash codes.

Parameters
`o` | `Object`: the reference object with which to compare.

Returns
`boolean` | `true` if this object is the same as the obj argument; `false` otherwise.

### getStyle

    public int getStyle ()

Returns the typeface's intrinsic style attributes

Returns
`int` | Value is `NORMAL`, `BOLD`, `ITALIC`, or `BOLD_ITALIC`

### getWeight

    public int getWeight ()

Returns the typeface's weight value

Returns
`int` | Value is between 0 and 1000 inclusive

### hashCode

    public int hashCode ()

Returns a hash code value for the object. This method is supported for the benefit of hash tables such as those provided by `HashMap`.

The general contract of `hashCode` is:

- Whenever it is invoked on the same object more than once during an execution of a Java application, the `hashCode` method must consistently return the same integer, provided no information used in `equals` comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
- If two objects are equal according to the `equals(Object)` method, then calling the `hashCode` method on each of the two objects must produce the same integer result.
- It is not required that if two objects are unequal according to the `equals(java.lang.Object)` method, then calling the `hashCode` method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.

As much as is reasonably practical, the hashCode method defined by class `Object` does return distinct integers for distinct objects. (This is typically implemented by converting the internal address of the object into an integer, but this implementation technique is not required by the Java™ programming language.)

Returns
`int` | a hash code value for this object.

### isBold

    public final boolean isBold ()

Returns true if getStyle() has the BOLD bit set.

Returns
`boolean` |

### isItalic

    public final boolean isItalic ()

Returns true if getStyle() has the ITALIC bit set.

Returns
`boolean` |

Full name *
Email address *
Company / developer name
One of your Play Store app URLs *
Which best describes your business:*
Apps
Games
Apps & Games
*
*