textlayout.html

来自「API資料大全」· HTML 代码 · 共 1,381 行 · 第 1/5 页

HTML
1,381
字号
               be cloned.<DD><CODE><A HREF="../../../java/lang/OutOfMemoryError.html">OutOfMemoryError</A></CODE> - if there is not enough memory.<DT><B>See Also: </B><DD><A HREF="../../../java/lang/Cloneable.html"><CODE>Cloneable</CODE></A></DL></DD></DL><HR><A NAME="getJustifiedLayout(float)"><!-- --></A><H3>getJustifiedLayout</H3><PRE>public <A HREF="../../../java/awt/font/TextLayout.html">TextLayout</A> <B>getJustifiedLayout</B>(float&nbsp;justificationWidth)</PRE><DL><DD>Creates a copy of this <code>TextLayout</code> justified to the  specified width. <p> If this <code>TextLayout</code> has already been justified, an exception is thrown.  If this <code>TextLayout</code> object's  justification ratio is zero, a <code>TextLayout</code> identical  to this <code>TextLayout</code> is returned.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>justificationWidth</CODE> - the width to use when justifying the line. For best results, it should not be too different from the current advance of the line.<DT><B>Returns:</B><DD>a <code>TextLayout</code> justified to the specified width.<DT><B>Throws:</B><DD><CODE><A HREF="../../../java/lang/Error.html">Error</A></CODE> - if this layout has already been justified, an Error is thrown.</DL></DD></DL><HR><A NAME="handleJustify(float)"><!-- --></A><H3>handleJustify</H3><PRE>protected void <B>handleJustify</B>(float&nbsp;justificationWidth)</PRE><DL><DD>Justify this layout.  Overridden by subclassers to control justification (if there were subclassers, that is...) The layout will only justify if the paragraph attributes (from the source text, possibly defaulted by the layout attributes) indicate a non-zero justification ratio.  The text will be justified to the indicated width.  The current implementation also adjusts hanging punctuation and trailing whitespace to overhang the justification width. Once justified, the layout may not be rejustified. <p> Some code may rely on immutablity of layouts.  Subclassers should not call this directly, but instead should call getJustifiedLayout, which will call this method on a clone of this layout, preserving the original.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>justificationWidth</CODE> - the width to use when justifying the line. For best results, it should not be too different from the current advance of the line.<DT><B>See Also: </B><DD><A HREF="../../../java/awt/font/TextLayout.html#getJustifiedLayout(float)"><CODE>getJustifiedLayout(float)</CODE></A></DL></DD></DL><HR><A NAME="getBaseline()"><!-- --></A><H3>getBaseline</H3><PRE>public byte <B>getBaseline</B>()</PRE><DL><DD>Returns the baseline for this <code>TextLayout</code>. The baseline is one of the values defined in <code>Font</code>, which are roman, centered and hanging.  Ascent and descent are relative to this baseline.  The <code>baselineOffsets</code> are also relative to this baseline.<DD><DL></DL></DD><DD><DL><DT><B>Returns:</B><DD>the baseline of this <code>TextLayout</code>.<DT><B>See Also: </B><DD><A HREF="../../../java/awt/font/TextLayout.html#getBaselineOffsets()"><CODE>getBaselineOffsets()</CODE></A>, <A HREF="../../../java/awt/Font.html"><CODE>Font</CODE></A></DL></DD></DL><HR><A NAME="getBaselineOffsets()"><!-- --></A><H3>getBaselineOffsets</H3><PRE>public float[] <B>getBaselineOffsets</B>()</PRE><DL><DD>Returns the offsets array for the baselines used for this  <code>TextLayout</code>. <p> The array is indexed by one of the values defined in  <code>Font</code>, which are roman, centered and hanging.  The  values are relative to this <code>TextLayout</code> object's  baseline, so that <code>getBaselineOffsets[getBaseline()] == 0</code>. Offsets are added to the position of the <code>TextLayout</code>  object's baseline to get the position for the new baseline.<DD><DL></DL></DD><DD><DL><DT><B>Returns:</B><DD>the offsets array containing the baselines used for this    <code>TextLayout</code>.<DT><B>See Also: </B><DD><A HREF="../../../java/awt/font/TextLayout.html#getBaseline()"><CODE>getBaseline()</CODE></A>, <A HREF="../../../java/awt/Font.html"><CODE>Font</CODE></A></DL></DD></DL><HR><A NAME="getAdvance()"><!-- --></A><H3>getAdvance</H3><PRE>public float <B>getAdvance</B>()</PRE><DL><DD>Returns the advance of this <code>TextLayout</code>. The advance is the distance from the origin to the advance of the rightmost (bottommost) character measuring in the line direction.<DD><DL></DL></DD><DD><DL><DT><B>Returns:</B><DD>the advance of this <code>TextLayout</code>.</DL></DD></DL><HR><A NAME="getVisibleAdvance()"><!-- --></A><H3>getVisibleAdvance</H3><PRE>public float <B>getVisibleAdvance</B>()</PRE><DL><DD>Returns the advance of this <code>TextLayout</code>, minus trailing  whitespace.<DD><DL></DL></DD><DD><DL><DT><B>Returns:</B><DD>the advance of this <code>TextLayout</code> without the      trailing whitespace.<DT><B>See Also: </B><DD><A HREF="../../../java/awt/font/TextLayout.html#getAdvance()"><CODE>getAdvance()</CODE></A></DL></DD></DL><HR><A NAME="getAscent()"><!-- --></A><H3>getAscent</H3><PRE>public float <B>getAscent</B>()</PRE><DL><DD>Returns the ascent of this <code>TextLayout</code>. The ascent is the distance from the top (right) of the  <code>TextLayout</code> to the baseline.  It is always either  positive or zero.  The ascent is sufficient to accomodate superscripted text and is the maximum of the sum of the ascent, offset, and baseline of each glyph.<DD><DL></DL></DD><DD><DL><DT><B>Returns:</B><DD>the ascent of this <code>TextLayout</code>.</DL></DD></DL><HR><A NAME="getDescent()"><!-- --></A><H3>getDescent</H3><PRE>public float <B>getDescent</B>()</PRE><DL><DD>Returns the descent of this <code>TextLayout</code>. The descent is the distance from the baseline to the bottom (left) of the <code>TextLayout</code>.  It is always either positive or zero.   The descent is sufficient to accomodate subscripted text and is the  maximum of the sum of the descent, offset, and baseline of each glyph.<DD><DL></DL></DD><DD><DL><DT><B>Returns:</B><DD>the descent of this <code>TextLayout</code>.</DL></DD></DL><HR><A NAME="getLeading()"><!-- --></A><H3>getLeading</H3><PRE>public float <B>getLeading</B>()</PRE><DL><DD>Returns the leading of the <code>TextLayout</code>. The leading is the suggested interline spacing for this  <code>TextLayout</code>. <p> The leading is computed from the leading, descent, and baseline of all glyphvectors in the <code>TextLayout</code>.  The algorithm  is roughly as follows: <blockquote><pre> 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; </pre></blockquote><DD><DL></DL></DD><DD><DL><DT><B>Returns:</B><DD>the leading of this <code>TextLayout</code>.</DL></DD></DL><HR><A NAME="getBounds()"><!-- --></A><H3>getBounds</H3><PRE>public <A HREF="../../../java/awt/geom/Rectangle2D.html">Rectangle2D</A> <B>getBounds</B>()</PRE><DL><DD>Returns the bounds of this <code>TextLayout</code>. The bounds contains all of the pixels the <code>TextLayout</code> can draw.  It might not coincide exactly with the ascent, descent,  origin or advance of the <code>TextLayout</code>.<DD><DL></DL></DD><DD><DL><DT><B>Returns:</B><DD>a <A HREF="../../../java/awt/geom/Rectangle2D.html"><CODE>Rectangle2D</CODE></A> that is the bounds of this        <code>TextLayout</code>.</DL></DD></DL><HR><A NAME="isLeftToRight()"><!-- --></A><H3>isLeftToRight</H3><PRE>public boolean <B>isLeftToRight</B>()</PRE><DL><DD>Returns <code>true</code> if this <code>TextLayout</code> has  a left-to-right base direction or <code>false</code> if it has a right-to-left base direction.  The <code>TextLayout</code> has a base direction of either left-to-right (LTR) or right-to-left (RTL).  The base direction is independent of the  actual direction of text on the line, which may be either LTR,  RTL, or mixed. Left-to-right layouts by default should position  flush left.  If the layout is on a tabbed line, the tabs run left to right, so that logically successive layouts position left to right.  The opposite is true for RTL layouts. By default they should position flush left, and tabs run right-to-left.<DD><DL></DL></DD><DD><DL><DT><B>Returns:</B><DD><code>true</code> if the base direction of this          <code>TextLayout</code> is left-to-right; <code>false</code>         otherwise.</DL></DD></DL><HR><A NAME="isVertical()"><!-- --></A><H3>isVertical</H3><PRE>public boolean <B>isVertical</B>()</PRE><DL><DD>Returns <code>true</code> if this <code>TextLayout</code> is vertical.<DD><DL></DL></DD><DD><DL><DT><B>Returns:</B><DD><code>true</code> if this <code>TextLayout</code> is vertical;      <code>false</code> otherwise.</DL></DD></DL><HR><A NAME="getCharacterCount()"><!-- --></A><H3>getCharacterCount</H3><PRE>public int <B>getCharacterCount</B>()</PRE><DL><DD>Returns the number of characters represented by this  <code>TextLayout</code>.<DD><DL></DL></DD><DD><DL><DT><B>Returns:</B><DD>the number of characters in this <code>TextLayout</code>.</DL></DD></DL><HR><A NAME="getCaretInfo(java.awt.font.TextHitInfo, java.awt.geom.Rectangle2D)"><!-- --></A><H3>getCaretInfo</H3><PRE>public float[] <B>getCaretInfo</B>(<A HREF="../../../java/awt/font/TextHitInfo.html">TextHitInfo</A>&nbsp;hit,

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?