org.fuin.objects4j
Class FontSize

java.lang.Object
  extended by org.fuin.objects4j.FontSize
All Implemented Interfaces:
java.io.Serializable

@Immutable
public final class FontSize
extends java.lang.Object
implements java.io.Serializable

Size of a font including the unit.

See Also:
Serialized Form

Constructor Summary
FontSize(float size, FontSizeUnit unit)
          Constructor with size and unit.
 
Method Summary
 boolean equals(java.lang.Object obj)
           
 float getSize()
          Returns the size of the font.
 FontSizeUnit getUnit()
          Returns the unit of the size.
 int hashCode()
           
 float toEm()
          Returns the font size expressed in EM.
 java.lang.String toEmStr()
          Returns the size as EM including the unit.
 float toPercent()
          Returns the font size expressed in percent.
 java.lang.String toPercentStr()
          Returns the size as percent including the unit.
 int toPixel()
          Returns the font size expressed in pixels.
 java.lang.String toPixelStr()
          Returns the size as pixel including the unit.
 float toPoint()
          Returns the font size expressed in points.
 java.lang.String toPointStr()
          Returns the size as points including the unit.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FontSize

public FontSize(float size,
                FontSizeUnit unit)
Constructor with size and unit.

Parameters:
size - Size of the font.
unit - Unit of the size.
Method Detail

getSize

public final float getSize()
Returns the size of the font.

Returns:
Size.

getUnit

public final FontSizeUnit getUnit()
Returns the unit of the size.

Returns:
Unit.

toPixel

public final int toPixel()
Returns the font size expressed in pixels.

Returns:
Pixels.

toPoint

public final float toPoint()
Returns the font size expressed in points.

Returns:
Points.

toEm

public final float toEm()
Returns the font size expressed in EM.

Returns:
EM.

toPercent

public final float toPercent()
Returns the font size expressed in percent.

Returns:
Percent.

toPixelStr

public final java.lang.String toPixelStr()
Returns the size as pixel including the unit.

Returns:
Size and unit (Example: "16px").

toPointStr

public final java.lang.String toPointStr()
Returns the size as points including the unit.

Returns:
Size and unit (Example: "12pt").

toEmStr

public final java.lang.String toEmStr()
Returns the size as EM including the unit.

Returns:
Size and unit (Example: "1em").

toPercentStr

public final java.lang.String toPercentStr()
Returns the size as percent including the unit.

Returns:
Size and unit (Example: "100%").

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object


Copyright © 2010 Future Invent Informationsmanagement GmbH. All Rights Reserved.