public final class TextLayout extends Object implements Cloneable
TextLayout是风格的字符数据不变的图形表示。
它提供了以下功能:
一个TextLayout对象可以使用其draw方法呈现。
TextLayout可以直接或通过一个LineBreakMeasurer建成使用。当直接构造时,源文本表示一个单独的段落。LineBreakMeasurer允许样式文本被分解成适合特定宽度内的线。更多信息参见LineBreakMeasurer文档。
TextLayout建设逻辑过程如下:
TextAttribute.FONT是目前使用的字体,否则通过计算一个默认字体使用已定义的属性从TextLayout对象的方法返回的所有图形信息是相对的TextLayout的起源,这是与它的左边缘的TextLayout对象的基线相交。同时,坐标传递到TextLayout对象的方法被认为是相对于TextLayout物体的起源。客户通常需要翻译TextLayout对象的坐标系统和坐标系统之间的另一个对象(如一个Graphics对象)。
TextLayout对象被构造样式的文本,但他们没有一个参考源文本保留。因此,在以前用来生成一个TextLayout文本的变化不影响TextLayout。
三种方法在TextLayout对象(getNextRightHit,getNextLeftHit,和hitTestChar)的TextHitInfo返回实例。在这些TextHitInfo对象中的偏移量是相对的TextLayout开始,不用于创建TextLayout文本。同样,TextLayout方法接受TextHitInfo实例作为参数的期望TextHitInfo对象的偏移量是相对的TextLayout,没有任何潜在的文本存储模型。
实例:
构建和绘制TextLayout及其边框:
Graphics2D g = ...;
Point2D loc = ...;
Font font = Font.getFont("Helvetica-bold-italic");
FontRenderContext frc = g.getFontRenderContext();
TextLayout layout = new TextLayout("This is a string", font, frc);
layout.draw(g, (float)loc.getX(), (float)loc.getY());
Rectangle2D bounds = layout.getBounds();
bounds.setRect(bounds.getX()+loc.getX(),
bounds.getY()+loc.getY(),
bounds.getWidth(),
bounds.getHeight());
g.draw(bounds);
命中测试TextLayout(确定哪些特征是在一个特定的图形位置):
Point2D click = ...;
TextHitInfo hit = layout.hitTestChar(
(float) (click.getX() - loc.getX()),
(float) (click.getY() - loc.getY()));
响应右箭头键:
int insertionIndex = ...;
TextHitInfo next = layout.getNextRightHit(insertionIndex);
if (next != null) {
// translate graphics to origin of layout on screen
g.translate(loc.getX(), loc.getY());
Shape[] carets = layout.getCaretShapes(next.getInsertionIndex());
g.draw(carets[0]);
if (carets[1] != null) {
g.draw(carets[1]);
}
}
图中对应于源文本字符串的选择范围。选定区域可能无法在视觉上连续:
// selStart, selLimit should be relative to the layout, // not to the source text int selStart = ..., selLimit = ...; Color selectionColor = ...; Shape selection = layout.getLogicalHighlightShape(selStart, selLimit); // selection may consist of disjoint areas // graphics is assumed to be tranlated to origin of layout g.setColor(selectionColor); g.fill(selection);
绘制一个视觉上连续的选择范围。选择范围可以对应于原文中的一个以上的子串。相应的源文本子字符串的范围可以得到getLogicalRangesForVisualSelection():
注:字体的旋转可以使文本基线进行旋转,并与不同的旋转多个运行会导致基线弯曲或曲折。为了解释这个(罕见)的可能性,一些API返回指定指标和基线相对坐标带参数”(如提升、推进),和其他人在“标准坐标(例如getBounds)。在基线相对坐标图的值的“X”坐标沿基线的距离,(正X向前沿基线),和“Y”坐标到垂直于基线的距离在“X”(正Y是从基线向量顺时针方向90度)。在标准坐标值沿X轴和Y轴的测量,在用0、起源。为每个相关的接口的文档表示什么值是在什么坐标系统。在一般情况下,测量相关的原料药是在基线的相对坐标,而显示相关的原料药在标准的坐标。
| Modifier and Type | Class and Description |
|---|---|
static class |
TextLayout.CaretPolicy
定义了一个确定的强符号定位策略。
|
| Modifier and Type | Field and Description |
|---|---|
static TextLayout.CaretPolicy |
DEFAULT_CARET_POLICY
这
CaretPolicy时使用的政策不是由客户指定。
|
| Constructor and Description |
|---|
TextLayout(AttributedCharacterIterator text, FontRenderContext frc)
构建从样式文本迭代器的一个
TextLayout。
|
TextLayout(String string, Font font, FontRenderContext frc)
|
TextLayout(String string, Map<? extends AttributedCharacterIterator.Attribute,?> attributes, FontRenderContext frc)
构建了从
String和一个属性
TextLayout集。
|
| Modifier and Type | Method and Description |
|---|---|
protected Object |
clone()
复制这
TextLayout。
|
void |
draw(Graphics2D g2, float x, float y)
这
TextLayout呈现在指定的
Graphics2D上下文指定位置。
|
boolean |
equals(Object obj)
返回
true如果指定
Object是
TextLayout对象,如果指定的
Object等于这
TextLayout。
|
boolean |
equals(TextLayout rhs)
返回
true如果两种布局都是平等的。
|
float |
getAdvance()
返回该
TextLayout前进。
|
float |
getAscent()
返回该
TextLayout上升。
|
byte |
getBaseline()
返回此
TextLayout基线。
|
float[] |
getBaselineOffsets()
返回用于此
TextLayout基线偏移阵列。
|
Shape |
getBlackBoxBounds(int firstEndpoint, int secondEndpoint)
返回指定范围内的字符的黑框范围。
|
Rectangle2D |
getBounds()
返回该
TextLayout界限。
|
float[] |
getCaretInfo(TextHitInfo hit)
返回对应于
hit插入符号信息。
|
float[] |
getCaretInfo(TextHitInfo hit, Rectangle2D bounds)
返回对应于
hit插入符号信息。
|
Shape |
getCaretShape(TextHitInfo hit)
返回一个
Shape代表在指定的打在这
TextLayout自然界的符号。
|
Shape |
getCaretShape(TextHitInfo hit, Rectangle2D bounds)
返回一个
Shape代表在指定的打在指定边界的符号。
|
Shape[] |
getCaretShapes(int offset)
返回两个路径对应的强与弱符号。
|
Shape[] |
getCaretShapes(int offset, Rectangle2D bounds)
返回两个路径对应的强与弱符号。
|
Shape[] |
getCaretShapes(int offset, Rectangle2D bounds, TextLayout.CaretPolicy policy)
返回两个路径对应的强与弱符号。
|
int |
getCharacterCount()
这
TextLayout表示返回的字符数。
|
byte |
getCharacterLevel(int index)
返回
index字符的水平。
|
float |
getDescent()
返回该
TextLayout下降。
|
TextLayout |
getJustifiedLayout(float justificationWidth)
复制这
TextLayout对齐到指定的宽度。
|
LayoutPath |
getLayoutPath()
返回layoutpath,或null如果布局路径,默认路径(X图前进,Y图偏移)。
|
float |
getLeading()
返回的
TextLayout领先。
|
Shape |
getLogicalHighlightShape(int firstEndpoint, int secondEndpoint)
返回一个
Shape外围逻辑选择在规定的范围内,延伸到这
TextLayout自然界限。
|
Shape |
getLogicalHighlightShape(int firstEndpoint, int secondEndpoint, Rectangle2D bounds)
返回一个
Shape外围逻辑选择在规定的范围内,扩展到指定的
bounds。
|
int[] |
getLogicalRangesForVisualSelection(TextHitInfo firstEndpoint, TextHitInfo secondEndpoint)
返回对应于一个视觉选择的文本的逻辑范围。
|
TextHitInfo |
getNextLeftHit(int offset)
返回到左下插入命中(上);如果没有这样的打击,返回
null。
|
TextHitInfo |
getNextLeftHit(int offset, TextLayout.CaretPolicy policy)
返回到左下插入命中(上);如果没有这样的打击,返回
null。
|
TextHitInfo |
getNextLeftHit(TextHitInfo hit)
返回到左下插入命中(上);如果没有这样的打击,返回
null。
|
TextHitInfo |
getNextRightHit(int offset)
返回到正确的下一个符号的命中(底部);如果没有这样的打击,返回
null。
|
TextHitInfo |
getNextRightHit(int offset, TextLayout.CaretPolicy policy)
返回到正确的下一个符号的命中(底部);如果没有这样的打击,返回
null。
|
TextHitInfo |
getNextRightHit(TextHitInfo hit)
返回到正确的下一个符号的命中(底部);如果没有这样的打击,返回
null。
|
Shape |
getOutline(AffineTransform tx)
返回一个
Shape表示此
TextLayout概述。
|
Rectangle |
getPixelBounds(FontRenderContext frc, float x, float y)
返回该
TextLayout像素边界时,呈现在一个给定
FontRenderContext在给定位置的图形。
|
float |
getVisibleAdvance()
返回该
TextLayout前进,减去尾随空格。
|
Shape |
getVisualHighlightShape(TextHitInfo firstEndpoint, TextHitInfo secondEndpoint)
返回一个
Shape内附视觉选择在指定的范围,扩展到边界。
|
Shape |
getVisualHighlightShape(TextHitInfo firstEndpoint, TextHitInfo secondEndpoint, Rectangle2D bounds)
返回一个路径包围的视觉选择指定的范围,扩展到
bounds。
|
TextHitInfo |
getVisualOtherHit(TextHitInfo hit)
返回在指定的符号打对方打。
|
protected void |
handleJustify(float justificationWidth)
证明此布局。
|
int |
hashCode()
返回该
TextLayout哈希代码。
|
TextHitInfo |
hitTestChar(float x, float y)
返回对应于指定点
TextHitInfo。
|
TextHitInfo |
hitTestChar(float x, float y, Rectangle2D bounds)
返回对应于指定点
TextHitInfo。
|
void |
hitToPoint(TextHitInfo hit, Point2D point)
在标准坐标中转换一个命中到一个点。
|
boolean |
isLeftToRight()
返回
true如果这
TextLayout有左到右库方向或
false如果有权离开基地的方向。
|
boolean |
isVertical()
返回
true如果这
TextLayout垂直。
|
String |
toString()
返回此
TextLayout调试信息。
|
public static final TextLayout.CaretPolicy DEFAULT_CARET_POLICY
CaretPolicy时使用的政策不是由客户指定。根据这项政策,一个字符的方向为直线方向比在counterdirectional性格强相同的命中命中。如果字符的方向是相同的,一个字符的前缘上的命中强于一个字符的后缘上的命中。
public TextLayout(String string, Font font, FontRenderContext frc)
string -显示文本
font -用来将文本样式
Font
frc -包含一个图形设备,需要正确衡量文本信息。文本的测量可以略有不同的设备分辨率不同,属性如抗锯齿。此参数没有指定
TextLayout和用户空间之间的翻译。
public TextLayout(String string, Map<? extends AttributedCharacterIterator.Attribute,?> attributes, FontRenderContext frc)
String和一个属性
TextLayout集。
所有的文本都使用提供的属性样式。
string必须指定一段文字因为整个段落是双向算法要求。
string -显示文本
attributes -属性用于将文本样式
frc -包含一个图形设备,需要正确衡量文本信息。文本的测量可以略有不同的设备分辨率不同,属性如抗锯齿。此参数没有指定
TextLayout和用户空间之间的翻译。
public TextLayout(AttributedCharacterIterator text, FontRenderContext frc)
TextLayout。
迭代器必须指定一个单独的文本段落,因为双向算法需要一个完整的段落。
text的样式显示文本
frc -包含一个图形设备,需要正确衡量文本信息。文本的测量可以略有不同的设备分辨率不同,属性如抗锯齿。此参数没有指定
TextLayout和用户空间之间的翻译。
protected Object clone()
TextLayout。
public TextLayout getJustifiedLayout(float justificationWidth)
TextLayout对齐到指定的宽度。
如果这TextLayout已经证明,抛出一个异常。如果这TextLayout对象的调整率为零,这一TextLayout TextLayout相同的返回。
justificationWidth -宽度时使用的线的理由。为了最好的结果,它不应该太不同于当前的线的进展。
TextLayout对齐到指定的宽度。
Error如果布局已经合理,抛出一个错误。
protected void handleJustify(float justificationWidth)
一些代码可以依靠immutablity布局。subclassers不应该称之为直接,而是应该叫getjustifiedlayout,将调用此方法在这个布局的一个克隆,保留了原有的。
justificationWidth -宽度时使用的线的理由。为了最好的结果,它不应该太不同于当前的线的进展。
getJustifiedLayout(float)
public byte getBaseline()
TextLayout基线。基线是一个在
Font定义的值,这是罗马,心挂。上升和下降是相对于基线。的
baselineOffsets也相对于基线。
TextLayout基线。
getBaselineOffsets(),
Font
public float[] getBaselineOffsets()
TextLayout基线偏移阵列。
数组中的一Font定义的值的索引,这是罗马,心挂。该值是相对于这TextLayout对象的基线,使getBaselineOffsets[getBaseline()] == 0。偏移量是增加了TextLayout对象的基线位置为新的基线得到的位置。
TextLayout基线偏移阵列。
getBaseline(),
Font
public float getAdvance()
TextLayout前进。提前从起源到最右边的前进的距离(下面的)特征。这是在基线的相对坐标。
TextLayout前进。
public float getVisibleAdvance()
TextLayout前进,减去尾随空格。这是在基线的相对坐标。
TextLayout尾随空格的进展。
getAdvance()
public float getAscent()
TextLayout提升。提升是从顶部的距离(右)的
TextLayout底线。它总是要么是正的或零。提升足以容纳上标文本是对提升、偏移和最大,和每一个字形基线。提升是从、所有文本基线的最大提升。它是在基线的相对坐标。
TextLayout上升。
public float getDescent()
TextLayout下降。下降是从基线到底的距离(左)的
TextLayout。它总是要么是正的或零。的下降足以容纳下标文本是的血统,和最大偏移量,和每一个字形基线。这是从在、所有文本基线的最大下降。它是在基线的相对坐标。
TextLayout下降。
public float getLeading()
TextLayout领导。领导是建议行间这
TextLayout间距。这是在基线的相对坐标。
主要是从领导、血统和基线计算,在TextLayout所有glyphvectors算法大致如下:
maxD = 0;
maxDL = 0;
for (GlyphVector g in all glyphvectors) {
maxD = max(maxD, g.getDescent() + offsets[g.getBaseline()]);
maxDL = max(maxDL, g.getDescent() + g.getLeading() +
offsets[g.getBaseline()]);
}
return maxDL - maxD;
TextLayout领先。
public Rectangle2D getBounds()
TextLayout边界。边界是标准坐标。
由于光栅化的影响,这个范围可能不把所有的、渲染的像素。
它可能无法与上升、下降完全一致,TextLayout的起源或提前。
Rectangle2D是这个
TextLayout界限。
public Rectangle getPixelBounds(FontRenderContext frc, float x, float y)
TextLayout像素边界时,呈现在一个给定
FontRenderContext在给定位置的图形。图形渲染上下文可以用来创建这个
TextLayout的
FontRenderContext相同,并可以为空。如果它是空的,这
TextLayout的
FontRenderContext使用。
frc的
Graphics的
FontRenderContext。
x -位置的x坐标渲染这
TextLayout。
y -在纵坐标绘制这
TextLayout。
Rectangle包围的像素会有影响。
GlyphVector.getPixelBounds(java.awt.font.FontRenderContext, float, float)
public boolean isLeftToRight()
true如果这
TextLayout有左到右库方向或
false如果有权离开基地的方向。的
TextLayout有离开基地方向向右(LTR)或右至左(RTL)。基本方向是独立的文本行的实际方向,这可能是LTR,RTL,或混合。左到右布局默认应位置刷新左。如果布局是一个标签,标签从左到右,所以逻辑上连续的布局位置从左到右。RTL布局相反的是真实的。默认情况下,他们应该位置刷新左,标签右向左运行。
true如果这
TextLayout的基本方向是由左至右;
false否则。
public boolean isVertical()
true如果这
TextLayout垂直。
true
TextLayout垂直;
false否则。
public int getCharacterCount()
TextLayout表示返回的字符数。
TextLayout字符数。
public float[] getCaretInfo(TextHitInfo hit, Rectangle2D bounds)
hit插入信息。该数组的第一个元素是与基准符号的交叉口,沿基线的距离。数组的第二个元素是逆坡(运行/升)的符号,在这一点上的基线测定。
此方法是用于信息的使用。显示插入符,它是更好地使用getCaretShapes。
hit于这个
TextLayout字符击中
bounds的界限,构建了符号信息。边界是在基线的相对坐标。
getCaretShapes(int, Rectangle2D, TextLayout.CaretPolicy),
Font.getItalicAngle()
public float[] getCaretInfo(TextHitInfo hit)
hit插入符号信息。该方法是一
getCaretInfo方便超载和使用这
TextLayout自然界限。
hit于这个
TextLayout字符击中
public TextHitInfo getNextRightHit(TextHitInfo hit)
null。如果打字符索引越界,一个
IllegalArgumentException抛出。
hit于这个布局的性格打
null插入符号。
public TextHitInfo getNextRightHit(int offset, TextLayout.CaretPolicy policy)
null。命中是在指定的偏移量的强符号的权利,由指定的政策决定。返回的命中是强大的两个可能的命中,所确定的指定的政策。
offset -插入抵消这
TextLayout。不能小于0或大于
TextLayout对象的字符数。
policy -用于选择强符号的政策
null。
public TextHitInfo getNextRightHit(int offset)
null。命中是在指定的偏移量的强符号的权利,作为默认的政策决定。返回的命中是强大的两个可能的命中,所确定的默认策略。
offset -插入抵消这
TextLayout。不能小于0或大于
TextLayout对象的字符数。
null。
public TextHitInfo getNextLeftHit(TextHitInfo hit)
null。如果打字符索引越界,一个
IllegalArgumentException抛出。
hit于这个
TextLayout字符击中。
null。
public TextHitInfo getNextLeftHit(int offset, TextLayout.CaretPolicy policy)
null。命中是在指定的偏移量的强标记的左侧,由指定的政策决定。返回的命中是强大的两个可能的命中,所确定的指定的政策。
offset -插入抵消这
TextLayout。不能小于0或大于
TextLayout对象的字符数。
policy -用于选择强符号的政策
null。
public TextHitInfo getNextLeftHit(int offset)
null。命中是在指定的偏移量的强标记的左侧,作为默认的政策决定。返回的命中是强大的两个可能的命中,所确定的默认策略。
offset -插入抵消这
TextLayout。不能小于0或大于
TextLayout对象的字符数。
null。
public TextHitInfo getVisualOtherHit(TextHitInfo hit)
hit -指定打击
public Shape getCaretShape(TextHitInfo hit, Rectangle2D bounds)
Shape代表在指定的打在指定边界的符号。
hit命中生成符号
bounds的
TextLayout使用生成符号的界限。边界是在基线的相对坐标。
Shape代表符号。返回的形状是在标准坐标。
public Shape getCaretShape(TextHitInfo hit)
Shape代表在指定的打在这
TextLayout自然界的符号。
hit命中生成符号
Shape代表符号。返回的形状是在标准坐标。
public byte getCharacterLevel(int index)
index字符的水平。指数1和
characterCount分配这
TextLayout基层。
index -字符,得到水平指标
public Shape[] getCaretShapes(int offset, Rectangle2D bounds, TextLayout.CaretPolicy policy)
offset -在这
TextLayout偏移
bounds的界限,延长克拉。边界是在基线的相对坐标。
policy -指定
CaretPolicy
null。返回的形状是在标准坐标系中的。
public Shape[] getCaretShapes(int offset, Rectangle2D bounds)
getCaretShapes,使用默认的符号政策便利过载。
offset -在这
TextLayout偏移
bounds的界限,延长克拉。这是在基线的相对坐标。
DEFAULT_CARET_POLICY两路。这些都是在标准坐标系中。
public Shape[] getCaretShapes(int offset)
getCaretShapes,使用默认的符号,这
TextLayout政策对象的自然界限。
offset -在这
TextLayout偏移
DEFAULT_CARET_POLICY两路。这些都是在标准坐标系中。
public int[] getLogicalRangesForVisualSelection(TextHitInfo firstEndpoint, TextHitInfo secondEndpoint)
firstEndpoint -视觉范围的一个端点
secondEndpoint -视觉范围的其他端点。这个端点可以小于
firstEndpoint。
getVisualHighlightShape(TextHitInfo, TextHitInfo, Rectangle2D)
public Shape getVisualHighlightShape(TextHitInfo firstEndpoint, TextHitInfo secondEndpoint, Rectangle2D bounds)
bounds。
如果选择包括最左边的(最高)的位置,选择延伸到左(上)的bounds。如果选择包括最右边的(最低)的位置,选择延伸到右侧(底部)的界限。高度(垂直线的宽度)的选择一直延伸到bounds。
虽然选择是连续的,逻辑上选定的文本可以不连续对混合方向的文本行。选定文本的逻辑范围可以检索使用getLogicalRangesForVisualSelection。例如,考虑文本“ABCDEF”,大写字母从右向左的文本,在右至左线渲染,从0可视化选择(前缘')3T(“D”的后缘)。文本显示如下,以大胆的下划线代表选择方面:
defcba逻辑的选择范围是0-3,4-6(ABC,EF)因为视觉连续的文本在逻辑上是不连续的。还注意到,从布局上右边的位置(右边的“A”)被选中,选择延伸边界的权利。
firstEndpoint -视觉选择的一端
secondEndpoint -视觉选择的另一端
bounds的边框来扩展选择。这是在基线的相对坐标。
Shape包围的选择。这是在标准坐标。
getLogicalRangesForVisualSelection(TextHitInfo, TextHitInfo),
getLogicalHighlightShape(int, int, Rectangle2D)
public Shape getVisualHighlightShape(TextHitInfo firstEndpoint, TextHitInfo secondEndpoint)
Shape内附视觉选择在指定的范围,扩展到边界。该方法是一
getVisualHighlightShape使用这
TextLayout自然界方便过载。
firstEndpoint -视觉选择的一端
secondEndpoint -视觉选择的另一端
Shape包围的选择。这是在标准坐标。
public Shape getLogicalHighlightShape(int firstEndpoint, int secondEndpoint, Rectangle2D bounds)
Shape外围逻辑选择在规定的范围内,扩展到指定的
bounds。
如果选择范围包括第一逻辑特征,选择扩展到bounds部分在这TextLayout开始。如果范围包括最后的逻辑特征,选择扩展到bounds部分这TextLayout结束后。高度(垂直线的宽度)的选择一直延伸到bounds。
选择可以不连续对混合方向的文本行。只有在开始和极限之间的逻辑范围内的这些字符出现选择。例如,考虑文本“ABCDEF”,大写字母从右向左的文本,在右至左线呈现,一个合乎逻辑的选择从0到4('abcd”)。文本显示如下,以大胆的站在为选择,并强调:
延伸
Def中国男子篮球职业联赛选择不连续的因为所选字符视觉不连续。还注意到,由于范围包括第一逻辑特征(一),选择扩展到部分的
bounds之前就开始布局,在这种情况下,(右至左线)的
bounds的右边部分。
firstEndpoint在字符范围端点选择
secondEndpoint -汉字的范围选择的另一个端点。可比
firstEndpoint。范围包括最小字符(firstendpoint,secondendpoint),但不包括最大(firstendpoint,secondendpoint)。
bounds的边框来扩展选择。这是在基线的相对坐标。
getVisualHighlightShape(TextHitInfo, TextHitInfo, Rectangle2D)
public Shape getLogicalHighlightShape(int firstEndpoint, int secondEndpoint)
Shape外围逻辑选择在规定的范围内,延伸到这
TextLayout自然界限。该方法是一
getLogicalHighlightShape使用这
TextLayout自然界方便过载。
firstEndpoint在字符范围端点选择
secondEndpoint -汉字的范围选择的另一个端点。可比
firstEndpoint。范围包括在最小的字符(firstendpoint,secondendpoint),但不包括最大(firstendpoint,secondendpoint)。
Shape包围的选择。这是在标准坐标。
public Shape getBlackBoxBounds(int firstEndpoint, int secondEndpoint)
firstEndpoint -字符范围的一端
secondEndpoint -字符范围的另一端。可比
firstEndpoint。
Shape封闭黑盒的界限。这是在标准坐标。
public TextHitInfo hitTestChar(float x, float y, Rectangle2D bounds)
TextHitInfo。坐标以外的
TextLayoutMap范围,点击第一个逻辑字符的前缘或后缘,最后的逻辑特征,适当的,无论该字符的位置线。只有沿着基线的方向是用来做这个评价。
x - X偏离这
TextLayout起源。这是在标准坐标。
y - y的偏移量从本
TextLayout起源。这是在标准坐标。
bounds的
TextLayout界限。这是在基线的相对坐标。
public TextHitInfo hitTestChar(float x, float y)
TextHitInfo。该方法是一
hitTestChar使用这
TextLayout自然界方便过载。
x - X偏离这
TextLayout起源。这是在标准坐标。
y - y的偏移量从本
TextLayout起源。这是在标准坐标。
public int hashCode()
TextLayout哈希代码。
hashCode 方法重写,继承类
Object
TextLayout哈希代码。
Object.equals(java.lang.Object),
System.identityHashCode(java.lang.Object)
public boolean equals(Object obj)
true如果指定
Object是
TextLayout对象,如果指定的
Object等于这
TextLayout。
equals 方法重写,继承类
Object
obj -
Object测试平等
true如果指定
Object等于这
TextLayout;
false否则。
Object.hashCode(),
HashMap
public boolean equals(TextLayout rhs)
true如果两种布局都是平等的。如果它们包含在同一阶等glyphvectors布局等。
rhs -
TextLayout相比这
TextLayout
true如果指定
TextLayout等于这
TextLayout。
public String toString()
TextLayout调试信息。
public void draw(Graphics2D g2, float x, float y)
g2 -
Graphics2D语境,使布局
x -这
TextLayout原点的X坐标
y -这
TextLayout起源的Y坐标
getBounds()
public Shape getOutline(AffineTransform tx)
Shape表示此
TextLayout概述。
tx可选
AffineTransform申请这个
TextLayout概述。
Shape是这个
TextLayout轮廓。这是在标准坐标系。
public LayoutPath getLayoutPath()
public void hitToPoint(TextHitInfo hit, Point2D point)
hit -检查打。这必须是一个有效的打击、。
point -返回点。点在标准坐标系中。
IllegalArgumentException如果击中无效、。
NullPointerException如果击中或是空的。
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved.