APIdia Launch Partner
Top Inners Fields Constructors Methods
java.awt.font

pack-priv final Class TextLine

extends Object
Class Inheritance
Imports
java.awt.Color, .Font, .Graphics2D, .Rectangle, .Shape, java.awt.geom.AffineTransform, .GeneralPath, .Point2D, .Rectangle2D, .Line2D, java.awt.im.InputMethodHighlight, java.awt.image.BufferedImage, java.text.Annotation, .AttributedCharacterIterator, .AttributedCharacterIterator.Attribute, .Bidi, .CharacterIterator, java.util.Hashtable, .Map, sun.font.AttributeValues, .BidiUtils, .CodePointIterator, .CoreMetrics, .Decoration, .FontLineMetrics, .FontResolver, .GraphicComponent, .LayoutPathImpl, .LayoutPathImpl.EmptyPath, .LayoutPathImpl.SegmentPathBuilder, .TextLabelFactory, .TextLineComponent

Nested and Inner Type Summary

Modifier and TypeClass and Description
private abstract static class
pack-priv static class

Field Summary

Modifier and TypeField and Description
private float[]
private byte[]
private int[]
private char[]
private int
private int
private int[]
private TextLineComponent[]
private int[]
private static TextLine.Function
private static TextLine.Function
private static TextLine.Function
private static TextLine.Function
private boolean
private TextLine.TextLineMetrics
private FontRenderContext
private boolean
private float[]
private LayoutPathImpl
private Rectangle

Constructor Summary

AccessConstructor and Description
public
TextLine(FontRenderContext frc, TextLineComponent[] components, float[] baselineOffsets, char[] chars, int charsStart, int charsLimit, int[] charLogicalOrder, byte[] charLevels, boolean isDirectionLTR)

Method Summary

Modifier and TypeMethod and Description
pack-priv static boolean
advanceToFirstFont(AttributedCharacterIterator aci)

When this returns, the ACI's current position will be at the start of the first run which does NOT contain a GraphicAttribute.

private float
applyFunctionAtIndex(int logicalIndex, TextLine.Function f)

public boolean
public int
private void
private static int[]
computeComponentOrder(TextLineComponent[] components, int[] charsLtoV)

Compute the components order from the given components array and logical-to-visual character mapping.

pack-priv static Rectangle
public static TextLineComponent[]
createComponentsOnRun(int runStart, int runLimit, char[] chars, int[] charsLtoV, byte[] levels, TextLabelFactory factory, Font font, CoreMetrics cm, FontRenderContext frc, Decoration decorator, TextLineComponent[] components, int numComponents)

Returns an array in logical order of the TextLineComponents on the text in the given range, with the given attributes.

public static TextLine
createLineFromText(char[] chars, StyledParagraph styledParagraph, TextLabelFactory factory, boolean isDirectionLTR, float[] baselineOffsets)

Create a TextLine from the Font and character data over the range.

public void
draw(Graphics2D g2, float x, float y)

private static TextLineComponent[]
public static TextLine
fastCreateTextLine(FontRenderContext frc, char[] chars, Font font, CoreMetrics lm, Map<? extends AttributedCharacterIterator.Attribute, ?> attributes)

Create a TextLine from the text.

private static int
firstVisualChunk(int[] order, byte[] direction, int start, int limit)

public static float
getAdvanceBetween(TextLineComponent[] components, int start, int limit)

public float
getCharAdvance(int logicalIndex)

public float
getCharAngle(int logicalIndex)

public float
getCharAscent(int logicalIndex)

public Rectangle2D
getCharBounds(int logicalIndex)

public float
getCharDescent(int logicalIndex)

public byte
getCharLevel(int logicalIndex)

public float
getCharLinePosition(int logicalIndex)

public float
getCharLinePosition(int logicalIndex, boolean leading)

public float
getCharShift(int logicalIndex)

public int
getCharType(int logicalIndex)

public float
getCharXPosition(int logicalIndex)

public float
getCharYPosition(int logicalIndex)

private int
getComponentLogicalIndex(int vi)

map a component visual index to the logical index.

public static TextLineComponent[]
getComponents(StyledParagraph styledParagraph, char[] chars, int textStart, int textLimit, int[] charsLtoV, byte[] levels, TextLabelFactory factory)

Returns an array (in logical order) of the TextLineComponents representing the text.

private float
getComponentShift(int index)

private int
getComponentVisualIndex(int li)

map a component logical index to the visual index.

public CoreMetrics
getCoreMetricsAt(int logicalIndex)

pack-priv static Font
public Rectangle2D
public TextLine
getJustifiedLine(float justificationWidth, float justifyRatio, int justStart, int justLimit)

pack-priv LayoutPathImpl
public TextLine.TextLineMetrics
pack-priv static float[]
getNormalizedOffsets(float[] baselineOffsets, byte baseline)

public Shape
public Rectangle
getPixelBounds(FontRenderContext frc, float x, float y)

public Rectangle2D
getVisualBounds()

Return the union of the visual bounds of all the components.

private void
init()

public boolean
isCharLTR(int logicalIndex)

public boolean
isCharSpace(int logicalIndex)

public boolean
isCharWhitespace(int logicalIndex)

public boolean
public int
logicalToVisual(int logicalIndex)

public static TextLine
standardCreateTextLine(FontRenderContext frc, AttributedCharacterIterator text, char[] chars, float[] baselineOffsets)

Create a TextLine from the text.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

public int
visualToLogical(int visualIndex)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

fBaselineOffsetsback to summary
private float[] fBaselineOffsets
fCharLevelsback to summary
private byte[] fCharLevels
fCharLogicalOrderback to summary
private int[] fCharLogicalOrder
fCharsback to summary
private char[] fChars
fCharsLimitback to summary
private int fCharsLimit
fCharsStartback to summary
private int fCharsStart
fCharVisualOrderback to summary
private int[] fCharVisualOrder
fComponentsback to summary
private TextLineComponent[] fComponents
fComponentVisualOrderback to summary
private int[] fComponentVisualOrder
fgAdvanceFback to summary
private static TextLine.Function fgAdvanceF
fgPosAdvFback to summary
private static TextLine.Function fgPosAdvF
fgXPositionFback to summary
private static TextLine.Function fgXPositionF
fgYPositionFback to summary
private static TextLine.Function fgYPositionF
fIsDirectionLTRback to summary
private boolean fIsDirectionLTR
fMetricsback to summary
private TextLine.TextLineMetrics fMetrics
frcback to summary
private FontRenderContext frc
isSimpleback to summary
private boolean isSimple
locsback to summary
private float[] locs
lpback to summary
private LayoutPathImpl lp
pixelBoundsback to summary
private Rectangle pixelBounds

Constructor Detail

TextLineback to summary
public TextLine(FontRenderContext frc, TextLineComponent[] components, float[] baselineOffsets, char[] chars, int charsStart, int charsLimit, int[] charLogicalOrder, byte[] charLevels, boolean isDirectionLTR)

Method Detail

advanceToFirstFontback to summary
pack-priv static boolean advanceToFirstFont(AttributedCharacterIterator aci)

When this returns, the ACI's current position will be at the start of the first run which does NOT contain a GraphicAttribute. If no such run exists the ACI's position will be at the end, and this method will return false.

applyFunctionAtIndexback to summary
private float applyFunctionAtIndex(int logicalIndex, TextLine.Function f)
caretAtOffsetIsValidback to summary
public boolean caretAtOffsetIsValid(int offset)
characterCountback to summary
public int characterCount()
checkCtorArgsback to summary
private void checkCtorArgs()
computeComponentOrderback to summary
private static int[] computeComponentOrder(TextLineComponent[] components, int[] charsLtoV)

Compute the components order from the given components array and logical-to-visual character mapping. May return null if canonical.

computePixelBoundsback to summary
pack-priv static Rectangle computePixelBounds(BufferedImage im)
createComponentsOnRunback to summary
public static TextLineComponent[] createComponentsOnRun(int runStart, int runLimit, char[] chars, int[] charsLtoV, byte[] levels, TextLabelFactory factory, Font font, CoreMetrics cm, FontRenderContext frc, Decoration decorator, TextLineComponent[] components, int numComponents)

Returns an array in logical order of the TextLineComponents on the text in the given range, with the given attributes.

createLineFromTextback to summary
public static TextLine createLineFromText(char[] chars, StyledParagraph styledParagraph, TextLabelFactory factory, boolean isDirectionLTR, float[] baselineOffsets)

Create a TextLine from the Font and character data over the range. The range is relative to both the StyledParagraph and the character array.

drawback to summary
public void draw(Graphics2D g2, float x, float y)
expandArrayback to summary
private static TextLineComponent[] expandArray(TextLineComponent[] orig)
fastCreateTextLineback to summary
public static TextLine fastCreateTextLine(FontRenderContext frc, char[] chars, Font font, CoreMetrics lm, Map<? extends AttributedCharacterIterator.Attribute, ?> attributes)

Create a TextLine from the text. The Font must be able to display all of the text. attributes==null is equivalent to using an empty Map for attributes

firstVisualChunkback to summary
private static int firstVisualChunk(int[] order, byte[] direction, int start, int limit)
getAdvanceBetweenback to summary
public static float getAdvanceBetween(TextLineComponent[] components, int start, int limit)
getCharAdvanceback to summary
public float getCharAdvance(int logicalIndex)
getCharAngleback to summary
public float getCharAngle(int logicalIndex)
getCharAscentback to summary
public float getCharAscent(int logicalIndex)
getCharBoundsback to summary
public Rectangle2D getCharBounds(int logicalIndex)
getCharDescentback to summary
public float getCharDescent(int logicalIndex)
getCharLevelback to summary
public byte getCharLevel(int logicalIndex)
getCharLinePositionback to summary
public float getCharLinePosition(int logicalIndex)
getCharLinePositionback to summary
public float getCharLinePosition(int logicalIndex, boolean leading)
getCharShiftback to summary
public float getCharShift(int logicalIndex)
getCharTypeback to summary
public int getCharType(int logicalIndex)
getCharXPositionback to summary
public float getCharXPosition(int logicalIndex)
getCharYPositionback to summary
public float getCharYPosition(int logicalIndex)
getComponentLogicalIndexback to summary
private int getComponentLogicalIndex(int vi)

map a component visual index to the logical index.

getComponentsback to summary
public static TextLineComponent[] getComponents(StyledParagraph styledParagraph, char[] chars, int textStart, int textLimit, int[] charsLtoV, byte[] levels, TextLabelFactory factory)

Returns an array (in logical order) of the TextLineComponents representing the text. The components are both logically and visually contiguous.

getComponentShiftback to summary
private float getComponentShift(int index)
getComponentVisualIndexback to summary
private int getComponentVisualIndex(int li)

map a component logical index to the visual index.

getCoreMetricsAtback to summary
public CoreMetrics getCoreMetricsAt(int logicalIndex)
getFontAtCurrentPosback to summary
pack-priv static Font getFontAtCurrentPos(AttributedCharacterIterator aci)
getItalicBoundsback to summary
public Rectangle2D getItalicBounds()
getJustifiedLineback to summary
public TextLine getJustifiedLine(float justificationWidth, float justifyRatio, int justStart, int justLimit)
getLayoutPathback to summary
pack-priv LayoutPathImpl getLayoutPath()
getMetricsback to summary
public TextLine.TextLineMetrics getMetrics()
getNormalizedOffsetsback to summary
pack-priv static float[] getNormalizedOffsets(float[] baselineOffsets, byte baseline)
getOutlineback to summary
public Shape getOutline()
getPixelBoundsback to summary
public Rectangle getPixelBounds(FontRenderContext frc, float x, float y)
getVisualBoundsback to summary
public Rectangle2D getVisualBounds()

Return the union of the visual bounds of all the components. This incorporates the path. It does not include logical bounds (used by carets).

initback to summary
private void init()
isCharLTRback to summary
public boolean isCharLTR(int logicalIndex)
isCharSpaceback to summary
public boolean isCharSpace(int logicalIndex)
isCharWhitespaceback to summary
public boolean isCharWhitespace(int logicalIndex)
isDirectionLTRback to summary
public boolean isDirectionLTR()
logicalToVisualback to summary
public int logicalToVisual(int logicalIndex)
standardCreateTextLineback to summary
public static TextLine standardCreateTextLine(FontRenderContext frc, AttributedCharacterIterator text, char[] chars, float[] baselineOffsets)

Create a TextLine from the text. chars is just the text in the iterator.

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

visualToLogicalback to summary
public int visualToLogical(int visualIndex)
java.awt.font back to summary

private abstract Class TextLine.Function

extends Object
Class Inheritance

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
pack-priv abstract float
computeFunction(TextLine line, int componentIndex, int indexInArray)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

Functionback to summary
private Function()

Method Detail

computeFunctionback to summary
pack-priv abstract float computeFunction(TextLine line, int componentIndex, int indexInArray)
java.awt.font back to summary

pack-priv final Class TextLine.TextLineMetrics

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
public final float
public final float
public final float
public final float

Constructor Summary

AccessConstructor and Description
public
TextLineMetrics(float ascent, float descent, float leading, float advance)

Method Summary

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

advanceback to summary
public final float advance
ascentback to summary
public final float ascent
descentback to summary
public final float descent
leadingback to summary
public final float leading

Constructor Detail

TextLineMetricsback to summary
public TextLineMetrics(float ascent, float descent, float leading, float advance)