所有类


java.awt.font
类 GraphicAttribute

java.lang.Object
  继承者 java.awt.font.GraphicAttribute
直接已知子类:
ImageGraphicAttribute, ShapeGraphicAttribute

public abstract class GraphicAttribute
   
   
   
   
   
extends Object

此类与 CHAR_REPLACEMENT 属性一起使用。

GraphicAttribute 类表示文本中内嵌的图形。客户端创建此类的子类,以实现其自身的 char 替换图形。要在文本中嵌入形状和图像的客户端不必创建此类的子类。相反,客户端可以使用 ShapeGraphicAttributeImageGraphicAttribute 类。

子类必须确保对象一经构造就不可修改。该变 TextLayout 中使用的 GraphicAttribute 会导致 TextLayout 的不确定行为。


字段摘要
static intBOTTOM_ALIGNMENT
          将图形底部与行的底部对齐。
static intCENTER_BASELINE
          将图形的原点与行的中心基线对齐。
static intHANGING_BASELINE
          将图形的原点与行的悬挂基线对齐。
static intROMAN_BASELINE
          将图形的原点与行的罗马字体基线对齐。
static intTOP_ALIGNMENT
          将图形顶端与行的顶端对齐。
 
构造方法摘要
protected GraphicAttribute(int alignment)
          构造一个 GraphicAttribute
 
方法摘要
abstract  voiddraw(Graphics2D graphics, float x, float y)
          在指定的位置呈现此 GraphicAttribute
abstract  floatgetAdvance()
          返回此 GraphicAttribute 的 advance。
 intgetAlignment()
          返回此 GraphicAttribute 的对齐方式。
abstract  floatgetAscent()
          返回此 GraphicAttribute 的 ascent。
 Rectangle2DgetBounds()
          返回包括所有位的 Rectangle2D,这些位由与呈现位置相关的 GraphicAttribute 绘制。
abstract  floatgetDescent()
          返回此 GraphicAttribute 的 descent。
 GlyphJustificationInfogetJustificationInfo()
          返回此 GraphicAttribute 的调整信息。
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

字段详细信息

TOP_ALIGNMENT

public static final int TOP_ALIGNMENT
将图形顶端与行的顶端对齐。

另请参见:
常量字段值

BOTTOM_ALIGNMENT

public static final int BOTTOM_ALIGNMENT
将图形底部与行的底部对齐。

另请参见:
常量字段值

ROMAN_BASELINE

public static final int ROMAN_BASELINE
将图形的原点与行的罗马字体基线对齐。

另请参见:
常量字段值

CENTER_BASELINE

public static final int CENTER_BASELINE
将图形的原点与行的中心基线对齐。

另请参见:
常量字段值

HANGING_BASELINE

public static final int HANGING_BASELINE
将图形的原点与行的悬挂基线对齐。

另请参见:
常量字段值
构造方法详细信息

GraphicAttribute

protected GraphicAttribute(int alignment)
构造一个 GraphicAttribute。子类使用此构造方法来定义图形的对齐方式。

参数:
alignment - 表示某个 GraphicAttribute 对齐字段的 int 值。
方法详细信息

getAscent

public abstract float getAscent()
返回此 GraphicAttribute 的 ascent。图形可以在其 ascent 之上呈现。

返回:
GraphicAttribute 的 ascent。
另请参见:
getBounds()

getDescent

public abstract float getDescent()
返回此 GraphicAttribute 的 descent。图形可以在其 descent 之下呈现。

返回:
GraphicAttribute 的 descent。
另请参见:
getBounds()

getAdvance

public abstract float getAdvance()
返回此 GraphicAttribute 的 advance。GraphicAttribute 对象的 advance 是呈现该图形的点与呈现下一个字符或图形的点之间的距离。图形可以呈现在其 advance 之外。

返回:
GraphicAttribute 的 advance。
另请参见:
getBounds()