Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

gnu.java.awt.peer
Class ClasspathFontPeer  view ClasspathFontPeer download ClasspathFontPeer.java

java.lang.Object
  extended bygnu.java.awt.peer.ClasspathFontPeer
All Implemented Interfaces:
java.awt.peer.FontPeer

public abstract class ClasspathFontPeer
extends java.lang.Object
implements java.awt.peer.FontPeer

A peer for fonts that are used inside Classpath. The purpose of this interface is to abstract from platform-specific font handling in the Classpath implementation of java.awt.Font and related classes.

State kept by the peer: a peer is generated for each Font object in the default implementation. If you wish to share peers between fonts, you will need to subclass both ClasspathFontPeer and ClasspathToolKit.

Thread Safety: Methods of this interface may be called from arbitrary threads at any time. Implementations of the ClasspathFontPeer interface are required to perform the necessary synchronization.


Field Summary
protected  java.lang.String faceName
           
protected  java.lang.String familyName
           
protected  java.lang.String logicalName
          The 3 names of this font.
protected  float size
          The font point size.
protected  int style
          The font style, which is a combination (by OR-ing) of the font style constants PLAIN, BOLD and ITALIC, in this class.
protected  java.awt.geom.AffineTransform transform
          The affine transformation the font is currently subject to.
 
Constructor Summary
ClasspathFontPeer(java.lang.String name, int style, int size)
           
ClasspathFontPeer(java.lang.String name, java.util.Map attrs)
           
 
Method Summary
abstract  boolean canDisplay(java.awt.Font font, char c)
          Implementation of Font.canDisplay(char)>Font.canDisplay(char) 55
abstract  int canDisplayUpTo(java.awt.Font font, java.text.CharacterIterator i, int start, int limit)
          Implementation of Font#canDisplay(String), Font#canDisplay(char [], int, int), and Font#canDisplay(CharacterIterator, int, int).
protected static void copyFamilyToAttrs(java.lang.String fam, java.util.Map attrs)
           
static void copySizeToAttrs(float size, java.util.Map attrs)
           
static void copyStyleToAttrs(int style, java.util.Map attrs)
           
protected static void copyTransformToAttrs(java.awt.geom.AffineTransform trans, java.util.Map attrs)
           
abstract  java.awt.font.GlyphVector createGlyphVector(java.awt.Font font, java.awt.font.FontRenderContext frc, java.text.CharacterIterator ci)
          Implementation of Font.createGlyphVector(FontRenderContext, String)>Font.createGlyphVector(FontRenderContext, String) 55 , Font.createGlyphVector(FontRenderContext, char[])>Font.createGlyphVector(FontRenderContext, char[]) 55 , and Font.createGlyphVector(FontRenderContext, CharacterIterator)>Font.createGlyphVector(FontRenderContext, CharacterIterator) 55 .
abstract  java.awt.font.GlyphVector createGlyphVector(java.awt.Font font, java.awt.font.FontRenderContext ctx, int[] glyphCodes)
          Implementation of Font.createGlyphVector(FontRenderContext, int[])>Font.createGlyphVector(FontRenderContext, int[]) 55 .
 java.awt.Font deriveFont(java.awt.Font font, java.awt.geom.AffineTransform t)
          Implementation of Font.deriveFont(AffineTransform)>Font.deriveFont(AffineTransform) 55
 java.awt.Font deriveFont(java.awt.Font font, float size)
          Implementation of Font.deriveFont(float)>Font.deriveFont(float) 55
 java.awt.Font deriveFont(java.awt.Font font, int style)
          Implementation of Font.deriveFont(int)>Font.deriveFont(int) 55
 java.awt.Font deriveFont(java.awt.Font font, int style, java.awt.geom.AffineTransform t)
          Implementation of Font.deriveFont(int, AffineTransform)>Font.deriveFont(int, AffineTransform) 55
 java.awt.Font deriveFont(java.awt.Font font, int style, float size)
          Implementation of Font.deriveFont(int, float)>Font.deriveFont(int, float) 55
 java.awt.Font deriveFont(java.awt.Font font, java.util.Map attrs)
          Implementation of Font.deriveFont(Map)>Font.deriveFont(Map) 55
protected static java.lang.String faceNameToFamilyName(java.lang.String name)
           
 java.util.Map getAttributes(java.awt.Font font)
          Implementation of Font.getAttributes()>Font.getAttributes() 55
 java.text.AttributedCharacterIterator.Attribute[] getAvailableAttributes(java.awt.Font font)
          Implementation of Font.getAvailableAttributes()>Font.getAvailableAttributes() 55
abstract  byte getBaselineFor(java.awt.Font font, char c)
          Implementation of Font.getBaselineFor(char)>Font.getBaselineFor(char) 55
 java.lang.String getFamily(java.awt.Font font)
          Implementation of Font.getFamily()>Font.getFamily() 55
 java.lang.String getFamily(java.awt.Font font, java.util.Locale lc)
          Implementation of Font.getFamily(Locale)>Font.getFamily(Locale) 55
abstract  java.awt.FontMetrics getFontMetrics(java.awt.Font font)
          Implementation of Font#getFontMetrics()
 java.lang.String getFontName(java.awt.Font font)
          Implementation of Font.getFontName()>Font.getFontName() 55
 java.lang.String getFontName(java.awt.Font font, java.util.Locale lc)
          Implementation of Font.getFontName(Locale)>Font.getFontName(Locale) 55
abstract  java.lang.String getGlyphName(java.awt.Font font, int glyphIndex)
          Returns a name for the specified glyph.
 float getItalicAngle(java.awt.Font font)
          Implementation of Font.getItalicAngle()>Font.getItalicAngle() 55
abstract  java.awt.font.LineMetrics getLineMetrics(java.awt.Font font, java.text.CharacterIterator ci, int begin, int limit, java.awt.font.FontRenderContext rc)
          Implementation of Font.getLineMetrics(CharacterIterator, int, int, FontRenderContext)>Font.getLineMetrics(CharacterIterator, int, int, FontRenderContext) 55
abstract  java.awt.geom.Rectangle2D getMaxCharBounds(java.awt.Font font, java.awt.font.FontRenderContext rc)
          Implementation of Font.getMaxCharBounds(FontRenderContext)>Font.getMaxCharBounds(FontRenderContext) 55
abstract  int getMissingGlyphCode(java.awt.Font font)
          Implementation of Font.getMissingGlyphCode()>Font.getMissingGlyphCode() 55
 java.lang.String getName(java.awt.Font font)
          Implementation of Font.getName()>Font.getName() 55
abstract  int getNumGlyphs(java.awt.Font font)
          Implementation of Font.getNumGlyphs()>Font.getNumGlyphs() 55
abstract  java.lang.String getPostScriptName(java.awt.Font font)
          Implementation of Font.getPSName()>Font.getPSName() 55
 float getSize(java.awt.Font font)
          Implementation of Font.getSize()>Font.getSize() 55
protected  void getStandardAttributes(java.util.Map attrs)
           
abstract  java.awt.geom.Rectangle2D getStringBounds(java.awt.Font font, java.text.CharacterIterator ci, int begin, int limit, java.awt.font.FontRenderContext frc)
          Implementation of Font.getStringBounds(CharacterIterator, int, int, FontRenderContext)>Font.getStringBounds(CharacterIterator, int, int, FontRenderContext) 55
 int getStyle(java.awt.Font font)
          Implementation of Font.getStyle()>Font.getStyle() 55
abstract  java.lang.String getSubFamilyName(java.awt.Font font, java.util.Locale locale)
          Returns the name of this font face inside the family, for example “Light”.
 java.awt.geom.AffineTransform getTransform(java.awt.Font font)
          Implementation of Font.getTransform()>Font.getTransform() 55
abstract  boolean hasUniformLineMetrics(java.awt.Font font)
          Implementation of Font.hasUniformLineMetrics()>Font.hasUniformLineMetrics() 55
 boolean isBold(java.awt.Font font)
          Implementation of Font.isBold()>Font.isBold() 55
 boolean isItalic(java.awt.Font font)
          Implementation of Font.isItalic()>Font.isItalic() 55
protected static boolean isLogicalFontName(java.lang.String name)
           
 boolean isPlain(java.awt.Font font)
          Implementation of Font.isPlain()>Font.isPlain() 55
 boolean isTransformed(java.awt.Font font)
          Implementation of Font.isTransformed()>Font.isTransformed() 55
abstract  java.awt.font.GlyphVector layoutGlyphVector(java.awt.Font font, java.awt.font.FontRenderContext frc, char[] chars, int start, int limit, int flags)
          Implementation of Font.layoutGlyphVector(FontRenderContext, char[], int, int, int)>Font.layoutGlyphVector(FontRenderContext, char[], int, int, int) 55 .
protected static java.lang.String logicalFontNameToFaceName(java.lang.String name)
           
protected  void setStandardAttributes(java.lang.String name, java.util.Map attribs)
           
protected  void setStandardAttributes(java.lang.String name, java.lang.String family, int style, float size, java.awt.geom.AffineTransform trans)
           
protected static gnu.java.awt.ClasspathToolkit tk()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logicalName

protected java.lang.String logicalName
The 3 names of this font. all fonts have 3 names, some of which may be equal: logical -- name the font was constructed from family -- a designer or brand name (Helvetica) face -- specific instance of a design (Helvetica Regular)

See Also:
isLogicalFontName

familyName

protected java.lang.String familyName

faceName

protected java.lang.String faceName

style

protected int style
The font style, which is a combination (by OR-ing) of the font style constants PLAIN, BOLD and ITALIC, in this class.


size

protected float size
The font point size. A point is 1/72 of an inch.


transform

protected java.awt.geom.AffineTransform transform
The affine transformation the font is currently subject to.

Constructor Detail

ClasspathFontPeer

public ClasspathFontPeer(java.lang.String name,
                         java.util.Map attrs)

ClasspathFontPeer

public ClasspathFontPeer(java.lang.String name,
                         int style,
                         int size)
Method Detail

tk

protected static gnu.java.awt.ClasspathToolkit tk()

isLogicalFontName

protected static boolean isLogicalFontName(java.lang.String name)

logicalFontNameToFaceName

protected static java.lang.String logicalFontNameToFaceName(java.lang.String name)

faceNameToFamilyName

protected static java.lang.String faceNameToFamilyName(java.lang.String name)

copyStyleToAttrs

public static void copyStyleToAttrs(int style,
                                    java.util.Map attrs)

copyFamilyToAttrs

protected static void copyFamilyToAttrs(java.lang.String fam,
                                        java.util.Map attrs)

copySizeToAttrs

public static void copySizeToAttrs(float size,
                                   java.util.Map attrs)

copyTransformToAttrs

protected static void copyTransformToAttrs(java.awt.geom.AffineTransform trans,
                                           java.util.Map attrs)

setStandardAttributes

protected void setStandardAttributes(java.lang.String name,
                                     java.lang.String family,
                                     int style,
                                     float size,
                                     java.awt.geom.AffineTransform trans)

setStandardAttributes

protected void setStandardAttributes(java.lang.String name,
                                     java.util.Map attribs)

getStandardAttributes

protected void getStandardAttributes(java.util.Map attrs)

getName

public java.lang.String getName(java.awt.Font font)
Implementation of Font.getName()>Font.getName() 55


getFamily

public java.lang.String getFamily(java.awt.Font font)
Implementation of Font.getFamily()>Font.getFamily() 55


getFamily

public java.lang.String getFamily(java.awt.Font font,
                                  java.util.Locale lc)
Implementation of Font.getFamily(Locale)>Font.getFamily(Locale) 55


getFontName

public java.lang.String getFontName(java.awt.Font font)
Implementation of Font.getFontName()>Font.getFontName() 55


getFontName

public java.lang.String getFontName(java.awt.Font font,
                                    java.util.Locale lc)
Implementation of Font.getFontName(Locale)>Font.getFontName(Locale) 55


getSize

public float getSize(java.awt.Font font)
Implementation of Font.getSize()>Font.getSize() 55


isPlain

public boolean isPlain(java.awt.Font font)
Implementation of Font.isPlain()>Font.isPlain() 55


isBold

public boolean isBold(java.awt.Font font)
Implementation of Font.isBold()>Font.isBold() 55


isItalic

public boolean isItalic(java.awt.Font font)
Implementation of Font.isItalic()>Font.isItalic() 55


deriveFont

public java.awt.Font deriveFont(java.awt.Font font,
                                int style,
                                float size)
Implementation of Font.deriveFont(int, float)>Font.deriveFont(int, float) 55


deriveFont

public java.awt.Font deriveFont(java.awt.Font font,
                                float size)
Implementation of Font.deriveFont(float)>Font.deriveFont(float) 55


deriveFont

public java.awt.Font deriveFont(java.awt.Font font,
                                int style)
Implementation of Font.deriveFont(int)>Font.deriveFont(int) 55


deriveFont

public java.awt.Font deriveFont(java.awt.Font font,
                                int style,
                                java.awt.geom.AffineTransform t)
Implementation of Font.deriveFont(int, AffineTransform)>Font.deriveFont(int, AffineTransform) 55


deriveFont

public java.awt.Font deriveFont(java.awt.Font font,
                                java.awt.geom.AffineTransform t)
Implementation of Font.deriveFont(AffineTransform)>Font.deriveFont(AffineTransform) 55


deriveFont

public java.awt.Font deriveFont(java.awt.Font font,
                                java.util.Map attrs)
Implementation of Font.deriveFont(Map)>Font.deriveFont(Map) 55


getAttributes

public java.util.Map getAttributes(java.awt.Font font)
Implementation of Font.getAttributes()>Font.getAttributes() 55


getAvailableAttributes

public java.text.AttributedCharacterIterator.Attribute[] getAvailableAttributes(java.awt.Font font)
Implementation of Font.getAvailableAttributes()>Font.getAvailableAttributes() 55


getTransform

public java.awt.geom.AffineTransform getTransform(java.awt.Font font)
Implementation of Font.getTransform()>Font.getTransform() 55


isTransformed

public boolean isTransformed(java.awt.Font font)
Implementation of Font.isTransformed()>Font.isTransformed() 55


getItalicAngle

public float getItalicAngle(java.awt.Font font)
Implementation of Font.getItalicAngle()>Font.getItalicAngle() 55


getStyle

public int getStyle(java.awt.Font font)
Implementation of Font.getStyle()>Font.getStyle() 55


canDisplay

public abstract boolean canDisplay(java.awt.Font font,
                                   char c)
Implementation of Font.canDisplay(char)>Font.canDisplay(char) 55


canDisplayUpTo

public abstract int canDisplayUpTo(java.awt.Font font,
                                   java.text.CharacterIterator i,
                                   int start,
                                   int limit)
Implementation of Font#canDisplay(String), Font#canDisplay(char [], int, int), and Font#canDisplay(CharacterIterator, int, int).


getSubFamilyName

public abstract java.lang.String getSubFamilyName(java.awt.Font font,
                                                  java.util.Locale locale)
Returns the name of this font face inside the family, for example “Light”.

This method is currently not used by java.awt.Font. However, this name would be needed by any serious desktop publishing application.


getPostScriptName

public abstract java.lang.String getPostScriptName(java.awt.Font font)
Implementation of Font.getPSName()>Font.getPSName() 55


getNumGlyphs

public abstract int getNumGlyphs(java.awt.Font font)
Implementation of Font.getNumGlyphs()>Font.getNumGlyphs() 55


getMissingGlyphCode

public abstract int getMissingGlyphCode(java.awt.Font font)
Implementation of Font.getMissingGlyphCode()>Font.getMissingGlyphCode() 55


getBaselineFor

public abstract byte getBaselineFor(java.awt.Font font,
                                    char c)
Implementation of Font.getBaselineFor(char)>Font.getBaselineFor(char) 55


getGlyphName

public abstract java.lang.String getGlyphName(java.awt.Font font,
                                              int glyphIndex)
Returns a name for the specified glyph. This is useful for generating PostScript or PDF files that embed some glyphs of a font. If the implementation follows glyph naming conventions specified by Adobe, search engines can extract the original text from the generated PostScript and PDF files.

This method is currently not used by GNU Classpath. However, it would be very useful for someone wishing to write a good PostScript or PDF stream provider for the javax.print package.

Names are not unique: Under some rare circumstances, the same name can be returned for different glyphs. It is therefore recommended that printer drivers check whether the same name has already been returned for antoher glyph, and make the name unique by adding the string ".alt" followed by the glyph index.

This situation would occur for an OpenType or TrueType font that has a post table of format 3 and provides a mapping from glyph IDs to Unicode sequences through a Zapf table. If the same sequence of Unicode codepoints leads to different glyphs (depending on contextual position, for example, or on typographic sophistication level), the same name would get synthesized for those glyphs. To avoid this, the font peer would have to go through the names of all glyphs, which would make this operation very inefficient with large fonts.


createGlyphVector

public abstract java.awt.font.GlyphVector createGlyphVector(java.awt.Font font,
                                                            java.awt.font.FontRenderContext frc,
                                                            java.text.CharacterIterator ci)
Implementation of Font.createGlyphVector(FontRenderContext, String)>Font.createGlyphVector(FontRenderContext, String) 55 , Font.createGlyphVector(FontRenderContext, char[])>Font.createGlyphVector(FontRenderContext, char[]) 55 , and Font.createGlyphVector(FontRenderContext, CharacterIterator)>Font.createGlyphVector(FontRenderContext, CharacterIterator) 55 .


createGlyphVector

public abstract java.awt.font.GlyphVector createGlyphVector(java.awt.Font font,
                                                            java.awt.font.FontRenderContext ctx,
                                                            int[] glyphCodes)
Implementation of Font.createGlyphVector(FontRenderContext, int[])>Font.createGlyphVector(FontRenderContext, int[]) 55 .


layoutGlyphVector

public abstract java.awt.font.GlyphVector layoutGlyphVector(java.awt.Font font,
                                                            java.awt.font.FontRenderContext frc,
                                                            char[] chars,
                                                            int start,
                                                            int limit,
                                                            int flags)
Implementation of Font.layoutGlyphVector(FontRenderContext, char[], int, int, int)>Font.layoutGlyphVector(FontRenderContext, char[], int, int, int) 55 .


getFontMetrics

public abstract java.awt.FontMetrics getFontMetrics(java.awt.Font font)
Implementation of Font#getFontMetrics()


hasUniformLineMetrics

public abstract boolean hasUniformLineMetrics(java.awt.Font font)
Implementation of Font.hasUniformLineMetrics()>Font.hasUniformLineMetrics() 55


getLineMetrics

public abstract java.awt.font.LineMetrics getLineMetrics(java.awt.Font font,
                                                         java.text.CharacterIterator ci,
                                                         int begin,
                                                         int limit,
                                                         java.awt.font.FontRenderContext rc)
Implementation of Font.getLineMetrics(CharacterIterator, int, int, FontRenderContext)>Font.getLineMetrics(CharacterIterator, int, int, FontRenderContext) 55


getMaxCharBounds

public abstract java.awt.geom.Rectangle2D getMaxCharBounds(java.awt.Font font,
                                                           java.awt.font.FontRenderContext rc)
Implementation of Font.getMaxCharBounds(FontRenderContext)>Font.getMaxCharBounds(FontRenderContext) 55


getStringBounds

public abstract java.awt.geom.Rectangle2D getStringBounds(java.awt.Font font,
                                                          java.text.CharacterIterator ci,
                                                          int begin,
                                                          int limit,
                                                          java.awt.font.FontRenderContext frc)
Implementation of Font.getStringBounds(CharacterIterator, int, int, FontRenderContext)>Font.getStringBounds(CharacterIterator, int, int, FontRenderContext) 55