http://www.eteks.com

com.eteks.awt
Class PJAFontMetrics

java.lang.Object
  extended byjava.awt.FontMetrics
      extended bycom.eteks.awt.PJAFontMetrics
All Implemented Interfaces:
java.io.Serializable

public class PJAFontMetrics
extends java.awt.FontMetrics
implements java.io.Serializable

Pure Java AWT Font Metrics implementation. This class returns the metrics of a given font (name + style + sizes).
From version 1.1, all the font data management moved to the new class PJAFontData to avoid using PJAFontMetrics which extends this class in PJAGraphics code (java.awt.FontMetrics requires awt library to be loaded to call initIDs native method).

Since:
PJA1.0
Version:
2.1
Author:
Emmanuel Puybaret
See Also:
Serialized Form

Field Summary
 
Fields inherited from class java.awt.FontMetrics
font
 
Constructor Summary
protected PJAFontMetrics(java.awt.Font font, PJAFontData fontData)
           
 
Method Summary
 int charsWidth(char[] data, int offset, int len)
          java.awt.FontMetrics implementation.
 int charWidth(char ch)
          java.awt.FontMetrics implementation.
 int charWidth(int ch)
          java.awt.FontMetrics implementation.
 int getAscent()
          java.awt.FontMetrics implementation.
 int getCharOffsetAtBaseline(char ch)
          Deprecated. As of PJA version 1.1, replaced by PJAFontData.getCharOffsetAtBaseline ().
 int[] getCharPixels(char ch)
          Deprecated. As of PJA version 1.1, replaced by PJAFontData.getCharPixels ().
 int getCharPixelsWidth(char ch)
          Deprecated. As of PJA version 1.1, replaced by PJAFontData.getCharPixelsWidth ().
 int getDescent()
          java.awt.FontMetrics implementation.
 int getLeading()
          java.awt.FontMetrics implementation.
 int getMaxAdvance()
          java.awt.FontMetrics implementation.
 int getMaxAscent()
          java.awt.FontMetrics implementation.
 int getMaxDescent()
          java.awt.FontMetrics implementation.
protected  void setFont(java.awt.Font font)
          Deprecated. As of PJA version 1.1, PJAFontPeer doesn't need it anymore.
 
Methods inherited from class java.awt.FontMetrics
bytesWidth, getFont, getHeight, getLineMetrics, getLineMetrics, getLineMetrics, getLineMetrics, getMaxCharBounds, getMaxDecent, getStringBounds, getStringBounds, getStringBounds, getStringBounds, getWidths, hasUniformLineMetrics, stringWidth, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PJAFontMetrics

protected PJAFontMetrics(java.awt.Font font,
                         PJAFontData fontData)
Method Detail

setFont

protected void setFont(java.awt.Font font)
Deprecated. As of PJA version 1.1, PJAFontPeer doesn't need it anymore.

Sets the font for this metrics object. This protected method is used to set the font afterwards a PJAFontMetrics object is created or deserialized.

Parameters:
font - The matching font for this metrics.

getLeading

public int getLeading()
java.awt.FontMetrics implementation. Returns the leading of this font.

See Also:
PJAFontData

getAscent

public int getAscent()
java.awt.FontMetrics implementation. Returns the ascent of this font.

See Also:
PJAFontData

getDescent

public int getDescent()
java.awt.FontMetrics implementation. Returns the descent of this font.

See Also:
PJAFontData

getMaxAscent

public int getMaxAscent()
java.awt.FontMetrics implementation. Returns the max ascent of this font.

See Also:
PJAFontData

getMaxDescent

public int getMaxDescent()
java.awt.FontMetrics implementation. Returns the max descent of this font.

See Also:
PJAFontData

getMaxAdvance

public int getMaxAdvance()
java.awt.FontMetrics implementation. Returns the max advance of this font.

See Also:
PJAFontData

charWidth

public int charWidth(int ch)
java.awt.FontMetrics implementation. Returns the char width of the character ch in this font.

See Also:
PJAFontData

charWidth

public int charWidth(char ch)
java.awt.FontMetrics implementation. Returns the char width of the character ch in this font. (need to override charWidth (char ch) of the class java.awt.FontMetrics to avoid stack overflow in getWidths ())

Since:
PJA1.2
See Also:
PJAFontData

charsWidth

public int charsWidth(char[] data,
                      int offset,
                      int len)
java.awt.FontMetrics implementation. Returns the string width of a string in this font.

See Also:
PJAFontData

getCharPixels

public int[] getCharPixels(char ch)
Deprecated. As of PJA version 1.1, replaced by PJAFontData.getCharPixels ().

Returns the pixels array of the character ch.

See Also:
PJAFontData

getCharPixelsWidth

public int getCharPixelsWidth(char ch)
Deprecated. As of PJA version 1.1, replaced by PJAFontData.getCharPixelsWidth ().

Returns the scansize of the pixels array of the character ch.

See Also:
PJAFontData

getCharOffsetAtBaseline

public int getCharOffsetAtBaseline(char ch)
Deprecated. As of PJA version 1.1, replaced by PJAFontData.getCharOffsetAtBaseline ().

Returns the offset of the character ch to add at baseline.

See Also:
PJAFontData

© 1997-2003 eTeks - All rights reserved