Package org.apache.batik.gvt.font
Class AWTGVTFont
- java.lang.Object
-
- org.apache.batik.gvt.font.AWTGVTFont
-
-
Constructor Summary
Constructors Constructor Description AWTGVTFont(java.awt.Font font)Creates a new AWTGVTFont that wraps the given Font.AWTGVTFont(java.awt.Font font, double scale)Creates a new AWTGVTFont that wraps the given Font.AWTGVTFont(java.lang.String name, int style, int size)Creates a new AWTGVTFont from the specified name, style and point size.AWTGVTFont(java.util.Map attributes)Creates a new AWTGVTFont with the specified attributes.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancanDisplay(char c)Checks if this font can display the specified character.intcanDisplayUpTo(char[] text, int start, int limit)Indicates whether or not this font can display the characters in the specified text starting at start and ending at limit.intcanDisplayUpTo(java.lang.String str)Indicates whether or not this font can display a specified String.intcanDisplayUpTo(java.text.CharacterIterator iter, int start, int limit)Indicates whether or not this font can display the the characters in the specified CharacterIterator starting at start and ending at limit.GVTGlyphVectorcreateGlyphVector(java.awt.font.FontRenderContext frc, char[] chars)Returns a new GlyphVector object created with the specified array of characters and the specified FontRenderContext.GVTGlyphVectorcreateGlyphVector(java.awt.font.FontRenderContext frc, int[] glyphCodes, java.text.CharacterIterator ci)Returns a new GlyphVector object created with the specified integer array and the specified FontRenderContext.GVTGlyphVectorcreateGlyphVector(java.awt.font.FontRenderContext frc, java.lang.String str)Returns a new GlyphVector object created with the specified String and the specified FontRenderContext.GVTGlyphVectorcreateGlyphVector(java.awt.font.FontRenderContext frc, java.text.CharacterIterator ci)Returns a new GlyphVector object created with the specified CharacterIterator and the specified FontRenderContext.GVTFontderiveFont(float size)Creates a new Font object by replicating the current Font object and applying a new size to it.(package private) static AWTGVTFontgetAWTGVTFont(java.awt.Font awtFont)java.lang.StringgetFamilyName()Returns the font family name of this font.static AWTGlyphGeometryCache.ValuegetGlyphGeometry(AWTGVTFont font, char c, java.awt.font.GlyphVector gv, int glyphIndex, java.awt.geom.Point2D glyphPos)Returns the geometry of the specified character.floatgetHKern(int glyphCode1, int glyphCode2)Returns the horizontal kerning value for this glyph pair.GVTLineMetricsgetLineMetrics(char[] chars, int beginIndex, int limit, java.awt.font.FontRenderContext frc)Returns a LineMetrics object created with the specified arguments.GVTLineMetricsgetLineMetrics(java.lang.String str, int beginIndex, int limit, java.awt.font.FontRenderContext frc)Returns a GVTLineMetrics object created with the specified arguments.GVTLineMetricsgetLineMetrics(java.lang.String str, java.awt.font.FontRenderContext frc)Returns a GVTLineMetrics object created with the specified String and FontRenderContext.GVTLineMetricsgetLineMetrics(java.text.CharacterIterator ci, int beginIndex, int limit, java.awt.font.FontRenderContext frc)Returns a GVTLineMetrics object created with the specified arguments.floatgetSize()Returns the size of this font.floatgetVKern(int glyphCode1, int glyphCode2)Returns the vertical kerning value for this glyph pair.(package private) static voidinitializeFontCache(java.awt.Font awtFont)(package private) static voidputAWTGVTFont(AWTGVTFont font)
-
-
-
Field Detail
-
awtFont
protected java.awt.Font awtFont
-
size
protected double size
-
scale
protected double scale
-
FONT_SIZE
public static final float FONT_SIZE
- See Also:
- Constant Field Values
-
fontCache
static java.util.Map fontCache
-
-
Constructor Detail
-
AWTGVTFont
public AWTGVTFont(java.awt.Font font)
Creates a new AWTGVTFont that wraps the given Font.- Parameters:
font- The font object to wrap.
-
AWTGVTFont
public AWTGVTFont(java.awt.Font font, double scale)Creates a new AWTGVTFont that wraps the given Font.- Parameters:
font- The font object to wrap.scale- The scale factor to apply to font...
-
AWTGVTFont
public AWTGVTFont(java.util.Map attributes)
Creates a new AWTGVTFont with the specified attributes.- Parameters:
attributes- Contains attributes of the font to create.
-
AWTGVTFont
public AWTGVTFont(java.lang.String name, int style, int size)Creates a new AWTGVTFont from the specified name, style and point size.- Parameters:
name- The name of the new font.style- The required font style.size- The required font size.
-
-
Method Detail
-
canDisplay
public boolean canDisplay(char c)
Checks if this font can display the specified character.- Specified by:
canDisplayin interfaceGVTFont- Parameters:
c- The character to check.- Returns:
- Whether or not the character can be displayed.
-
canDisplayUpTo
public int canDisplayUpTo(char[] text, int start, int limit)Indicates whether or not this font can display the characters in the specified text starting at start and ending at limit.- Specified by:
canDisplayUpToin interfaceGVTFont- Parameters:
text- An array containing the characters to check.start- The index of the first character to check.limit- The index of the last character to check.- Returns:
- The index of the first char this font cannot display. Will be -1 if it can display all characters in the specified range.
-
canDisplayUpTo
public int canDisplayUpTo(java.text.CharacterIterator iter, int start, int limit)Indicates whether or not this font can display the the characters in the specified CharacterIterator starting at start and ending at limit.- Specified by:
canDisplayUpToin interfaceGVTFont
-
canDisplayUpTo
public int canDisplayUpTo(java.lang.String str)
Indicates whether or not this font can display a specified String.- Specified by:
canDisplayUpToin interfaceGVTFont
-
createGlyphVector
public GVTGlyphVector createGlyphVector(java.awt.font.FontRenderContext frc, char[] chars)
Returns a new GlyphVector object created with the specified array of characters and the specified FontRenderContext.- Specified by:
createGlyphVectorin interfaceGVTFont
-
createGlyphVector
public GVTGlyphVector createGlyphVector(java.awt.font.FontRenderContext frc, java.text.CharacterIterator ci)
Returns a new GlyphVector object created with the specified CharacterIterator and the specified FontRenderContext.- Specified by:
createGlyphVectorin interfaceGVTFont
-
createGlyphVector
public GVTGlyphVector createGlyphVector(java.awt.font.FontRenderContext frc, int[] glyphCodes, java.text.CharacterIterator ci)
Returns a new GlyphVector object created with the specified integer array and the specified FontRenderContext.- Specified by:
createGlyphVectorin interfaceGVTFont
-
createGlyphVector
public GVTGlyphVector createGlyphVector(java.awt.font.FontRenderContext frc, java.lang.String str)
Returns a new GlyphVector object created with the specified String and the specified FontRenderContext.- Specified by:
createGlyphVectorin interfaceGVTFont
-
deriveFont
public GVTFont deriveFont(float size)
Creates a new Font object by replicating the current Font object and applying a new size to it.- Specified by:
deriveFontin interfaceGVTFont
-
getFamilyName
public java.lang.String getFamilyName()
Description copied from interface:GVTFontReturns the font family name of this font.- Specified by:
getFamilyNamein interfaceGVTFont
-
getLineMetrics
public GVTLineMetrics getLineMetrics(char[] chars, int beginIndex, int limit, java.awt.font.FontRenderContext frc)
Returns a LineMetrics object created with the specified arguments.- Specified by:
getLineMetricsin interfaceGVTFont
-
getLineMetrics
public GVTLineMetrics getLineMetrics(java.text.CharacterIterator ci, int beginIndex, int limit, java.awt.font.FontRenderContext frc)
Returns a GVTLineMetrics object created with the specified arguments.- Specified by:
getLineMetricsin interfaceGVTFont
-
getLineMetrics
public GVTLineMetrics getLineMetrics(java.lang.String str, java.awt.font.FontRenderContext frc)
Returns a GVTLineMetrics object created with the specified String and FontRenderContext.- Specified by:
getLineMetricsin interfaceGVTFont
-
getLineMetrics
public GVTLineMetrics getLineMetrics(java.lang.String str, int beginIndex, int limit, java.awt.font.FontRenderContext frc)
Returns a GVTLineMetrics object created with the specified arguments.- Specified by:
getLineMetricsin interfaceGVTFont
-
getSize
public float getSize()
Returns the size of this font.
-
getHKern
public float getHKern(int glyphCode1, int glyphCode2)Returns the horizontal kerning value for this glyph pair.
-
getVKern
public float getVKern(int glyphCode1, int glyphCode2)Returns the vertical kerning value for this glyph pair.
-
getGlyphGeometry
public static AWTGlyphGeometryCache.Value getGlyphGeometry(AWTGVTFont font, char c, java.awt.font.GlyphVector gv, int glyphIndex, java.awt.geom.Point2D glyphPos)
Returns the geometry of the specified character. This method also put the in cache the geometry associated to the specified character if needed.
-
initializeFontCache
static void initializeFontCache(java.awt.Font awtFont)
-
putAWTGVTFont
static void putAWTGVTFont(AWTGVTFont font)
-
getAWTGVTFont
static AWTGVTFont getAWTGVTFont(java.awt.Font awtFont)
-
-