public static final class

LayoutPathImpl.SegmentPath

extends LayoutPathImpl
java.lang.Object
   ↳ java.awt.font.LayoutPath
     ↳ sun.font.LayoutPathImpl
       ↳ sun.font.LayoutPathImpl.SegmentPath

Class Overview

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.

Summary

Public Methods
double end()
static LayoutPathImpl.SegmentPath get(LayoutPathImpl.EndType etype, double... pts)
double length()
Shape mapShape(Shape s)
void pathToPoint(Point2D location, boolean preceding, Point2D point)
Convert a location relative to the path to a point in user coordinates.
boolean pointToPath(Point2D pt, Point2D result)
Convert a point in user space to a location relative to the path.
double start()
String toString()
Returns a string representation of the object.
[Expand]
Inherited Methods
From class sun.font.LayoutPathImpl
From class java.awt.font.LayoutPath
From class java.lang.Object

Public Methods

public double end ()

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

public double length ()

public Shape mapShape (Shape s)

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

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.

Parameters
location a Point2D representing the advance (in x) and offset (in y) of a location relative to the path. If location is not the same object as point, location will remain unmodified by this call.
preceding if true, the portion preceding the advance should be used, if false the portion after should be used. This has no effect if the path does not break or bend sharply at the advance.
point a Point2D to hold the returned point. It can be the same object as location.

public boolean pointToPath (Point2D pt, Point2D result)

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.

Parameters
pt the point to convert. If it is not the same object as location, point will remain unmodified by this call.
result a Point2D to hold the returned location. It can be the same object as point.
Returns
  • true if the point is associated with the portion of the path preceding the location, false if it is associated with the portion following. The default, if the location is not at a break or sharp bend in the path, is to return true.

public double start ()

public String toString ()

Returns a string representation of the object. In general, the toString method returns a string that "textually represents" this object. The result should be a concise but informative representation that is easy for a person to read. It is recommended that all subclasses override this method.

The toString method for class Object returns a string consisting of the name of the class of which the object is an instance, the at-sign character `@', and the unsigned hexadecimal representation of the hash code of the object. In other words, this method returns a string equal to the value of:

 getClass().getName() + '@' + Integer.toHexString(hashCode())
 

Returns
  • a string representation of the object.