1. /*
  2. * @(#)GlyphVector.java 1.32 03/12/19
  3. *
  4. * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
  5. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  6. */
  7. /*
  8. * @author Charlton Innovations, Inc.
  9. */
  10. package java.awt.font;
  11. import java.awt.Graphics2D;
  12. import java.awt.Font;
  13. import java.awt.Polygon; // remind - need a floating point version
  14. import java.awt.Rectangle;
  15. import java.awt.geom.Point2D;
  16. import java.awt.geom.Rectangle2D;
  17. import java.awt.geom.AffineTransform;
  18. import java.awt.Shape;
  19. import java.awt.font.GlyphMetrics;
  20. import java.awt.font.GlyphJustificationInfo;
  21. /**
  22. * A <code>GlyphVector</code> object is a collection of glyphs
  23. * containing geometric information for the placement of each glyph
  24. * in a transformed coordinate space which corresponds to the
  25. * device on which the <code>GlyphVector</code> is ultimately
  26. * displayed.
  27. * <p>
  28. * The <code>GlyphVector</code> does not attempt any interpretation of
  29. * the sequence of glyphs it contains. Relationships between adjacent
  30. * glyphs in sequence are solely used to determine the placement of
  31. * the glyphs in the visual coordinate space.
  32. * <p>
  33. * Instances of <code>GlyphVector</code> are created by a {@link Font}.
  34. * <p>
  35. * In a text processing application that can cache intermediate
  36. * representations of text, creation and subsequent caching of a
  37. * <code>GlyphVector</code> for use during rendering is the fastest
  38. * method to present the visual representation of characters to a user.
  39. * <p>
  40. * A <code>GlyphVector</code> is associated with exactly one
  41. * <code>Font</code>, and can provide data useful only in relation to
  42. * this <code>Font</code>. In addition, metrics obtained from a
  43. * <code>GlyphVector</code> are not generally geometrically scaleable
  44. * since the pixelization and spacing are dependent on grid-fitting
  45. * algorithms within a <code>Font</code>. To facilitate accurate
  46. * measurement of a <code>GlyphVector</code> and its component
  47. * glyphs, you must specify a scaling transform, anti-alias mode, and
  48. * fractional metrics mode when creating the <code>GlyphVector</code>.
  49. * These characteristics can be derived from the destination device.
  50. * <p>
  51. * For each glyph in the <code>GlyphVector</code>, you can obtain:
  52. * <ul>
  53. * <li>the position of the glyph
  54. * <li>the transform associated with the glyph
  55. * <li>the metrics of the glyph in the context of the
  56. * <code>GlyphVector</code>. The metrics of the glyph may be
  57. * different under different transforms, application specified
  58. * rendering hints, and the specific instance of the glyph within
  59. * the <code>GlyphVector</code>.
  60. * </ul>
  61. * <p>
  62. * Altering the data used to create the <code>GlyphVector</code> does not
  63. * alter the state of the <code>GlyphVector</code>.
  64. * <p>
  65. * Methods are provided to adjust the positions of the glyphs
  66. * within the <code>GlyphVector</code>. These methods are most
  67. * appropriate for applications that are performing justification
  68. * operations for the presentation of the glyphs.
  69. * <p>
  70. * Methods are provided to transform individual glyphs within the
  71. * <code>GlyphVector</code>. These methods are primarily useful for
  72. * special effects.
  73. * <p>
  74. * Methods are provided to return both the visual, logical, and pixel bounds
  75. * of the entire <code>GlyphVector</code> or of individual glyphs within
  76. * the <code>GlyphVector</code>.
  77. * <p>
  78. * Methods are provided to return a {@link Shape} for the
  79. * <code>GlyphVector</code>, and for individual glyphs within the
  80. * <code>GlyphVector</code>.
  81. * @see Font
  82. * @see GlyphMetrics
  83. * @see TextLayout
  84. * @version 19 Mar 1998
  85. * @author Charlton Innovations, Inc.
  86. */
  87. public abstract class GlyphVector implements Cloneable {
  88. //
  89. // methods associated with creation-time state
  90. //
  91. /**
  92. * Returns the <code>Font</code> associated with this
  93. * <code>GlyphVector</code>.
  94. * @return <code>Font</code> used to create this
  95. * <code>GlyphVector</code>.
  96. * @see Font
  97. */
  98. public abstract Font getFont();
  99. /**
  100. * Returns the {@link FontRenderContext} associated with this
  101. * <code>GlyphVector</code>.
  102. * @return <code>FontRenderContext</code> used to create this
  103. * <code>GlyphVector</code>.
  104. * @see FontRenderContext
  105. * @see Font
  106. */
  107. public abstract FontRenderContext getFontRenderContext();
  108. //
  109. // methods associated with the GlyphVector as a whole
  110. //
  111. /**
  112. * Assigns default positions to each glyph in this
  113. * <code>GlyphVector</code>. This can destroy information
  114. * generated during initial layout of this <code>GlyphVector</code>.
  115. */
  116. public abstract void performDefaultLayout();
  117. /**
  118. * Returns the number of glyphs in this <code>GlyphVector</code>.
  119. * @return number of glyphs in this <code>GlyphVector</code>.
  120. */
  121. public abstract int getNumGlyphs();
  122. /**
  123. * Returns the glyphcode of the specified glyph.
  124. * This return value is meaningless to anything other
  125. * than the <code>Font</code> object that created this
  126. * <code>GlyphVector</code>.
  127. * @param glyphIndex the index into this <code>GlyphVector</code>
  128. * that corresponds to the glyph from which to retrieve the
  129. * glyphcode.
  130. * @return the glyphcode of the glyph at the specified
  131. * <code>glyphIndex</code>.
  132. * @throws IndexOutOfBoundsException if <code>glyphIndex</code>
  133. * is less than 0 or greater than or equal to the
  134. * number of glyphs in this <code>GlyphVector</code>
  135. */
  136. public abstract int getGlyphCode(int glyphIndex);
  137. /**
  138. * Returns an array of glyphcodes for the specified glyphs.
  139. * The contents of this return value are meaningless to anything other
  140. * than the <code>Font</code> used to create this
  141. * <code>GlyphVector</code>. This method is used
  142. * for convenience and performance when processing glyphcodes.
  143. * If no array is passed in, a new array is created.
  144. * @param beginGlyphIndex the index into this
  145. * <code>GlyphVector</code> at which to start retrieving glyphcodes
  146. * @param numEntries the number of glyphcodes to retrieve
  147. * @param codeReturn the array that receives the glyphcodes and is
  148. * then returned
  149. * @return an array of glyphcodes for the specified glyphs.
  150. * @throws IllegalArgumentException if <code>numEntries</code> is
  151. * less than 0
  152. * @throws IndexOutOfBoundsException if <code>beginGlyphIndex</code>
  153. * is less than 0
  154. * @throws IndexOutOfBoundsException if the sum of
  155. * <code>beginGlyphIndex</code> and <code>numEntries</code> is
  156. * greater than the number of glyphs in this
  157. * <code>GlyphVector</code>
  158. */
  159. public abstract int[] getGlyphCodes(int beginGlyphIndex, int numEntries,
  160. int[] codeReturn);
  161. /**
  162. * Returns the character index of the specified glyph.
  163. * The character index is the index of the first logical
  164. * character represented by the glyph. The default
  165. * implementation assumes a one-to-one, left-to-right mapping
  166. * of glyphs to characters.
  167. * @param glyphIndex the index of the glyph
  168. * @return the index of the first character represented by the glyph
  169. * @since 1.4
  170. */
  171. public int getGlyphCharIndex(int glyphIndex) {
  172. return glyphIndex;
  173. }
  174. /**
  175. * Returns the character indices of the specified glyphs.
  176. * The character index is the index of the first logical
  177. * character represented by the glyph. Indices are returned
  178. * in glyph order. The default implementation invokes
  179. * getGlyphCharIndex for each glyph, and subclassers will probably
  180. * want to override this implementation for performance reasons.
  181. * Use this method for convenience and performance
  182. * in processing of glyphcodes. If no array is passed in,
  183. * a new array is created.
  184. * @param beginGlyphIndex the index of the first glyph
  185. * @param numEntries the number of glyph indices
  186. * @param codeReturn the array into which to return the character indices
  187. * @return an array of character indices, one per glyph.
  188. * @since 1.4
  189. */
  190. public int[] getGlyphCharIndices(int beginGlyphIndex, int numEntries,
  191. int[] codeReturn) {
  192. if (codeReturn == null) {
  193. codeReturn = new int[numEntries];
  194. }
  195. for (int i = 0, j = beginGlyphIndex; i < numEntries; ++i, ++j) {
  196. codeReturn[i] = getGlyphCharIndex(j);
  197. }
  198. return codeReturn;
  199. }
  200. /**
  201. * Returns the logical bounds of this <code>GlyphVector</code>.
  202. * This method is used when positioning this <code>GlyphVector</code>
  203. * in relation to visually adjacent <code>GlyphVector</code> objects.
  204. * @return a {@link Rectangle2D} that is the logical bounds of this
  205. * <code>GlyphVector</code>.
  206. */
  207. public abstract Rectangle2D getLogicalBounds();
  208. /**
  209. * Returns the visual bounds of this <code>GlyphVector</code>
  210. * The visual bounds is the bounding box of the outline of this
  211. * <code>GlyphVector</code>. Because of rasterization and
  212. * alignment of pixels, it is possible that this box does not
  213. * enclose all pixels affected by rendering this <code>GlyphVector</code>.
  214. * @return a <code>Rectangle2D</code> that is the bounding box
  215. * of this <code>GlyphVector</code>.
  216. */
  217. public abstract Rectangle2D getVisualBounds();
  218. /**
  219. * Returns the pixel bounds of this <code>GlyphVector</code> when
  220. * rendered in a graphics with the given
  221. * <code>FontRenderContext</code> at the given location. The
  222. * renderFRC need not be the same as the
  223. * <code>FontRenderContext</code> of this
  224. * <code>GlyphVector</code>, and can be null. If it is null, the
  225. * <code>FontRenderContext</code> of this <code>GlyphVector</code>
  226. * is used. The default implementation returns the visual bounds,
  227. * offset to x, y and rounded out to the next integer value (i.e. returns an
  228. * integer rectangle which encloses the visual bounds) and
  229. * ignores the FRC. Subclassers should override this method.
  230. * @param renderFRC the <code>FontRenderContext</code> of the <code>Graphics</code>.
  231. * @param x the x-coordinate at which to render this <code>GlyphVector</code>.
  232. * @param y the y-coordinate at which to render this <code>GlyphVector</code>.
  233. * @return a <code>Rectangle</code> bounding the pixels that would be affected.
  234. * @since 1.4
  235. */
  236. public Rectangle getPixelBounds(FontRenderContext renderFRC, float x, float y) {
  237. Rectangle2D rect = getVisualBounds();
  238. int l = (int)Math.floor(rect.getX() + x);
  239. int t = (int)Math.floor(rect.getY() + y);
  240. int r = (int)Math.ceil(rect.getMaxX() + x);
  241. int b = (int)Math.ceil(rect.getMaxY() + y);
  242. return new Rectangle(l, t, r - l, b - t);
  243. }
  244. /**
  245. * Returns a <code>Shape</code> whose interior corresponds to the
  246. * visual representation of this <code>GlyphVector</code>.
  247. * @return a <code>Shape</code> that is the outline of this
  248. * <code>GlyphVector</code>.
  249. */
  250. public abstract Shape getOutline();
  251. /**
  252. * Returns a <code>Shape</code> whose interior corresponds to the
  253. * visual representation of this <code>GlyphVector</code> when
  254. * rendered at x, y.
  255. * @param x, y the coordinates of this <code>GlyphVector</code>.
  256. * @return a <code>Shape</code> that is the outline of this
  257. * <code>GlyphVector</code> when rendered at the specified
  258. * coordinates.
  259. */
  260. public abstract Shape getOutline(float x, float y);
  261. /**
  262. * Returns a <code>Shape</code> whose interior corresponds to the
  263. * visual representation of the specified glyph
  264. * within this <code>GlyphVector</code>.
  265. * The outline returned by this method is positioned around the
  266. * origin of each individual glyph.
  267. * @param glyphIndex the index into this <code>GlyphVector</code>
  268. * @return a <code>Shape</code> that is the outline of the glyph
  269. * at the specified <code>glyphIndex</code> of this
  270. * <code>GlyphVector</code>.
  271. * @throws IndexOutOfBoundsException if <code>glyphIndex</code>
  272. * is less than 0 or greater than or equal to the number
  273. * of glyphs in this <code>GlyphVector</code>
  274. */
  275. public abstract Shape getGlyphOutline(int glyphIndex);
  276. /**
  277. * Returns a <code>Shape</code> whose interior corresponds to the
  278. * visual representation of the specified glyph
  279. * within this <code>GlyphVector</code>, offset to x, y.
  280. * The outline returned by this method is positioned around the
  281. * origin of each individual glyph.
  282. * @param glyphIndex the index into this <code>GlyphVector</code>
  283. * @param x, y the coordinates of the location of this
  284. * <code>GlyphVector</code>.
  285. * @return a <code>Shape</code> that is the outline of the glyph
  286. * at the specified <code>glyphIndex</code> of this
  287. * <code>GlyphVector</code> when rendered at the specified
  288. * coordinates.
  289. * @throws IndexOutOfBoundsException if <code>glyphIndex</code>
  290. * is less than 0 or greater than or equal to the number
  291. * of glyphs in this <code>GlyphVector</code>
  292. * @since 1.4
  293. */
  294. public Shape getGlyphOutline(int glyphIndex, float x, float y) {
  295. Shape s = getGlyphOutline(glyphIndex);
  296. AffineTransform at = AffineTransform.getTranslateInstance(x,y);
  297. return at.createTransformedShape(s);
  298. }
  299. /**
  300. * Returns the position of the specified glyph relative to the
  301. * origin of this <code>GlyphVector</code>.
  302. * If <code>glyphIndex</code> equals the number of of glyphs in
  303. * this <code>GlyphVector</code>, this method returns the position after
  304. * the last glyph. This position is used to define the advance of
  305. * the entire <code>GlyphVector</code>.
  306. * @param glyphIndex the index into this <code>GlyphVector</code>
  307. * @return a {@link Point2D} object that is the position of the glyph
  308. * at the specified <code>glyphIndex</code>.
  309. * @throws IndexOutOfBoundsException if <code>glyphIndex</code>
  310. * is less than 0 or greater than the number of glyphs
  311. * in this <code>GlyphVector</code>
  312. * @see #setGlyphPosition
  313. */
  314. public abstract Point2D getGlyphPosition(int glyphIndex);
  315. /**
  316. * Sets the position of the specified glyph within this
  317. * <code>GlyphVector</code>.
  318. * If <code>glyphIndex</code> equals the number of of glyphs in
  319. * this <code>GlyphVector</code>, this method sets the position after
  320. * the last glyph. This position is used to define the advance of
  321. * the entire <code>GlyphVector</code>.
  322. * @param glyphIndex the index into this <code>GlyphVector</code>
  323. * @param newPos the <code>Point2D</code> at which to position the
  324. * glyph at the specified <code>glyphIndex</code>
  325. * @throws IndexOutOfBoundsException if <code>glyphIndex</code>
  326. * is less than 0 or greater than the number of glyphs
  327. * in this <code>GlyphVector</code>
  328. * @see #getGlyphPosition
  329. */
  330. public abstract void setGlyphPosition(int glyphIndex, Point2D newPos);
  331. /**
  332. * Returns the transform of the specified glyph within this
  333. * <code>GlyphVector</code>. The transform is relative to the
  334. * glyph position. If no special transform has been applied,
  335. * <code>null</code> can be returned. A null return indicates
  336. * an identity transform.
  337. * @param glyphIndex the index into this <code>GlyphVector</code>
  338. * @return an {@link AffineTransform} that is the transform of
  339. * the glyph at the specified <code>glyphIndex</code>.
  340. * @throws IndexOutOfBoundsException if <code>glyphIndex</code>
  341. * is less than 0 or greater than or equal to the number
  342. * of glyphs in this <code>GlyphVector</code>
  343. * @see #setGlyphTransform
  344. */
  345. public abstract AffineTransform getGlyphTransform(int glyphIndex);
  346. /**
  347. * Sets the transform of the specified glyph within this
  348. * <code>GlyphVector</code>. The transform is relative to the glyph
  349. * position. A <code>null</code> argument for <code>newTX</code>
  350. * indicates that no special transform is applied for the specified
  351. * glyph.
  352. * This method can be used to rotate, mirror, translate and scale the
  353. * glyph. Adding a transform can result in signifant performance changes.
  354. * @param glyphIndex the index into this <code>GlyphVector</code>
  355. * @param newTX the new transform of the glyph at <code>glyphIndex</code>
  356. * @throws IndexOutOfBoundsException if <code>glyphIndex</code>
  357. * is less than 0 or greater than or equal to the number
  358. * of glyphs in this <code>GlyphVector</code>
  359. * @see #getGlyphTransform
  360. */
  361. public abstract void setGlyphTransform(int glyphIndex, AffineTransform newTX);
  362. /**
  363. * Returns flags describing the global state of the GlyphVector.
  364. * Flags not described below are reserved. The default
  365. * implementation returns 0 (meaning false) for the position adjustments,
  366. * transforms, rtl, and complex flags.
  367. * Subclassers should override this method, and make sure
  368. * it correctly describes the GlyphVector and corresponds
  369. * to the results of related calls.
  370. * @return an int containing the flags describing the state
  371. * @see #FLAG_HAS_POSITION_ADJUSTMENTS
  372. * @see #FLAG_HAS_TRANSFORMS
  373. * @see #FLAG_RUN_RTL
  374. * @see #FLAG_COMPLEX_GLYPHS
  375. * @see #FLAG_MASK
  376. * @since 1.4
  377. */
  378. public int getLayoutFlags() {
  379. return 0;
  380. }
  381. /**
  382. * A flag used with getLayoutFlags that indicates that this <code>GlyphVector</code> has
  383. * per-glyph transforms.
  384. * @since 1.4
  385. */
  386. public static final int FLAG_HAS_TRANSFORMS = 1;
  387. /**
  388. * A flag used with getLayoutFlags that indicates that this <code>GlyphVector</code> has
  389. * position adjustments. When this is true, the glyph positions don't match the
  390. * accumulated default advances of the glyphs (for example, if kerning has been done).
  391. * @since 1.4
  392. */
  393. public static final int FLAG_HAS_POSITION_ADJUSTMENTS = 2;
  394. /**
  395. * A flag used with getLayoutFlags that indicates that this <code>GlyphVector</code> has
  396. * a right-to-left run direction. This refers to the glyph-to-char mapping and does
  397. * not imply that the visual locations of the glyphs are necessarily in this order,
  398. * although generally they will be.
  399. * @since 1.4
  400. */
  401. public static final int FLAG_RUN_RTL = 4;
  402. /**
  403. * A flag used with getLayoutFlags that indicates that this <code>GlyphVector</code> has
  404. * a complex glyph-to-char mapping (one that does not map glyphs to chars one-to-one in
  405. * strictly ascending or descending order matching the run direction).
  406. * @since 1.4
  407. */
  408. public static final int FLAG_COMPLEX_GLYPHS = 8;
  409. /**
  410. * A mask for supported flags from getLayoutFlags. Only bits covered by the mask
  411. * should be tested.
  412. * @since 1.4
  413. */
  414. public static final int FLAG_MASK =
  415. FLAG_HAS_TRANSFORMS |
  416. FLAG_HAS_POSITION_ADJUSTMENTS |
  417. FLAG_RUN_RTL |
  418. FLAG_COMPLEX_GLYPHS;
  419. /**
  420. * Returns an array of glyph positions for the specified glyphs.
  421. * This method is used for convenience and performance when
  422. * processing glyph positions.
  423. * If no array is passed in, a new array is created.
  424. * Even numbered array entries beginning with position zero are the X
  425. * coordinates of the glyph numbered <code>beginGlyphIndex + position/2</code>.
  426. * Odd numbered array entries beginning with position one are the Y
  427. * coordinates of the glyph numbered <code>beginGlyphIndex + (position-1)/2</code>.
  428. * If <code>beginGlyphIndex</code> equals the number of of glyphs in
  429. * this <code>GlyphVector</code>, this method gets the position after
  430. * the last glyph and this position is used to define the advance of
  431. * the entire <code>GlyphVector</code>.
  432. * @param beginGlyphIndex the index at which to begin retrieving
  433. * glyph positions
  434. * @param numEntries the number of glyphs to retrieve
  435. * @param positionReturn the array that receives the glyph positions
  436. * and is then returned.
  437. * @return an array of glyph positions specified by
  438. * <code>beginGlyphIndex</code> and <code>numEntries</code>.
  439. * @throws IllegalArgumentException if <code>numEntries</code> is
  440. * less than 0
  441. * @throws IndexOutOfBoundsException if <code>beginGlyphIndex</code>
  442. * is less than 0
  443. * @throws IndexOutOfBoundsException if the sum of
  444. * <code>beginGlyphIndex</code> and <code>numEntries</code>
  445. * is greater than the number of glyphs in this
  446. * <code>GlyphVector</code> plus one
  447. */
  448. public abstract float[] getGlyphPositions(int beginGlyphIndex, int numEntries,
  449. float[] positionReturn);
  450. /**
  451. * Returns the logical bounds of the specified glyph within this
  452. * <code>GlyphVector</code>.
  453. * These logical bounds have a total of four edges, with two edges
  454. * parallel to the baseline under the glyph's transform and the other two
  455. * edges are shared with adjacent glyphs if they are present. This
  456. * method is useful for hit-testing of the specified glyph,
  457. * positioning of a caret at the leading or trailing edge of a glyph,
  458. * and for drawing a highlight region around the specified glyph.
  459. * @param glyphIndex the index into this <code>GlyphVector</code>
  460. * that corresponds to the glyph from which to retrieve its logical
  461. * bounds
  462. * @return a <code>Shape</code> that is the logical bounds of the
  463. * glyph at the specified <code>glyphIndex</code>.
  464. * @throws IndexOutOfBoundsException if <code>glyphIndex</code>
  465. * is less than 0 or greater than or equal to the number
  466. * of glyphs in this <code>GlyphVector</code>
  467. * @see #getGlyphVisualBounds
  468. */
  469. public abstract Shape getGlyphLogicalBounds(int glyphIndex);
  470. /**
  471. * Returns the visual bounds of the specified glyph within the
  472. * <code>GlyphVector</code>.
  473. * The bounds returned by this method is positioned around the
  474. * origin of each individual glyph.
  475. * @param glyphIndex the index into this <code>GlyphVector</code>
  476. * that corresponds to the glyph from which to retrieve its visual
  477. * bounds
  478. * @return a <code>Shape</code> that is the visual bounds of the
  479. * glyph at the specified <code>glyphIndex</code>.
  480. * @throws IndexOutOfBoundsException if <code>glyphIndex</code>
  481. * is less than 0 or greater than or equal to the number
  482. * of glyphs in this <code>GlyphVector</code>
  483. * @see #getGlyphLogicalBounds
  484. */
  485. public abstract Shape getGlyphVisualBounds(int glyphIndex);
  486. /**
  487. * Returns the pixel bounds of the glyph at index when this
  488. * <code>GlyphVector</code> is rendered in a <code>Graphics</code> with the
  489. * given <code>FontRenderContext</code> at the given location. The
  490. * renderFRC need not be the same as the
  491. * <code>FontRenderContext</code> of this
  492. * <code>GlyphVector</code>, and can be null. If it is null, the
  493. * <code>FontRenderContext</code> of this <code>GlyphVector</code>
  494. * is used. The default implementation returns the visual bounds of the glyph,
  495. * offset to x, y and rounded out to the next integer value, and
  496. * ignores the FRC. Subclassers should override this method.
  497. * @param index the index of the glyph.
  498. * @param renderFRC the <code>FontRenderContext</code> of the <code>Graphics</code>.
  499. * @param x, y the position at which to render this <code>GlyphVector</code>.
  500. * @return a <code>Rectangle</code> bounding the pixels that would be affected.
  501. * @since 1.4
  502. */
  503. public Rectangle getGlyphPixelBounds(int index, FontRenderContext renderFRC, float x, float y) {
  504. Rectangle2D rect = getGlyphVisualBounds(index).getBounds2D();
  505. int l = (int)Math.floor(rect.getX() + x);
  506. int t = (int)Math.floor(rect.getY() + y);
  507. int r = (int)Math.ceil(rect.getMaxX() + x);
  508. int b = (int)Math.ceil(rect.getMaxY() + y);
  509. return new Rectangle(l, t, r - l, b - t);
  510. }
  511. /**
  512. * Returns the metrics of the glyph at the specified index into
  513. * this <code>GlyphVector</code>.
  514. * @param glyphIndex the index into this <code>GlyphVector</code>
  515. * that corresponds to the glyph from which to retrieve its metrics
  516. * @return a {@link GlyphMetrics} object that represents the
  517. * metrics of the glyph at the specified <code>glyphIndex</code>
  518. * into this <code>GlyphVector</code>.
  519. * @throws IndexOutOfBoundsException if <code>glyphIndex</code>
  520. * is less than 0 or greater than or equal to the number
  521. * of glyphs in this <code>GlyphVector</code>
  522. */
  523. public abstract GlyphMetrics getGlyphMetrics(int glyphIndex);
  524. /**
  525. * Returns the justification information for the glyph at
  526. * the specified index into this <code>GlyphVector</code>.
  527. * @param glyphIndex the index into this <code>GlyphVector</code>
  528. * that corresponds to the glyph from which to retrieve its
  529. * justification properties
  530. * @return a {@link GlyphJustificationInfo} object that
  531. * represents the justification properties of the glyph at the
  532. * specified <code>glyphIndex</code> into this
  533. * <code>GlyphVector</code>.
  534. * @throws IndexOutOfBoundsException if <code>glyphIndex</code>
  535. * is less than 0 or greater than or equal to the number
  536. * of glyphs in this <code>GlyphVector</code>
  537. */
  538. public abstract GlyphJustificationInfo getGlyphJustificationInfo(int glyphIndex);
  539. //
  540. // general utility methods
  541. //
  542. /**
  543. * Tests if the specified <code>GlyphVector</code> exactly
  544. * equals this <code>GlyphVector</code>.
  545. * @param set the specified <code>GlyphVector</code> to test
  546. * @return <code>true</code> if the specified
  547. * <code>GlyphVector</code> equals this <code>GlyphVector</code>
  548. * <code>false</code> otherwise.
  549. */
  550. public abstract boolean equals(GlyphVector set);
  551. }