|
http://www.eteks.com | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.eteks.awt.PJAFontData
Pure Java AWT Font data.
From version 1.1, this class keeps all the data of a font to avoid using PJAFontMetrics
which extends
java.awt.FontMetrics
(java.awt.FontMetrics
requires awt library to be loaded).
This class implements Serializable
; it implements readObject (ObjectInputStream)
and writeObject (ObjectOutputStream)
methods in such a way that they call the methods
read (InputStream)
and write (OutputStream)
respectively of this class. As The methods
read ()
and write ()
don't use serialization process, they can be use to restore and
save the state of an instance of PJAFontData
in Java environments
where serialization isn't available (Java 1.0 and J2ME).
PJAGraphicsManager
,
PJAFontPeer
,
PJAFontCapture
, Serialized FormField Summary | |
static java.lang.String |
PJAF1_1_FILE_HEADER
|
static java.lang.String |
PJAF1_1_FONT_HEADER
|
Constructor Summary | |
PJAFontData(java.awt.Font font,
int minChar,
int maxChar)
Creates a font data from font . |
|
PJAFontData(java.io.InputStream in)
Creates a font data from the in stream
with read () method. |
Method Summary | |
boolean |
equals(java.lang.Object object)
Returns true if this font peer and object have the
same name, style and size. |
int |
getAscent()
Returns the ascent of this font. |
protected int[] |
getCharBits()
Provides direct access to bitset array for this font's pixels. |
protected int |
getCharBitsOffset(char ch)
Retrieves the offset for the bit representing top-left pixel in the given char, within the bitset. |
protected int |
getCharBitsScanSize()
Retrieves the scansize of the linear bit array, i.e., the number of bits in each very long scanline of pixels stored sequentially in the bitset |
protected int |
getCharOffsetAtBaseline(char ch)
Returns the offset of the character ch to add at baseline.
|
protected int[] |
getCharPixels(char ch)
Returns the pixels array of the character ch . |
protected int |
getCharPixelsWidth(char ch)
Returns the scansize of the pixels array of the character ch . |
int |
getCharsWidth(char[] data,
int offset,
int len)
Returns the string width of a string in this font. |
int |
getCharWidth(int ch)
Returns the char width of the character ch in this font. |
int |
getDescent()
Returns the descent of this font. |
int |
getLeading()
Returns the leading of this font. |
int |
getMaxAdvance()
Returns the max advance of this font. |
int |
getMaxAscent()
Returns the max ascent of this font. |
int |
getMaxDescent()
Returns the max descent of this font. |
java.lang.String |
getName()
Returns the name of this font. |
int |
getSize()
Returns the size of this font. |
int |
getStyle()
Returns the style of this font. |
int |
hashCode()
|
void |
read(java.io.InputStream in)
Reads the fields of this object from in . |
static java.lang.String |
styleToString(int style)
|
java.lang.String |
toString()
|
void |
write(java.io.OutputStream out)
Writes the fields of this object to out . |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final java.lang.String PJAF1_1_FILE_HEADER
public static final java.lang.String PJAF1_1_FONT_HEADER
Constructor Detail |
public PJAFontData(java.io.InputStream in) throws java.io.IOException
in
stream
with read ()
method.in
- An opened input stream.java.io.EOFException
- End of in
is reached.java.io.IOException
- The object fields couldn't be read correctly from in
.read(java.io.InputStream)
public PJAFontData(java.awt.Font font, int minChar, int maxChar)
font
. The pixels of all the characters between
minChar
and maxChar
are grabbed and stored in internal fields.font
- A valid font object.minChar
- The first character to be grabbed.maxChar
- The last character to be grabbed.Method Detail |
public java.lang.String getName()
public int getStyle()
public int getSize()
public int getLeading()
PJAGraphicsExtension.getFontLeading()
public int getAscent()
PJAGraphicsExtension.getFontAscent()
public int getDescent()
PJAGraphicsExtension.getFontDescent()
public int getMaxAscent()
PJAGraphicsExtension.getFontMaxAscent()
public int getMaxDescent()
PJAGraphicsExtension.getFontMaxDescent()
public int getMaxAdvance()
PJAGraphicsExtension.getFontMaxAdvance()
public int getCharWidth(int ch)
ch
in this font.ch
- The character to measure.PJAGraphicsExtension.getCharWidth(char)
public int getCharsWidth(char[] data, int offset, int len)
PJAGraphicsExtension.getStringWidth(java.lang.String)
protected int[] getCharPixels(char ch)
ch
.PJAGraphics.drawString(java.lang.String, int, int)
,
getCharPixelsWidth(char)
protected int[] getCharBits()
protected int getCharBitsOffset(char ch)
protected int getCharBitsScanSize()
protected int getCharPixelsWidth(char ch)
ch
.PJAGraphics.drawString(java.lang.String, int, int)
,
getCharPixels(char)
protected int getCharOffsetAtBaseline(char ch)
ch
to add at baseline.
When font is italic, some characters have some pixels at the left of the x
coordinate of their drawing point.PJAGraphics.drawString(java.lang.String, int, int)
,
getCharPixels(char)
public void write(java.io.OutputStream out) throws java.io.IOException
out
. It does the same
as serialization.public void read(java.io.InputStream in) throws java.io.IOException
in
. It does the same
as serialization.public boolean equals(java.lang.Object object)
true
if this font peer and object
have the
same name, style and size.equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public static java.lang.String styleToString(int style)
public java.lang.String toString()
toString
in class java.lang.Object
|
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |