java命名空间java.awt类font的类成员方法:
getstringbounds定义及介绍
本文导语:
getstringbounds
public rectangle2d getstringbounds(string str,
int beginindex,
int limit,
fontrendercontext frc)
返回指定 fontrendercontext 中指定 string 的逻辑边界。逻辑边...
getstringbounds
public rectangle2d getstringbounds(string str,
int beginindex,
int limit,
fontrendercontext frc)
- 返回指定
fontrendercontext 中指定 string 的逻辑边界。逻辑边界包含 origin、ascent、advance 和 height,其中包括了 leading。逻辑边界并不总是包围所有文本。例如,在某些语言和字体中,accent 标记可以位于 ascent 之上,或 descent 之下。要得到可视的边界框(它包围了所有文本),可以使用 textlayout 的 getbounds 方法。
注:返回的边界在相对于基线的坐标中(请参阅 class notes)。
- 参数:
str - 指定的 stringbeginindex - str 的初始偏移量limit - str 的结束偏移量frc - 指定的 fontrendercontext
- 返回:
- 一个
rectangle2d,它是指定 fontrendercontext 中指定 string 的边界框。
- 抛出:
indexoutofboundsexception - 如果 beginindex 小于零,或 limit 大于 str 的长度,或 beginindex 大于 limit。- 从以下版本开始:
- 1.2
- 另请参见:
fontrendercontext,
createglyphvector(java.awt.font.fontrendercontext, java.lang.string)