IT. Expert System.

Android Reference

Typeface


android.graphics

Class Typeface



  • public class Typeface
    extends Object
    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).
    • Method Summary

      Methods
      Modifier and Type Method and Description
      static Typeface create(String familyName, int style)
      Create a typeface object given a family name, and option style information.
      static Typeface create(Typeface family, int style)
      Create a typeface object that best matches the specified existing typeface and the specified Style.
      static Typeface createFromAsset(AssetManager mgr, String path)
      Create a new typeface from the specified font data.
      static Typeface createFromFile(File path)
      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)
      Compares this instance with the specified object and indicates if they are equal.
      protected void finalize()
      Invoked when the garbage collector has detected that this instance is no longer reachable.
      int getStyle()
      Returns the typeface's intrinsic style attributes
      int hashCode()
      Returns an integer hash code for this object.
      boolean isBold()
      Returns true if getStyle() has the BOLD bit set.
      boolean isItalic()
      Returns true if getStyle() has the ITALIC bit set.
      static void setGammaForText(float blackGamma, float whiteGamma)
      Set the global gamma coefficients for black and white text.
    • Field Detail

      • 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.
      • 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.
      • MONOSPACE

        public static final Typeface MONOSPACE
        The NORMAL style of the default monospace typeface.
    • Method Detail

      • getStyle

        public int getStyle()
        Returns the typeface's intrinsic style attributes
      • isBold

        public final boolean isBold()
        Returns true if getStyle() has the BOLD bit set.
      • isItalic

        public final boolean isItalic()
        Returns true if getStyle() has the ITALIC bit set.
      • 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 - May be null. The name of the font family.
        style - The style (normal, bold, italic) of the typeface. e.g. NORMAL, BOLD, ITALIC, BOLD_ITALIC
        Returns:
        The best matching typeface.
      • 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.
        Parameters:
        family - May be null. The name of the existing type face.
        style - The style (normal, bold, italic) of the typeface. e.g. NORMAL, BOLD, ITALIC, BOLD_ITALIC
        Returns:
        The best matching typeface.
      • defaultFromStyle

        public static Typeface defaultFromStyle(int style)
        Returns one of the default typeface objects, based on the specified style
        Returns:
        the default typeface that corresponds to the style
      • createFromAsset

        public static Typeface createFromAsset(AssetManager mgr,
                               String path)
        Create a new typeface from the specified font data.
        Parameters:
        mgr - The application's asset manager
        path - The file name of the font data in the assets directory
        Returns:
        The new typeface.
      • createFromFile

        public static Typeface createFromFile(File path)
        Create a new typeface from the specified font file.
        Parameters:
        path - The path to the font data.
        Returns:
        The new typeface.
      • createFromFile

        public static Typeface createFromFile(String path)
        Create a new typeface from the specified font file.
        Parameters:
        path - The full path to the font data.
        Returns:
        The new typeface.
      • finalize

        protected void finalize()
                         throws Throwable
        Description copied from class: Object
        Invoked when the garbage collector has detected that this instance is no longer reachable. The default implementation does nothing, but this method can be overridden to free resources.

        Note that objects that override finalize are significantly more expensive than objects that don't. Finalizers may be run a long time after the object is no longer reachable, depending on memory pressure, so it's a bad idea to rely on them for cleanup. Note also that finalizers are run on a single VM-wide finalizer thread, so doing blocking work in a finalizer is a bad idea. A finalizer is usually only necessary for a class that has a native peer and needs to call a native method to destroy that peer. Even then, it's better to provide an explicit close method (and implement Closeable), and insist that callers manually dispose of instances. This works well for something like files, but less well for something like a BigInteger where typical calling code would have to deal with lots of temporaries. Unfortunately, code that creates lots of temporaries is the worst kind of code from the point of view of the single finalizer thread.

        If you must use finalizers, consider at least providing your own ReferenceQueue and having your own thread process that queue.

        Unlike constructors, finalizers are not automatically chained. You are responsible for calling super.finalize() yourself.

        Uncaught exceptions thrown by finalizers are ignored and do not terminate the finalizer thread. See Effective Java Item 7, "Avoid finalizers" for more.

        Overrides:
        finalize in class Object
        Throws:
        Throwable
      • equals

        public boolean equals(Object o)
        Description copied from class: Object
        Compares this instance with the specified object and indicates if they are equal. In order to be equal, o must represent the same object as this instance using a class-specific comparison. The general contract is that this comparison should be reflexive, symmetric, and transitive. Also, no object reference other than null is equal to null.

        The default implementation returns true only if this == o. See Writing a correct equals method if you intend implementing your own equals method.

        The general contract for the equals and Object.hashCode() methods is that if equals returns true for any two objects, then hashCode() must return the same value for these objects. This means that subclasses of Object usually override either both methods or neither of them.

        Overrides:
        equals in class Object
        Parameters:
        o - the object to compare this instance with.
        Returns:
        true if the specified object is equal to this Object; false otherwise.
        See Also:
        Object.hashCode()
      • hashCode

        public int hashCode()
        Description copied from class: Object
        Returns an integer hash code for this object. By contract, any two objects for which Object.equals(java.lang.Object) returns true must return the same hash code value. This means that subclasses of Object usually override both methods or neither method.

        Note that hash values must not change over time unless information used in equals comparisons also changes.

        See Writing a correct hashCode method if you intend implementing your own hashCode method.

        Overrides:
        hashCode in class Object
        Returns:
        this object's hash code.
        See Also:
        Object.equals(java.lang.Object)
      • setGammaForText

        public static void setGammaForText(float blackGamma,
                           float whiteGamma)
        Set the global gamma coefficients for black and white text. This call is usually a no-op in shipping products, and only exists for testing during development.
        Parameters:
        blackGamma - gamma coefficient for black text
        whiteGamma - gamma coefficient for white text


Content

Android Reference

Java basics

Java Enterprise Edition (EE)

Java Standard Edition (SE)

SQL

HTML

PHP

CSS

Java Script

MYSQL

JQUERY

VBS

REGEX

C

C++

C#

Design patterns

RFC (standard status)

RFC (proposed standard status)

RFC (draft standard status)

RFC (informational status)

RFC (experimental status)

RFC (best current practice status)

RFC (historic status)

RFC (unknown status)

IT dictionary

License.
All information of this service is derived from the free sources and is provided solely in the form of quotations. This service provides information and interfaces solely for the familiarization (not ownership) and under the "as is" condition.
Copyright 2016 © ELTASK.COM. All rights reserved.
Site is optimized for mobile devices.
Downloads: 3610 / . Delta: 0.02261 с