- java.lang.Object
-
- java.awt.font.GlyphVector
-
- 实现的所有接口
-
Cloneable
public abstract class GlyphVector extends Object implements Cloneable
GlyphVector对象是包含几何信息的字形集合,用于在变换的坐标空间中放置每个字形,该坐标空间对应于最终显示GlyphVector的设备。GlyphVector不会尝试对其包含的字形序列进行任何解释。 序列中相邻字形之间的关系仅用于确定字形在视觉坐标空间中的位置。实例
GlyphVector由Font创建。在可以缓存文本的中间表示的文本处理应用程序中,在渲染期间使用的
GlyphVector创建和后续缓存是向用户呈现字符的可视表示的最快方法。GlyphVector只与一个Font相关联,并且可以提供仅与此Font。 此外,从GlyphVector获得的GlyphVector通常不具有几何可缩放性,因为像素化和间距取决于Font网格拟合算法。 为了便于精确测量GlyphVector及其组件字形,您必须在创建GlyphVector时指定缩放变换,GlyphVector锯齿模式和小数度量模式。 这些特征可以从目标设备导出。对于
GlyphVector每个字形,您可以获得:- 字形的位置
- 与字形相关的变换
-
GlyphVector上下文中字形的度量标准。 在不同的变换,应用程序指定的渲染提示以及GlyphVector内的字形的特定实例下,字形的度量可能不同。
改变用于创建数据
GlyphVector不会改变的状态GlyphVector。提供了用于调整
GlyphVector内的字形位置的GlyphVector。 这些方法最适合于为字形表示执行调整操作的应用程序。提供了用于转换
GlyphVector内的各个字形的GlyphVector。 这些方法主要用于特殊效果。提供一些方法以返回两个整个的视觉,逻辑和像素范围
GlyphVector的内或各个字形的GlyphVector。提供一些方法以返回
Shape为GlyphVector,并为中各个字形GlyphVector。- 另请参见:
-
Font,GlyphMetrics,TextLayout
-
-
字段汇总
字段 变量和类型 字段 描述 static intFLAG_COMPLEX_GLYPHS与getLayoutFlags一起使用的标志,指示此GlyphVector具有复杂的字形到字符映射(不会将字形映射到字符一对一,严格按升序或降序匹配运行方向)。static intFLAG_HAS_POSITION_ADJUSTMENTS与getLayoutFlags一起使用的标志,指示此GlyphVector具有位置调整。static intFLAG_HAS_TRANSFORMS与getLayoutFlags一起使用的标志,指示此GlyphVector具有每个字形转换。static intFLAG_MASK来自getLayoutFlags的受支持标志的掩码。static intFLAG_RUN_RTL与getLayoutFlags一起使用的标志,指示此GlyphVector具有从右到左的运行方向。
-
构造方法摘要
构造方法 构造器 描述 GlyphVector()
-
方法摘要
所有方法 实例方法 抽象方法 具体的方法 变量和类型 方法 描述 abstract booleanequals(GlyphVector set)测试指定的GlyphVector是否与此GlyphVector完全相同。abstract FontgetFont()返回与Font相关联的GlyphVector。abstract FontRenderContextgetFontRenderContext()返回与GlyphVector相关联的GlyphVector。intgetGlyphCharIndex(int glyphIndex)返回指定字形的字符索引。int[]getGlyphCharIndices(int beginGlyphIndex, int numEntries, int[] codeReturn)返回指定字形的字符索引。abstract intgetGlyphCode(int glyphIndex)返回指定字形的字形码。abstract int[]getGlyphCodes(int beginGlyphIndex, int numEntries, int[] codeReturn)返回指定字形的字形数组。abstract GlyphJustificationInfogetGlyphJustificationInfo(int glyphIndex)将指定索引处的字形的对齐信息返回到此GlyphVector。abstract ShapegetGlyphLogicalBounds(int glyphIndex)返回此GlyphVector指定字形的逻辑边界。abstract GlyphMetricsgetGlyphMetrics(int glyphIndex)将指定索引处的字形的度量返回到此GlyphVector。abstract ShapegetGlyphOutline(int glyphIndex)返回Shape其内部对应于此GlyphVector指定字形的可视表示GlyphVector。ShapegetGlyphOutline(int glyphIndex, float x, float y)返回Shape其内部对应于此GlyphVector指定字形的可视表示GlyphVector,偏移到x,y。RectanglegetGlyphPixelBounds(int index, FontRenderContext renderFRC, float x, float y)当这个返回index字形的像素范围GlyphVector在渲染Graphics给定FontRenderContext在给定位置。abstract Point2DgetGlyphPosition(int glyphIndex)返回指定字形相对于此GlyphVector的原点的GlyphVector。abstract float[]getGlyphPositions(int beginGlyphIndex, int numEntries, float[] positionReturn)返回指定字形的字形位置数组。abstract AffineTransformgetGlyphTransform(int glyphIndex)返回此GlyphVector指定字形的变换。abstract ShapegetGlyphVisualBounds(int glyphIndex)返回GlyphVector指定字形的可视边界。intgetLayoutFlags()返回描述GlyphVector全局状态的标志。abstract Rectangle2DgetLogicalBounds()返回此GlyphVector的逻辑边界。abstract intgetNumGlyphs()返回此GlyphVector的字形数。abstract ShapegetOutline()返回Shape其内部对应于此GlyphVector的可视化表示GlyphVector。abstract ShapegetOutline(float x, float y)返回Shape其内部对应于在x,y渲染时此GlyphVector的可视表示形式。RectanglegetPixelBounds(FontRenderContext renderFRC, float x, float y)在给定位置给定FontRenderContext的图形中渲染时,返回此GlyphVector的像素范围。abstract Rectangle2DgetVisualBounds()返回此视觉边界GlyphVector可视边界是此GlyphVector的轮廓的边界框。abstract voidperformDefaultLayout()为此GlyphVector每个字形分配默认位置。abstract voidsetGlyphPosition(int glyphIndex, Point2D newPos)设置此GlyphVector指定字形的位置。abstract voidsetGlyphTransform(int glyphIndex, AffineTransform newTX)设置此GlyphVector指定字形的变换。
-
-
-
字段详细信息
-
FLAG_HAS_TRANSFORMS
public static final int FLAG_HAS_TRANSFORMS
与getLayoutFlags一起使用的标志,指示此GlyphVector具有每个字形转换。- 从以下版本开始:
- 1.4
- 另请参见:
- 常数字段值
-
FLAG_HAS_POSITION_ADJUSTMENTS
public static final int FLAG_HAS_POSITION_ADJUSTMENTS
与getLayoutFlags一起使用的标志,指示此GlyphVector具有位置调整。 如果是这样,则字形位置与字形的累积默认提前量不匹配(例如,如果已完成字距调整)。- 从以下版本开始:
- 1.4
- 另请参见:
- 常数字段值
-
FLAG_RUN_RTL
public static final int FLAG_RUN_RTL
与getLayoutFlags一起使用的标志,指示此GlyphVector具有从右到左的运行方向。 这指的是字形到字符的映射,并不意味着字形的视觉位置必然按此顺序排列,尽管通常它们都是这样。- 从以下版本开始:
- 1.4
- 另请参见:
- 常数字段值
-
FLAG_COMPLEX_GLYPHS
public static final int FLAG_COMPLEX_GLYPHS
与getLayoutFlags一起使用的标志,指示此GlyphVector具有复杂的字形到字符映射(不会将字形映射到字符一对一,严格按升序或降序匹配运行方向)。- 从以下版本开始:
- 1.4
- 另请参见:
- 常数字段值
-
FLAG_MASK
public static final int FLAG_MASK
来自getLayoutFlags的受支持标志的掩码。 只应测试掩码覆盖的位。- 从以下版本开始:
- 1.4
- 另请参见:
- 常数字段值
-
-
方法详细信息
-
getFont
public abstract Font getFont()
返回与Font相关联的GlyphVector。- 结果
-
Font用于创建此图GlyphVector。 - 另请参见:
-
Font
-
getFontRenderContext
public abstract FontRenderContext getFontRenderContext()
返回与GlyphVector相关联的GlyphVector。- 结果
-
FontRenderContext用于创建此图GlyphVector。 - 另请参见:
-
FontRenderContext,Font
-
performDefaultLayout
public abstract void performDefaultLayout()
为此GlyphVector每个字形分配默认位置。 这可能会破坏在此GlyphVector初始布局期间生成的信息。
-
getNumGlyphs
public abstract int getNumGlyphs()
返回此GlyphVector的字形数。- 结果
-
此
GlyphVector的字形数。
-
getGlyphCode
public abstract int getGlyphCode(int glyphIndex)
返回指定字形的字形码。 除了创建此GlyphVector的Font对象之外,此返回值没有任何意义。- 参数
-
glyphIndex- 此GlyphVector的索引,对应于从中检索字形码的字形。 - 结果
-
指定的glyphIndex处的字形的字形
glyphIndex。 - 异常
-
IndexOutOfBoundsException- 如果glyphIndex小于等于或等于此GlyphVector的字形数
-
getGlyphCodes
public abstract int[] getGlyphCodes(int beginGlyphIndex, int numEntries, int[] codeReturn)返回指定字形的字形数组。Font用于创建此GlyphVector的Font之外,此返回值的内容没有任何意义。 在处理字形码时,此方法用于方便和性能。 如果未传入任何数组,则会创建一个新数组。- 参数
-
beginGlyphIndex- 此GlyphVector的索引,可以从中检索字形码 -
numEntries- 要检索的glyphcodes数 -
codeReturn- 接收字形码然后返回的数组 - 结果
- 指定字形的一组字形码。
- 异常
-
IllegalArgumentException- 如果numEntries小于0 -
IndexOutOfBoundsException- 如果beginGlyphIndex小于0 -
IndexOutOfBoundsException-如果总和beginGlyphIndex和numEntries比字形的这个数越大GlyphVector
-
getGlyphCharIndex
public int getGlyphCharIndex(int glyphIndex)
返回指定字形的字符索引。 字符索引是由字形表示的第一个逻辑字符的索引。 默认实现假设字形从一对一,从左到右映射到字符。- 参数
-
glyphIndex- 字形的索引 - 结果
- 由字形表示的第一个字符的索引
- 从以下版本开始:
- 1.4
-
getGlyphCharIndices
public int[] getGlyphCharIndices(int beginGlyphIndex, int numEntries, int[] codeReturn)返回指定字形的字符索引。 字符索引是由字形表示的第一个逻辑字符的索引。 索引以字形顺序返回。 默认实现为每个字形调用getGlyphCharIndex,由于性能原因,子类可能希望覆盖此实现。 使用此方法可以方便地处理字形码。 如果未传入任何数组,则会创建一个新数组。- 参数
-
beginGlyphIndex- 第一个字形的索引 -
numEntries- 字形索引的数量 -
codeReturn- 要返回字符索引的数组 - 结果
- 一个字符索引数组,每个字形一个。
- 从以下版本开始:
- 1.4
-
getLogicalBounds
public abstract Rectangle2D getLogicalBounds()
返回此GlyphVector的逻辑边界。 将GlyphVector定位到视觉上相邻的GlyphVector对象时,使用此方法。- 结果
-
一个
Rectangle2D,它是此的逻辑边界GlyphVector。
-
getVisualBounds
public abstract Rectangle2D getVisualBounds()
返回此视觉边界GlyphVector可视边界是此GlyphVector轮廓的边界框。 由于光栅化和像素对齐,此框可能不会包含受渲染此影响的所有像素GlyphVector。- 结果
-
a
Rectangle2D是GlyphVector。
-
getPixelBounds
public Rectangle getPixelBounds(FontRenderContext renderFRC, float x, float y)
在给定位置给定FontRenderContext的图形中渲染时,返回此GlyphVector的像素范围。 renderFRC不必与FontRenderContext的GlyphVector,并且可以为null。 如果为null,则使用FontRenderContext的GlyphVector。 默认实现返回可视边界,偏移到x,y并四舍五入到下一个整数值(即返回包含可视边界的整数矩形)并忽略FRC。 子类应该覆盖这种方法。- 参数
-
renderFRC-FontRenderContext的Graphics。 -
x- 呈现此GlyphVector的x坐标。 -
y- 呈现此GlyphVector的y坐标。 - 结果
-
a
Rectangle限制将受影响的像素。 - 从以下版本开始:
- 1.4
-
getOutline
public abstract Shape getOutline()
返回Shape其内部区域与此的可视化表示GlyphVector。- 结果
-
一个
Shape就是这个轮廓GlyphVector。
-
getOutline
public abstract Shape getOutline(float x, float y)
返回Shape其内部对应于在x,y渲染时此GlyphVector的直观表示。- 参数
-
x- 这个GlyphVector的X坐标。 -
y- 这个GlyphVector的Y坐标。 - 结果
-
a
Shape,这是在指定坐标处渲染时的GlyphVector的轮廓。
-
getGlyphOutline
public abstract Shape getGlyphOutline(int glyphIndex)
返回Shape其内部对应于此GlyphVector指定字形的可视表示GlyphVector。 此方法返回的轮廓位于每个单独字形的原点周围。- 参数
-
glyphIndex- 这个GlyphVector的索引 - 结果
-
一个
Shape这是在指定的字形轮廓glyphIndex如此GlyphVector。 - 异常
-
IndexOutOfBoundsException- 如果glyphIndex小于等于或等于此GlyphVector的字形数
-
getGlyphOutline
public Shape getGlyphOutline(int glyphIndex, float x, float y)
返回Shape其内部对应于此GlyphVector指定字形的可视表示GlyphVector,偏移到x,y。 此方法返回的轮廓位于每个单独字形的原点周围。- 参数
-
glyphIndex- 这个GlyphVector的索引 -
x- 此GlyphVector的位置的X坐标 -
y- 此GlyphVector的位置的Y坐标 - 结果
-
a
Shape,这是在指定坐标处渲染时在GlyphVector指定的glyphIndex处的字形轮廓。 - 异常
-
IndexOutOfBoundsException- 如果glyphIndex小于等于或等于此GlyphVector的字形数 - 从以下版本开始:
- 1.4
-
getGlyphPosition
public abstract Point2D getGlyphPosition(int glyphIndex)
返回指定字形相对于此GlyphVector的原点的GlyphVector。 如果glyphIndex于此GlyphVector的字形数,则此方法返回最后一个字形后的位置。 此位置用于定义整个GlyphVector。- 参数
-
glyphIndex- 这个GlyphVector的索引 - 结果
-
一个
Point2D对象,它是指定的glyphIndex处字形的位置。 - 异常
-
IndexOutOfBoundsException- 如果glyphIndex小于0或大于GlyphVector的字形数 - 另请参见:
-
setGlyphPosition(int, java.awt.geom.Point2D)
-
setGlyphPosition
public abstract void setGlyphPosition(int glyphIndex, Point2D newPos)设置此GlyphVector指定字形的位置。 如果glyphIndex于此GlyphVector的字形数,则此方法将设置最后一个字形后的位置。 此位置用于定义整个GlyphVector。- 参数
-
glyphIndex- 这个GlyphVector的索引 -
newPos-Point2D,用于将字形定位在指定的glyphIndex - 异常
-
IndexOutOfBoundsException- 如果glyphIndex小于或大于GlyphVector的字形数 - 另请参见:
-
getGlyphPosition(int)
-
getGlyphTransform
public abstract AffineTransform getGlyphTransform(int glyphIndex)
返回此GlyphVector指定字形的变换。 变换与字形位置有关。 如果未应用特殊变换,null可以返回null。 空返回表示身份转换。- 参数
-
glyphIndex- 这个GlyphVector的索引 - 结果
-
一个
AffineTransform,它是指定的glyphIndex字形的变换。 - 异常
-
IndexOutOfBoundsException- 如果glyphIndex小于等于或等于此GlyphVector的字形数 - 另请参见:
-
setGlyphTransform(int, java.awt.geom.AffineTransform)
-
setGlyphTransform
public abstract void setGlyphTransform(int glyphIndex, AffineTransform newTX)设置此GlyphVector指定字形的变换。 变换与字形位置有关。 甲null参数为newTX表示被应用于指定字形没有特殊的变换。 此方法可用于旋转,镜像,平移和缩放字形。 添加转换可能会导致显着的性能变化。- 参数
-
glyphIndex- 这个GlyphVector的索引 -
newTX- 字形的新变换glyphIndex - 异常
-
IndexOutOfBoundsException- 如果glyphIndex小于等于或等于此GlyphVector的字形数 - 另请参见:
-
getGlyphTransform(int)
-
getLayoutFlags
public int getLayoutFlags()
返回描述GlyphVector全局状态的标志。 下面未描述的标志是保留的。 默认实现为位置调整,变换,rtl和复杂标志返回0(表示为false)。 子类应重写此方法,并确保它正确描述GlyphVector并对应于相关调用的结果。- 结果
- 包含描述状态的标志的int
- 从以下版本开始:
- 1.4
- 另请参见:
-
FLAG_HAS_POSITION_ADJUSTMENTS,FLAG_HAS_TRANSFORMS,FLAG_RUN_RTL,FLAG_COMPLEX_GLYPHS,FLAG_MASK
-
getGlyphPositions
public abstract float[] getGlyphPositions(int beginGlyphIndex, int numEntries, float[] positionReturn)返回指定字形的字形位置数组。 在处理字形位置时,此方法用于方便和性能。 如果未传入任何数组,则会创建一个新数组。 从位置0开始的偶数编号的条目是编号为beginGlyphIndex + position/2的字形的X坐标。 以位置1开始的奇数编号的数组条目是编号为beginGlyphIndex + (position-1)/2的字形的Y坐标。 如果beginGlyphIndex于此GlyphVector的字形数,则此方法获取最后一个字形后的位置,此位置用于定义整个GlyphVector。- 参数
-
beginGlyphIndex- 开始检索字形位置的索引 -
numEntries- 要检索的字形数 -
positionReturn- 接收字形位置的数组,然后返回。 - 结果
-
由
beginGlyphIndex和numEntries指定的字形位置数组。 - 异常
-
IllegalArgumentException- 如果numEntries小于0 -
IndexOutOfBoundsException- 如果beginGlyphIndex小于0 -
IndexOutOfBoundsException- 如果beginGlyphIndex和numEntries的总和大于此GlyphVector一个字形数加一
-
getGlyphLogicalBounds
public abstract Shape getGlyphLogicalBounds(int glyphIndex)
返回此GlyphVector指定字形的逻辑边界。 这些逻辑边界总共有四条边,其中两条边与字形变换下的基线平行,另外两条边与相邻的字形共享(如果存在)。 此方法对于指定字形的命中测试,在字形的前沿或后端定位插入符以及在指定字形周围绘制高亮区域非常有用。- 参数
-
glyphIndex- 此GlyphVector的索引,对应于从中检索其逻辑边界的字形 - 结果
-
a
Shape,它是指定的glyphIndex处字形的逻辑边界。 - 异常
-
IndexOutOfBoundsException- 如果glyphIndex小于等于或等于此GlyphVector的字形数 - 另请参见:
-
getGlyphVisualBounds(int)
-
getGlyphVisualBounds
public abstract Shape getGlyphVisualBounds(int glyphIndex)
返回GlyphVector指定字形的可视边界。 此方法返回的边界位于每个字形的原点周围。- 参数
-
glyphIndex- 此GlyphVector的索引,对应于从中检索其可视范围的字形 - 结果
-
a
Shape,它是指定的glyphIndex处字形的视觉边界。 - 异常
-
IndexOutOfBoundsException- 如果glyphIndex小于等于或等于此GlyphVector的字形数 - 另请参见:
-
getGlyphLogicalBounds(int)
-
getGlyphPixelBounds
public Rectangle getGlyphPixelBounds(int index, FontRenderContext renderFRC, float x, float y)
当这个返回index字形的像素范围GlyphVector在渲染Graphics给定FontRenderContext在给定位置。 renderFRC不必与FontRenderContext的GlyphVector,也可以为null。 如果为null,则使用FontRenderContext的GlyphVector。 默认实现返回字形的可视边界,偏移到x,y并四舍五入到下一个整数值,并忽略FRC。 子类应该覆盖这种方法。- 参数
-
index- 字形的索引。 -
renderFRC-FontRenderContext的Graphics。 -
x- 呈现此GlyphVector的X位置。 -
y- 呈现此GlyphVector的Y位置GlyphVector。 - 结果
-
a
Rectangle限制将受影响的像素。 - 从以下版本开始:
- 1.4
-
getGlyphMetrics
public abstract GlyphMetrics getGlyphMetrics(int glyphIndex)
将指定索引处的字形的度量返回到此GlyphVector。- 参数
-
glyphIndex- 此GlyphVector的索引,对应于从中检索其度量标准的字形 - 结果
-
一个
GlyphMetrics对象,表示此GlyphVector指定的glyphIndex处的字形的度量。 - 异常
-
IndexOutOfBoundsException- 如果glyphIndex小于等于或等于此GlyphVector的字形数
-
getGlyphJustificationInfo
public abstract GlyphJustificationInfo getGlyphJustificationInfo(int glyphIndex)
将指定索引处的字形的对齐信息返回到此GlyphVector。- 参数
-
glyphIndex- 此GlyphVector的索引,对应于从中检索其对齐属性的字形 - 结果
-
一个
GlyphJustificationInfo对象,它表示此GlyphVector指定的glyphIndex处的字形的对齐属性。 - 异常
-
IndexOutOfBoundsException- 如果glyphIndex小于等于或等于此GlyphVector的字形数
-
equals
public abstract boolean equals(GlyphVector set)
测试指定的GlyphVector是否与此GlyphVector完全相同。- 参数
-
set- 要测试的指定GlyphVector - 结果
-
true若指定的GlyphVector于此GlyphVector; 否则为false。
-
-