FileDocCategorySizeDatePackage
FontRenderContext.javaAPI DocAndroid 1.5 API5138Wed May 06 22:41:54 BST 2009java.awt.font

FontRenderContext

public class FontRenderContext extends Object
The FontRenderContext class contains the information about text measurement. Anti-aliasing and fractional-metrics modes are defined by an application and affect the size of a character.
since
Android 1.0

Fields Summary
private AffineTransform
transform
The transform.
private boolean
fAntiAliased
The anti aliased.
private boolean
fFractionalMetrics
The fractional metrics.
Constructors Summary
public FontRenderContext(AffineTransform trans, boolean antiAliased, boolean usesFractionalMetrics)
Instantiates a new FontRenderContext object with the specified AffineTransform, anti-aliasing and fractional metrics flags.

param
trans the AffineTransform.
param
antiAliased the anti-aliasing flag.
param
usesFractionalMetrics the fractional metrics flag.

        if (trans != null){
            transform = new AffineTransform(trans);
        }
        fAntiAliased = antiAliased;
        fFractionalMetrics = usesFractionalMetrics;
    
protected FontRenderContext()
Instantiates a new FontRenderContext object.

    
Methods Summary
public booleanequals(java.lang.Object obj)
Compares the specified Object with current FontRenderContext object.

param
obj the Object to be compared.
return
true, if the specified Object is equal to current FontRenderContext object.

        if (obj == this) {
            return true;
        }

        if (obj != null) {
            try {
                return equals((FontRenderContext) obj);
            } catch (ClassCastException e) {
                return false;
            }
        }
        return false;

    
public booleanequals(java.awt.font.FontRenderContext frc)
Compares the specified FontRenderContext object with current FontRenderContext.

param
frc the FontRenderContext object to be compared.
return
true, if the specified FontRenderContext object is equal to current FontRenderContext.

        if (this == frc){
            return true;
        }

        if (frc == null){
            return false;
        }

        if (!frc.getTransform().equals(this.getTransform()) &&
            !frc.isAntiAliased() == this.fAntiAliased &&
            !frc.usesFractionalMetrics() == this.fFractionalMetrics){
            return false;
        }
        return true;
    
public java.awt.geom.AffineTransformgetTransform()
Gets the transform which is used for scaling typographical points to pixels in this FontRenderContext.

return
the AffineTransform which is used for scaling typographical points to pixels in this FontRenderContext.

        if (transform != null){
            return new AffineTransform(transform);
        }
        return new AffineTransform();
    
public inthashCode()
Returns hash code of the FontRenderContext object.

return
the hash code of the FontRenderContext object.

        return this.getTransform().hashCode() ^
                new Boolean(this.fFractionalMetrics).hashCode() ^
                new Boolean(this.fAntiAliased).hashCode();
    
public booleanisAntiAliased()
Returns true if anti-aliasing is used in this FontRenderContext.

return
true, if is anti-aliasing is used in this FontRenderContext, false otherwise.

        return this.fAntiAliased;
    
public booleanusesFractionalMetrics()
Returns true if the text fractional metrics are used in this FontRenderContext.

return
true, if the text fractional metrics are used in this FontRenderContext, false otherwise.

        return this.fFractionalMetrics;