APIdia Launch Partner
Top Inners Fields Constructors Methods
sun.font

public abstract Class LayoutPathImpl

extends LayoutPath
Class Inheritance
Known Direct Subclasses
sun.font.LayoutPathImpl.SegmentPath, sun.font.LayoutPathImpl.EmptyPath
Imports
java.awt.Shape, java.awt.font.LayoutPath, java.awt.geom.AffineTransform, .GeneralPath, .NoninvertibleTransformException, .PathIterator, .Point2D, java.util.Formatter, .ArrayList

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
public static enum
LayoutPathImpl.EndType

Indicate how positions past the start and limit of the path are treated.

public static class
LayoutPathImpl.SegmentPath

Represents a path built from segments.

public static class
LayoutPathImpl.SegmentPathBuilder

Use to build a SegmentPath.

Field Summary

Modifier and TypeField and Description
private static final Formatter
private static final boolean

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public abstract double
end()

public static LayoutPathImpl
getPath(LayoutPathImpl.EndType etype, double... coords)

Return a path representing the path from the origin through the points in order.

public abstract double
public abstract Shape
public Point2D
pathToPoint(double a, double o, boolean preceding)

public void
pathToPoint(double a, double o, boolean preceding, Point2D pt)

public Point2D
pointToPath(double x, double y)

public void
pointToPath(double x, double y, Point2D pt)

public abstract double
Inherited from java.awt.font.LayoutPath:
pathToPointpointToPath

Field Detail

LOGback to summary
private static final Formatter LOG
LOGMAPback to summary
private static final boolean LOGMAP

Constructor Detail

LayoutPathImplback to summary
public LayoutPathImpl()

Method Detail

endback to summary
public abstract double end()
getPathback to summary
public static LayoutPathImpl getPath(LayoutPathImpl.EndType etype, double... coords)

Return a path representing the path from the origin through the points in order.

lengthback to summary
public abstract double length()
mapShapeback to summary
public abstract Shape mapShape(Shape s)
pathToPointback to summary
public Point2D pathToPoint(double a, double o, boolean preceding)
pathToPointback to summary
public void pathToPoint(double a, double o, boolean preceding, Point2D pt)
pointToPathback to summary
public Point2D pointToPath(double x, double y)
pointToPathback to summary
public void pointToPath(double x, double y, Point2D pt)
startback to summary
public abstract double start()
sun.font back to summary

public Class LayoutPathImpl.EmptyPath

extends LayoutPathImpl
Class Inheritance

Field Summary

Modifier and TypeField and Description
private AffineTransform

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public double
end()

Implements abstract sun.font.LayoutPathImpl.end.

public double
length()

Implements abstract sun.font.LayoutPathImpl.length.

public Shape
public void
pathToPoint(Point2D location, boolean preceding, Point2D point)

Implements abstract java.awt.font.LayoutPath.pathToPoint.

Convert a location relative to the path to a point in user coordinates.

public boolean
pointToPath(Point2D pt, Point2D result)

Implements abstract java.awt.font.LayoutPath.pointToPath.

Convert a point in user space to a location relative to the path.

public double
start()

Implements abstract sun.font.LayoutPathImpl.start.

Inherited from sun.font.LayoutPathImpl:
getPathpathToPointpathToPointpointToPathpointToPath

Field Detail

txback to summary
private AffineTransform tx

Constructor Detail

EmptyPathback to summary
public EmptyPath(AffineTransform tx)

Method Detail

endback to summary
public double end()

Implements abstract sun.font.LayoutPathImpl.end.

lengthback to summary
public double length()

Implements abstract sun.font.LayoutPathImpl.length.

mapShapeback to summary
public Shape mapShape(Shape s)

Implements abstract sun.font.LayoutPathImpl.mapShape.

pathToPointback to summary
public void pathToPoint(Point2D location, boolean preceding, Point2D point)

Implements abstract java.awt.font.LayoutPath.pathToPoint.

Doc from java.awt.font.LayoutPath.pathToPoint.

Convert a location relative to the path to a point in user coordinates. The path might bend abruptly or be disjoint at the location's advance. If this is the case, the value of 'preceding' is used to disambiguate the portion of the path whose location and slope is to be used to interpret the offset.

pointToPathback to summary
public boolean pointToPath(Point2D pt, Point2D result)

Implements abstract java.awt.font.LayoutPath.pointToPath.

Doc from java.awt.font.LayoutPath.pointToPath.

Convert a point in user space to a location relative to the path. The location is chosen so as to minimize the distance from the point to the path (e.g., the magnitude of the offset will be smallest). If there is more than one such location, the location with the smallest advance is chosen.

startback to summary
public double start()

Implements abstract sun.font.LayoutPathImpl.start.

sun.font back to summary

public final Enum LayoutPathImpl.EndType

extends Enum<LayoutPathImpl.EndType>
Class Inheritance

Indicate how positions past the start and limit of the path are treated. PINNED adjusts these positions so as to be within start and limit. EXTENDED ignores the start and limit and effectively extends the first and last segments of the path 'infinitely'. CLOSED wraps positions around the ends of the path.

Field Summary

Modifier and TypeField and Description
public static final LayoutPathImpl.EndType
public static final LayoutPathImpl.EndType
public static final LayoutPathImpl.EndType

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public boolean
public boolean
public boolean
public static LayoutPathImpl.EndType
public static LayoutPathImpl.EndType[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

CLOSEDback to summary
public static final LayoutPathImpl.EndType CLOSED
EXTENDEDback to summary
public static final LayoutPathImpl.EndType EXTENDED
PINNEDback to summary
public static final LayoutPathImpl.EndType PINNED

Constructor Detail

EndTypeback to summary
private EndType()

Method Detail

isClosedback to summary
public boolean isClosed()
isExtendedback to summary
public boolean isExtended()
isPinnedback to summary
public boolean isPinned()
valueOfback to summary
public static LayoutPathImpl.EndType valueOf(String name)
valuesback to summary
public static LayoutPathImpl.EndType[] values()
sun.font back to summary

public final Class LayoutPathImpl.SegmentPath

extends LayoutPathImpl
Class Inheritance

Represents a path built from segments. Each segment is represented by a triple: x, y, and cumulative advance. These represent the end point of the segment. The start point of the first segment is represented by the triple at position 0. The path might have breaks in it, e.g. it is not connected. These will be represented by pairs of triplets that share the same advance. The path might be extended, pinned, or closed. If extended, the initial and final segments are considered to extend 'indefinitely' past the bounds of the advance. If pinned, they end at the bounds of the advance. If closed, advances before the start or after the end 'wrap around' the path. The start of the path is the initial triple. This provides the nominal advance at the given x, y position (typically zero). The end of the path is the final triple. This provides the advance at the end, the total length of the path is thus the ending advance minus the starting advance.

Note

We might want to cache more auxiliary data than the advance, but this seems adequate for now.

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv class
LayoutPathImpl.SegmentPath.LineInfo

This represents a line segment from the iterator.

pack-priv class
pack-priv class
LayoutPathImpl.SegmentPath.Segment

Each segment will construct its own general path, mapping the provided lines into its own simple space.

Field Summary

Modifier and TypeField and Description
private double[]
pack-priv LayoutPathImpl.EndType

Constructor Summary

AccessConstructor and Description
pack-priv
SegmentPath(double[] data, LayoutPathImpl.EndType etype)

Internal, use SegmentPathBuilder or one of the static helper functions to construct a SegmentPath.

Method Summary

Modifier and TypeMethod and Description
private void
calcoffset(int index, boolean doExtend, Point2D result)

Return the location of the point passed in result as mapped to the line indicated by index.

public double
end()

Implements abstract sun.font.LayoutPathImpl.end.

public static LayoutPathImpl.SegmentPath
get(LayoutPathImpl.EndType etype, double... pts)

private double
getClosedAdvance(double a, boolean preceding)

Get the 'modulus' of an advance on a closed path.

private int
getSegmentIndexForAdvance(double a, boolean preceding)

Return the index of the segment associated with advance.

public double
length()

Implements abstract sun.font.LayoutPathImpl.length.

private int
locateAndGetIndex(Point2D loc, boolean preceding, Point2D result)

Map the point, and return the segment index.

private void
map(int seg, double a, double o, Point2D pt)

Map a location based on the provided segment, returning in pt.

public Shape
public void
pathToPoint(Point2D location, boolean preceding, Point2D point)

Implements abstract java.awt.font.LayoutPath.pathToPoint.

Convert a location relative to the path to a point in user coordinates.

public boolean
pointToPath(Point2D pt, Point2D result)

Implements abstract java.awt.font.LayoutPath.pointToPath.

Convert a point in user space to a location relative to the path.

public double
start()

Implements abstract sun.font.LayoutPathImpl.start.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from sun.font.LayoutPathImpl:
getPathpathToPointpathToPointpointToPathpointToPath

Field Detail

databack to summary
private double[] data
etypeback to summary
pack-priv LayoutPathImpl.EndType etype

Constructor Detail

SegmentPathback to summary
pack-priv SegmentPath(double[] data, LayoutPathImpl.EndType etype)

Internal, use SegmentPathBuilder or one of the static helper functions to construct a SegmentPath.

Method Detail

calcoffsetback to summary
private void calcoffset(int index, boolean doExtend, Point2D result)

Return the location of the point passed in result as mapped to the line indicated by index. If doExtend is true, extend the x value without pinning to the ends of the line. this assumes that index is valid and references a line that has non-zero length.

endback to summary
public double end()

Implements abstract sun.font.LayoutPathImpl.end.

getback to summary
public static LayoutPathImpl.SegmentPath get(LayoutPathImpl.EndType etype, double... pts)
getClosedAdvanceback to summary
private double getClosedAdvance(double a, boolean preceding)

Get the 'modulus' of an advance on a closed path.

getSegmentIndexForAdvanceback to summary
private int getSegmentIndexForAdvance(double a, boolean preceding)

Return the index of the segment associated with advance. This points to the start of the triple and is a multiple of 3 between 3 and data.length-3 inclusive. It never points to a 'moveto' triple. If the path is closed, 'a' is mapped to a value between the start and end of the path, inclusive. If preceding is true, and 'a' lies on a segment boundary, return the index of the preceding segment, else return the index of the current segment (if it is not a moveto segment) otherwise the following segment (which is never a moveto segment).

Note

if the path is not closed, the advance might not actually lie on the returned segment-- it might be before the first, or after the last. The first or last segment (as appropriate) will be returned in this case.

lengthback to summary
public double length()

Implements abstract sun.font.LayoutPathImpl.length.

locateAndGetIndexback to summary
private int locateAndGetIndex(Point2D loc, boolean preceding, Point2D result)

Map the point, and return the segment index.

mapback to summary
private void map(int seg, double a, double o, Point2D pt)

Map a location based on the provided segment, returning in pt. Seg must be a valid 'lineto' segment.

Note

if the path is closed, x must be within the start and end of the path.

mapShapeback to summary
public Shape mapShape(Shape s)

Implements abstract sun.font.LayoutPathImpl.mapShape.

pathToPointback to summary
public void pathToPoint(Point2D location, boolean preceding, Point2D point)

Implements abstract java.awt.font.LayoutPath.pathToPoint.

Doc from java.awt.font.LayoutPath.pathToPoint.

Convert a location relative to the path to a point in user coordinates. The path might bend abruptly or be disjoint at the location's advance. If this is the case, the value of 'preceding' is used to disambiguate the portion of the path whose location and slope is to be used to interpret the offset.

pointToPathback to summary
public boolean pointToPath(Point2D pt, Point2D result)

Implements abstract java.awt.font.LayoutPath.pointToPath.

Doc from java.awt.font.LayoutPath.pointToPath.

Convert a point in user space to a location relative to the path. The location is chosen so as to minimize the distance from the point to the path (e.g., the magnitude of the offset will be smallest). If there is more than one such location, the location with the smallest advance is chosen.

startback to summary
public double start()

Implements abstract sun.font.LayoutPathImpl.start.

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.

sun.font back to summary

pack-priv Class LayoutPathImpl.SegmentPath.LineInfo

extends Object
Class Inheritance

This represents a line segment from the iterator. Each target segment will interpret it, and since this process needs slope along the line segment, this lets us compute it once and pass it around easily.

Field Summary

Modifier and TypeField and Description
pack-priv double
pack-priv double
pack-priv double
m

pack-priv double
pack-priv double

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
pack-priv boolean
pin(double lo, double hi, LayoutPathImpl.SegmentPath.LineInfo result)

Return true if we intersect the infinitely tall rectangle with lo <= x < hi.

pack-priv boolean
pin(int ix, LayoutPathImpl.SegmentPath.LineInfo result)

Return true if we intersect the segment at ix.

pack-priv void
set(double sx, double sy, double lx, double ly)

Set the lineinfo to this line

pack-priv void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

lxback to summary
pack-priv double lx
lyback to summary
pack-priv double ly
mback to summary
pack-priv double m
sxback to summary
pack-priv double sx
syback to summary
pack-priv double sy

Constructor Detail

LineInfoback to summary
pack-priv LineInfo()

Method Detail

pinback to summary
pack-priv boolean pin(double lo, double hi, LayoutPathImpl.SegmentPath.LineInfo result)

Return true if we intersect the infinitely tall rectangle with lo <= x < hi. If we do, also return the pinned portion of ourselves in result.

pinback to summary
pack-priv boolean pin(int ix, LayoutPathImpl.SegmentPath.LineInfo result)

Return true if we intersect the segment at ix. This takes the path end type into account and computes the relevant parameters to pass to pin(double, double, LineInfo).

setback to summary
pack-priv void set(double sx, double sy, double lx, double ly)

Set the lineinfo to this line

setback to summary
pack-priv void set(LayoutPathImpl.SegmentPath.LineInfo rhs)
sun.font back to summary

pack-priv Class LayoutPathImpl.SegmentPath.Mapper

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
pack-priv final Point2D.Double
pack-priv boolean
pack-priv final LayoutPathImpl.SegmentPath.LineInfo
pack-priv final Point2D.Double
pack-priv final ArrayList<LayoutPathImpl.SegmentPath.Segment>

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
pack-priv void
pack-priv void
init()

pack-priv void
lineTo(double x, double y)

public Shape
pack-priv void
moveTo(double x, double y)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

cptback to summary
pack-priv final Point2D.Double cpt
haveMTback to summary
pack-priv boolean haveMT
liback to summary
pack-priv final LayoutPathImpl.SegmentPath.LineInfo li
mptback to summary
pack-priv final Point2D.Double mpt
segmentsback to summary
pack-priv final ArrayList<LayoutPathImpl.SegmentPath.Segment> segments

Constructor Detail

Mapperback to summary
pack-priv Mapper()

Method Detail

closeback to summary
pack-priv void close()
initback to summary
pack-priv void init()
lineToback to summary
pack-priv void lineTo(double x, double y)
mapShapeback to summary
public Shape mapShape(Shape s)
moveToback to summary
pack-priv void moveTo(double x, double y)
sun.font back to summary

pack-priv Class LayoutPathImpl.SegmentPath.Segment

extends Object
Class Inheritance

Each segment will construct its own general path, mapping the provided lines into its own simple space.

Field Summary

Modifier and TypeField and Description
pack-priv boolean
pack-priv double
pack-priv double
pack-priv GeneralPath
pack-priv final int
pack-priv final LayoutPathImpl.SegmentPath.LineInfo
pack-priv final double
pack-priv final double

Constructor Summary

AccessConstructor and Description
pack-priv
Segment(int ix)

Method Summary

Modifier and TypeMethod and Description
pack-priv void
pack-priv void
init()

pack-priv void
pack-priv void
move()

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

brokenback to summary
pack-priv boolean broken
cxback to summary
pack-priv double cx
cyback to summary
pack-priv double cy
gpback to summary
pack-priv GeneralPath gp
ixback to summary
pack-priv final int ix
tempback to summary
pack-priv final LayoutPathImpl.SegmentPath.LineInfo temp
uxback to summary
pack-priv final double ux
uyback to summary
pack-priv final double uy

Constructor Detail

Segmentback to summary
pack-priv Segment(int ix)

Method Detail

closeback to summary
pack-priv void close()
initback to summary
pack-priv void init()
lineback to summary
pack-priv void line(LayoutPathImpl.SegmentPath.LineInfo li)
moveback to summary
pack-priv void move()
sun.font back to summary

public final Class LayoutPathImpl.SegmentPathBuilder

extends Object
Class Inheritance

Use to build a SegmentPath. This takes the data and preanalyzes it for information that the SegmentPath needs, then constructs a SegmentPath from that. Mainly, this lets SegmentPath cache the lengths along the path to each line segment, and so avoid calculating them over and over.

Field Summary

Modifier and TypeField and Description
private double
a

private double[]
private boolean
private double
private double
private int
w

Constructor Summary

AccessConstructor and Description
public
SegmentPathBuilder()

Construct a SegmentPathBuilder.

Method Summary

Modifier and TypeMethod and Description
public LayoutPathImpl.SegmentPath
build(LayoutPathImpl.EndType etype, double... pts)

Automatically build from a list of points represented by pairs of doubles.

public LayoutPathImpl.SegmentPath
public LayoutPathImpl.SegmentPath
complete(LayoutPathImpl.EndType etype)

Complete building a SegmentPath.

public void
lineTo(double x, double y)

Connect to a new point.

public void
moveTo(double x, double y)

Move to a new point.

private void
nextPoint(double x, double y, boolean connect)

Add a new point, and increment advance if connect is true.

public void
reset(int datalen)

Reset the builder for a new path.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

aback to summary
private double a
databack to summary
private double[] data
pconnectback to summary
private boolean pconnect
pxback to summary
private double px
pyback to summary
private double py
wback to summary
private int w

Constructor Detail

SegmentPathBuilderback to summary
public SegmentPathBuilder()

Construct a SegmentPathBuilder.

Method Detail

buildback to summary
public LayoutPathImpl.SegmentPath build(LayoutPathImpl.EndType etype, double... pts)

Automatically build from a list of points represented by pairs of doubles. Initial advance is zero.

completeback to summary
public LayoutPathImpl.SegmentPath complete()
completeback to summary
public LayoutPathImpl.SegmentPath complete(LayoutPathImpl.EndType etype)

Complete building a SegmentPath. Once this is called, the builder is restored to its initial state and information about the previous path is released. The end type indicates whether to treat the path as closed, extended, or pinned.

lineToback to summary
public void lineTo(double x, double y)

Connect to a new point. If there is no data, the previous point is presumed to be 0, 0. This point is checked against the previous point, and if different, this point is added to the path and the advance extended. If this point is the same as the previous point, the path remains unchanged.

moveToback to summary
public void moveTo(double x, double y)

Move to a new point. If there is no data, this will become the first point. If there is data, and the previous call was a lineTo, this point is checked against the previous point, and if different, this starts a new segment at the same advance as the end of the last segment. If there is data, and the previous call was a moveTo, this replaces the point used for that previous call. Calling this is optional, lineTo will suffice and the initial point will be set to 0, 0.

nextPointback to summary
private void nextPoint(double x, double y, boolean connect)

Add a new point, and increment advance if connect is true. This automatically rejects duplicate points and multiple disconnected points.

resetback to summary
public void reset(int datalen)

Reset the builder for a new path. Datalen is a hint of how many points will be in the path, and the working buffer will be sized to accommodate at least this number of points. If datalen is zero, the working buffer is freed (it will be allocated on first use).