1 /* ClasspathFontPeer.java -- Font peer used by GNU Classpath. 2 Copyright (C) 2003 Free Software Foundation, Inc. 3 4 This file is part of GNU Classpath. 5 6 GNU Classpath is free software; you can redistribute it and/or modify 7 it under the terms of the GNU General Public License as published by 8 the Free Software Foundation; either version 2, or (at your option) 9 any later version. 10 11 GNU Classpath is distributed in the hope that it will be useful, but 12 WITHOUT ANY WARRANTY; without even the implied warranty of 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 General Public License for more details. 15 16 You should have received a copy of the GNU General Public License 17 along with GNU Classpath; see the file COPYING. If not, write to the 18 Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 19 02111-1307 USA. 20 21 Linking this library statically or dynamically with other modules is 22 making a combined work based on this library. Thus, the terms and 23 conditions of the GNU General Public License cover the whole 24 combination. 25 26 As a special exception, the copyright holders of this library give you 27 permission to link this library with independent modules to produce an 28 executable, regardless of the license terms of these independent 29 modules, and to copy and distribute the resulting executable under 30 terms of your choice, provided that you also meet, for each linked 31 independent module, the terms and conditions of the license of that 32 module. An independent module is a module which is not derived from 33 or based on this library. If you modify this library, you may extend 34 this exception to your version of the library, but you are not 35 obligated to do so. If you do not wish to do so, delete this 36 exception statement from your version. */ 37 38 39 package gnu.java.awt.peer; 40 41 import java.awt.*; 42 import java.awt.peer.*; 43 import java.awt.font.*; 44 import java.awt.geom.*; 45 import java.text.*; 46 import java.util.*; 47 import gnu.java.awt.*; 48 49 50 /** 51 * A peer for fonts that are used inside Classpath. The purpose of 52 * this interface is to abstract from platform-specific font handling 53 * in the Classpath implementation of java.awt.Font and related 54 * classes. 55 * 56 * <p><b>State kept by the peer:</b> a peer is generated for each Font 57 * object in the default implementation. If you wish to share peers between 58 * fonts, you will need to subclass both ClasspathFontPeer and 59 * {@link ClasspathToolKit}. 60 * 61 * <p><b>Thread Safety:</b> Methods of this interface may be called 62 * from arbitrary threads at any time. Implementations of the 63 * <code>ClasspathFontPeer</code> interface are required to perform 64 * the necessary synchronization. 65 * 66 * @see java.awt.Font#getPeer 67 * @see java.awt.Toolkit#getFontPeer 68 * 69 * @author Sascha Brawer (brawer@dandelis.ch) 70 * @author Graydon Hoare (graydon@redhat.com) 71 */ 72 public abstract class ClasspathFontPeer 73 implements FontPeer 74 { 75 76 /*************************************************************************/ 77 78 /* 79 * Instance Variables 80 */ 81 82 /** 83 * The 3 names of this font. all fonts have 3 names, some of which 84 * may be equal: 85 * 86 * logical -- name the font was constructed from 87 * family -- a designer or brand name (Helvetica) 88 * face -- specific instance of a design (Helvetica Regular) 89 * 90 * @see isLogicalFontName 91 */ 92 93 protected String logicalName; 94 protected String familyName; 95 protected String faceName; 96 97 /** 98 * The font style, which is a combination (by OR-ing) of the font style 99 * constants PLAIN, BOLD and ITALIC, in this class. 100 */ 101 protected int style; 102 103 /** 104 * The font point size. A point is 1/72 of an inch. 105 */ 106 protected float size; 107 108 /** 109 * The affine transformation the font is currently subject to. 110 */ 111 protected AffineTransform transform; 112 tk()113 protected static ClasspathToolkit tk() 114 { 115 return (ClasspathToolkit)(Toolkit.getDefaultToolkit ()); 116 } 117 118 /* 119 * Confusingly, a Logical Font is a concept unrelated to 120 * a Font's Logical Name. 121 * 122 * A Logical Font is one of 6 built-in, abstract font types 123 * which must be supported by any java environment: SansSerif, 124 * Serif, Monospaced, Dialog, and DialogInput. 125 * 126 * A Font's Logical Name is the name the font was constructed 127 * from. This might be the name of a Logical Font, or it might 128 * be the name of a Font Face. 129 */ 130 isLogicalFontName(String name)131 protected static boolean isLogicalFontName(String name) 132 { 133 String uname = name.toUpperCase (); 134 return (uname.equals ("SANSSERIF") || 135 uname.equals ("SERIF") || 136 uname.equals ("MONOSPACED") || 137 uname.equals ("DIALOG") || 138 uname.equals ("DIALOGINPUT")); 139 } 140 logicalFontNameToFaceName(String name)141 protected static String logicalFontNameToFaceName (String name) 142 { 143 String uname = name.toUpperCase (); 144 if (uname.equals("SANSSERIF")) 145 return "Helvetica"; 146 else if (uname.equals ("SERIF")) 147 return "Times"; 148 else if (uname.equals ("MONOSPACED")) 149 return "Courier"; 150 else if (uname.equals ("DIALOG")) 151 return "Helvetica"; 152 else if (uname.equals ("DIALOGINPUT")) 153 return "Helvetica"; 154 else 155 return "Helvetica"; 156 } 157 faceNameToFamilyName(String name)158 protected static String faceNameToFamilyName (String name) 159 { 160 return name; 161 } 162 copyStyleToAttrs(int style, Map attrs)163 protected static void copyStyleToAttrs (int style, Map attrs) 164 { 165 if ((style & Font.BOLD) == Font.BOLD) 166 attrs.put (TextAttribute.WEIGHT, TextAttribute.WEIGHT_BOLD); 167 else 168 attrs.put (TextAttribute.WEIGHT, TextAttribute.WEIGHT_REGULAR); 169 170 if ((style & Font.ITALIC) == Font.ITALIC) 171 attrs.put (TextAttribute.POSTURE, TextAttribute.POSTURE_OBLIQUE); 172 else 173 attrs.put (TextAttribute.POSTURE, TextAttribute.POSTURE_REGULAR); 174 } 175 copyFamilyToAttrs(String fam, Map attrs)176 protected static void copyFamilyToAttrs (String fam, Map attrs) 177 { 178 if (fam != null) 179 attrs.put (TextAttribute.FAMILY, fam); 180 } 181 copySizeToAttrs(float size, Map attrs)182 protected static void copySizeToAttrs (float size, Map attrs) 183 { 184 attrs.put (TextAttribute.SIZE, new Float (size)); 185 } 186 copyTransformToAttrs(AffineTransform trans, Map attrs)187 protected static void copyTransformToAttrs (AffineTransform trans, Map attrs) 188 { 189 if (trans != null) 190 attrs.put(TextAttribute.TRANSFORM, new TransformAttribute (trans)); 191 } 192 193 setStandardAttributes(String name, String family, int style, float size, AffineTransform trans)194 protected void setStandardAttributes (String name, String family, int style, 195 float size, AffineTransform trans) 196 { 197 this.logicalName = name; 198 199 if (isLogicalFontName (name)) 200 this.faceName = logicalFontNameToFaceName (name); 201 else 202 this.faceName = name; 203 204 if (family != null) 205 this.familyName = family; 206 else 207 this.familyName = faceNameToFamilyName (faceName); 208 209 this.style = style; 210 this.size = size; 211 this.transform = trans; 212 } 213 214 setStandardAttributes(String name, Map attribs)215 protected void setStandardAttributes (String name, Map attribs) 216 { 217 String family = this.familyName; 218 AffineTransform trans = this.transform; 219 float size = this.size; 220 int style = this.style; 221 222 if (attribs.containsKey (TextAttribute.FAMILY)) 223 family = (String) attribs.get (TextAttribute.FAMILY); 224 225 if (name == null) 226 name = "SansSerif"; 227 228 if (attribs.containsKey (TextAttribute.WEIGHT)) 229 { 230 Float weight = (Float) attribs.get (TextAttribute.WEIGHT); 231 if (weight.floatValue () >= TextAttribute.WEIGHT_BOLD.floatValue ()) 232 style += Font.BOLD; 233 } 234 235 if (attribs.containsKey (TextAttribute.POSTURE)) 236 { 237 Float posture = (Float) attribs.get (TextAttribute.POSTURE); 238 if (posture.floatValue () >= TextAttribute.POSTURE_OBLIQUE.floatValue ()) 239 style += Font.ITALIC; 240 } 241 242 if (attribs.containsKey (TextAttribute.SIZE)) 243 { 244 Float sz = (Float) attribs.get (TextAttribute.SIZE); 245 size = sz.floatValue (); 246 } 247 248 if (attribs.containsKey (TextAttribute.TRANSFORM)) 249 { 250 TransformAttribute ta = (TransformAttribute) 251 attribs.get(TextAttribute.TRANSFORM); 252 trans = ta.getTransform (); 253 } 254 255 setStandardAttributes (name, family, style, size, trans); 256 } 257 getStandardAttributes(Map attrs)258 protected void getStandardAttributes (Map attrs) 259 { 260 copyFamilyToAttrs (this.familyName, attrs); 261 copySizeToAttrs (this.size, attrs); 262 copyStyleToAttrs (this.style, attrs); 263 copyTransformToAttrs (this.transform, attrs); 264 } 265 266 267 /* Begin public API */ 268 ClasspathFontPeer(String name, Map attrs)269 public ClasspathFontPeer (String name, Map attrs) 270 { 271 setStandardAttributes (name, attrs); 272 } 273 ClasspathFontPeer(String name, int style, int size)274 public ClasspathFontPeer (String name, int style, int size) 275 { 276 setStandardAttributes (name, (String)null, style, 277 (float)size, (AffineTransform)null); 278 } 279 280 /** 281 * Implementation of {@link Font#getName} 282 * 283 * @param font the font this peer is being called from. This may be 284 * useful if you are sharing peers between Font objects. Otherwise it may 285 * be ignored. 286 */ 287 getName(Font font)288 public String getName (Font font) 289 { 290 return logicalName; 291 } 292 293 /** 294 * Implementation of {@link Font#getFamily()} 295 * 296 * @param font the font this peer is being called from. This may be 297 * useful if you are sharing peers between Font objects. Otherwise it may 298 * be ignored. 299 */ 300 getFamily(Font font)301 public String getFamily (Font font) 302 { 303 return familyName; 304 } 305 306 /** 307 * Implementation of {@link Font#getFamily(Locale)} 308 * 309 * @param font the font this peer is being called from. This may be 310 * useful if you are sharing peers between Font objects. Otherwise it may 311 * be ignored. 312 */ 313 getFamily(Font font, Locale lc)314 public String getFamily (Font font, Locale lc) 315 { 316 return familyName; 317 } 318 319 /** 320 * Implementation of {@link Font#getFontName()} 321 * 322 * @param font the font this peer is being called from. This may be 323 * useful if you are sharing peers between Font objects. Otherwise it may 324 * be ignored. 325 */ 326 getFontName(Font font)327 public String getFontName (Font font) 328 { 329 return faceName; 330 } 331 332 /** 333 * Implementation of {@link Font#getFontName(Locale)} 334 * 335 * @param font the font this peer is being called from. This may be 336 * useful if you are sharing peers between Font objects. Otherwise it may 337 * be ignored. 338 */ 339 getFontName(Font font, Locale lc)340 public String getFontName (Font font, Locale lc) 341 { 342 return faceName; 343 } 344 345 /** 346 * Implementation of {@link Font#getSize} 347 * 348 * @param font the font this peer is being called from. This may be 349 * useful if you are sharing peers between Font objects. Otherwise it may 350 * be ignored. 351 */ 352 getSize(Font font)353 public float getSize (Font font) 354 { 355 return size; 356 } 357 358 /** 359 * Implementation of {@link Font#isPlain} 360 * 361 * @param font the font this peer is being called from. This may be 362 * useful if you are sharing peers between Font objects. Otherwise it may 363 * be ignored. 364 */ 365 isPlain(Font font)366 public boolean isPlain (Font font) 367 { 368 return style == Font.PLAIN; 369 } 370 371 /** 372 * Implementation of {@link Font#isBold} 373 * 374 * @param font the font this peer is being called from. This may be 375 * useful if you are sharing peers between Font objects. Otherwise it may 376 * be ignored. 377 */ 378 isBold(Font font)379 public boolean isBold (Font font) 380 { 381 return ((style & Font.BOLD) == Font.BOLD); 382 } 383 384 /** 385 * Implementation of {@link Font#isItalic} 386 * 387 * @param font the font this peer is being called from. This may be 388 * useful if you are sharing peers between Font objects. Otherwise it may 389 * be ignored. 390 */ 391 isItalic(Font font)392 public boolean isItalic (Font font) 393 { 394 return ((style & Font.ITALIC) == Font.ITALIC); 395 } 396 397 /** 398 * Implementation of {@link Font#deriveFont(float)} 399 * 400 * @param font the font this peer is being called from. This may be 401 * useful if you are sharing peers between Font objects. Otherwise it may 402 * be ignored. 403 */ 404 deriveFont(Font font, float size)405 public Font deriveFont (Font font, float size) 406 { 407 Map attrs = new HashMap (); 408 getStandardAttributes (attrs); 409 copySizeToAttrs (size, attrs); 410 return tk().getFont (logicalName, attrs); 411 } 412 413 /** 414 * Implementation of {@link Font#deriveFont(int)} 415 * 416 * @param font the font this peer is being called from. This may be 417 * useful if you are sharing peers between Font objects. Otherwise it may 418 * be ignored. 419 */ 420 deriveFont(Font font, int style)421 public Font deriveFont (Font font, int style) 422 { 423 Map attrs = new HashMap (); 424 getStandardAttributes (attrs); 425 copyStyleToAttrs (style, attrs); 426 return tk().getFont (logicalName, attrs); 427 } 428 429 /** 430 * Implementation of {@link Font#deriveFont(int, AffineTransform)} 431 * 432 * @param font the font this peer is being called from. This may be 433 * useful if you are sharing peers between Font objects. Otherwise it may 434 * be ignored. 435 */ 436 deriveFont(Font font, int style, AffineTransform t)437 public Font deriveFont (Font font, int style, AffineTransform t) 438 { 439 Map attrs = new HashMap (); 440 getStandardAttributes (attrs); 441 copyStyleToAttrs (style, attrs); 442 copyTransformToAttrs (t, attrs); 443 return tk().getFont (logicalName, attrs); 444 } 445 446 /** 447 * Implementation of {@link Font#deriveFont(Map)} 448 * 449 * @param font the font this peer is being called from. This may be 450 * useful if you are sharing peers between Font objects. Otherwise it may 451 * be ignored. 452 */ 453 deriveFont(Font font, Map attrs)454 public Font deriveFont (Font font, Map attrs) 455 { 456 return tk().getFont (logicalName, attrs); 457 } 458 459 /** 460 * Implementation of {@link Font#getAttributes()} 461 * 462 * @param font the font this peer is being called from. This may be 463 * useful if you are sharing peers between Font objects. Otherwise it may 464 * be ignored. 465 */ 466 getAttributes(Font font)467 public Map getAttributes (Font font) 468 { 469 HashMap h = new HashMap (); 470 getStandardAttributes (h); 471 return h; 472 } 473 474 /** 475 * Implementation of {@link Font#getAvailableAttributes()} 476 * 477 * @param font the font this peer is being called from. This may be 478 * useful if you are sharing peers between Font objects. Otherwise it may 479 * be ignored. 480 */ 481 getAvailableAttributes(Font font)482 public AttributedCharacterIterator.Attribute[] getAvailableAttributes(Font font) 483 { 484 AttributedCharacterIterator.Attribute a[] = 485 new AttributedCharacterIterator.Attribute[5]; 486 a[0] = TextAttribute.FAMILY; 487 a[1] = TextAttribute.SIZE; 488 a[2] = TextAttribute.POSTURE; 489 a[3] = TextAttribute.WEIGHT; 490 a[4] = TextAttribute.TRANSFORM; 491 return a; 492 } 493 494 /** 495 * Implementation of {@link Font#getTransform()} 496 * 497 * @param font the font this peer is being called from. This may be 498 * useful if you are sharing peers between Font objects. Otherwise it may 499 * be ignored. 500 */ 501 getTransform(Font font)502 public AffineTransform getTransform (Font font) 503 { 504 return transform; 505 } 506 507 /** 508 * Implementation of {@link Font#isTransformed()} 509 * 510 * @param font the font this peer is being called from. This may be 511 * useful if you are sharing peers between Font objects. Otherwise it may 512 * be ignored. 513 */ 514 isTransformed(Font font)515 public boolean isTransformed (Font font) 516 { 517 return ! transform.isIdentity (); 518 } 519 520 /** 521 * Implementation of {@link Font#getItalicAngle()} 522 * 523 * @param font the font this peer is being called from. This may be 524 * useful if you are sharing peers between Font objects. Otherwise it may 525 * be ignored. 526 */ 527 getItalicAngle(Font font)528 public float getItalicAngle (Font font) 529 { 530 if ((style & Font.ITALIC) == Font.ITALIC) 531 return TextAttribute.POSTURE_OBLIQUE.floatValue (); 532 else 533 return TextAttribute.POSTURE_REGULAR.floatValue (); 534 } 535 536 537 /** 538 * Implementation of {@link Font#getStyle()} 539 * 540 * @param font the font this peer is being called from. This may be 541 * useful if you are sharing peers between Font objects. Otherwise it may 542 * be ignored. 543 */ 544 getStyle(Font font)545 public int getStyle (Font font) 546 { 547 return style; 548 } 549 550 551 552 553 /* Remaining methods are abstract */ 554 555 /** 556 * Implementation of {@link Font#canDisplay(char)} 557 * 558 * @param font the font this peer is being called from. This may be 559 * useful if you are sharing peers between Font objects. Otherwise it may 560 * be ignored. 561 */ 562 canDisplay(Font font, char c)563 public abstract boolean canDisplay (Font font, char c); 564 565 /** 566 * Implementation of {@link Font#canDisplay(String)}, 567 * {@link Font#canDisplay(char [], int, int)}, and 568 * {@link Font#canDisplay(CharacterIterator, int, int)}. 569 * 570 * @param font the font this peer is being called from. This may be 571 * useful if you are sharing peers between Font objects. Otherwise it may 572 * be ignored. 573 */ 574 canDisplayUpTo(Font font, CharacterIterator i, int start, int limit)575 public abstract int canDisplayUpTo (Font font, CharacterIterator i, int start, int limit); 576 577 578 /** 579 * Returns the name of this font face inside the family, for example 580 * <i>“Light”</i>. 581 * 582 * <p>This method is currently not used by {@link Font}. However, 583 * this name would be needed by any serious desktop publishing 584 * application. 585 * 586 * @param font the font whose sub-family name is requested. 587 * 588 * @param locale the locale for which to localize the name. If 589 * <code>locale</code> is <code>null</code>, the returned name is 590 * localized to the user’s default locale. 591 * 592 * @return the name of the face inside its family, or 593 * <code>null</code> if the font does not provide a sub-family name. 594 */ 595 getSubFamilyName(Font font, Locale locale)596 public abstract String getSubFamilyName (Font font, Locale locale); 597 598 599 /** 600 * Implementation of {@link Font#getPSName()} 601 * 602 * @param font the font this peer is being called from. This may be 603 * useful if you are sharing peers between Font objects. Otherwise it may 604 * be ignored. 605 */ 606 getPostScriptName(Font font)607 public abstract String getPostScriptName (Font font); 608 609 610 /** 611 * Implementation of {@link Font#getNumGlyphs()} 612 * 613 * @param font the font this peer is being called from. This may be 614 * useful if you are sharing peers between Font objects. Otherwise it may 615 * be ignored. 616 */ 617 getNumGlyphs(Font font)618 public abstract int getNumGlyphs (Font font); 619 620 621 /** 622 * Implementation of {@link Font#getMissingGlyphCode()} 623 * 624 * @param font the font this peer is being called from. This may be 625 * useful if you are sharing peers between Font objects. Otherwise it may 626 * be ignored. 627 */ 628 getMissingGlyphCode(Font font)629 public abstract int getMissingGlyphCode (Font font); 630 631 632 /** 633 * Implementation of {@link Font#getBaselineFor(char)} 634 * 635 * @param font the font this peer is being called from. This may be 636 * useful if you are sharing peers between Font objects. Otherwise it may 637 * be ignored. 638 */ 639 getBaselineFor(Font font, char c)640 public abstract byte getBaselineFor (Font font, char c); 641 642 643 /** 644 * Returns a name for the specified glyph. This is useful for 645 * generating PostScript or PDF files that embed some glyphs of a 646 * font. If the implementation follows glyph naming conventions 647 * specified by Adobe, search engines can extract the original text 648 * from the generated PostScript and PDF files. 649 * 650 * <p>This method is currently not used by GNU Classpath. However, 651 * it would be very useful for someone wishing to write a good 652 * PostScript or PDF stream provider for the 653 * <code>javax.print</code> package. 654 * 655 * <p><b>Names are not unique:</b> Under some rare circumstances, 656 * the same name can be returned for different glyphs. It is 657 * therefore recommended that printer drivers check whether the same 658 * name has already been returned for antoher glyph, and make the 659 * name unique by adding the string ".alt" followed by the glyph 660 * index.</p> 661 * 662 * <p>This situation would occur for an OpenType or TrueType font 663 * that has a <code>post</code> table of format 3 and provides a 664 * mapping from glyph IDs to Unicode sequences through a 665 * <code>Zapf</code> table. If the same sequence of Unicode 666 * codepoints leads to different glyphs (depending on contextual 667 * position, for example, or on typographic sophistication level), 668 * the same name would get synthesized for those glyphs. To avoid 669 * this, the font peer would have to go through the names of all 670 * glyphs, which would make this operation very inefficient with 671 * large fonts. 672 * 673 * @param font the font containing the glyph whose name is 674 * requested. 675 * 676 * @param glyphIndex the glyph whose name the caller wants to 677 * retrieve. 678 * 679 * @return the glyph name, or <code>null</code> if a font does not 680 * provide glyph names. 681 */ 682 getGlyphName(Font font, int glyphIndex)683 public abstract String getGlyphName (Font font, int glyphIndex); 684 685 686 /** 687 * Implementation of {@link 688 * Font#createGlyphVector(FontRenderContext, String)}, {@link 689 * Font#createGlyphVector(FontRenderContext, char[])}, and {@link 690 * Font#createGlyphVector(FontRenderContext, CharacterIterator)}. 691 * 692 * @param font the font object that the created GlyphVector will return 693 * when it gets asked for its font. This argument is needed because the 694 * public API of {@link GlyphVector} works with {@link java.awt.Font}, 695 * not with font peers. 696 */ 697 createGlyphVector(Font font, FontRenderContext frc, CharacterIterator ci)698 public abstract GlyphVector createGlyphVector (Font font, 699 FontRenderContext frc, 700 CharacterIterator ci); 701 702 703 /** 704 * Implementation of {@link Font#createGlyphVector(FontRenderContext, 705 * int[])}. 706 * 707 * @param font the font object that the created GlyphVector will return 708 * when it gets asked for its font. This argument is needed because the 709 * public API of {@link GlyphVector} works with {@link java.awt.Font}, 710 * not with font peers. 711 */ 712 createGlyphVector(Font font, FontRenderContext ctx, int[] glyphCodes)713 public abstract GlyphVector createGlyphVector (Font font, 714 FontRenderContext ctx, 715 int[] glyphCodes); 716 717 718 /** 719 * Implementation of {@link Font#layoutGlyphVector(FontRenderContext, 720 * char[], int, int, int)}. 721 * 722 * @param font the font object that the created GlyphVector will return 723 * when it gets asked for its font. This argument is needed because the 724 * public API of {@link GlyphVector} works with {@link java.awt.Font}, 725 * not with font peers. 726 */ 727 layoutGlyphVector(Font font, FontRenderContext frc, char[] chars, int start, int limit, int flags)728 public abstract GlyphVector layoutGlyphVector (Font font, 729 FontRenderContext frc, 730 char[] chars, int start, 731 int limit, int flags); 732 733 734 /** 735 * Implementation of {@link Font#getFontMetrics()} 736 * 737 * @param font the font this peer is being called from. This may be 738 * useful if you are sharing peers between Font objects. Otherwise it may 739 * be ignored. 740 */ 741 getFontMetrics(Font font)742 public abstract FontMetrics getFontMetrics (Font font); 743 744 745 /** 746 * Implementation of {@link Font#hasUniformLineMetrics()} 747 * 748 * @param font the font this peer is being called from. This may be 749 * useful if you are sharing peers between Font objects. Otherwise it may 750 * be ignored. 751 */ 752 hasUniformLineMetrics(Font font)753 public abstract boolean hasUniformLineMetrics (Font font); 754 755 756 /** 757 * Implementation of {@link Font#getLineMetrics(CharacterIterator, int, 758 * int, FontRenderContext)} 759 * 760 * @param font the font this peer is being called from. This may be 761 * useful if you are sharing peers between Font objects. Otherwise it may 762 * be ignored. 763 */ 764 getLineMetrics(Font font, CharacterIterator ci, int begin, int limit, FontRenderContext rc)765 public abstract LineMetrics getLineMetrics (Font font, 766 CharacterIterator ci, 767 int begin, int limit, 768 FontRenderContext rc); 769 770 /** 771 * Implementation of {@link Font#getMaxCharBounds(FontRenderContext)} 772 * 773 * @param font the font this peer is being called from. This may be 774 * useful if you are sharing peers between Font objects. Otherwise it may 775 * be ignored. 776 */ 777 getMaxCharBounds(Font font, FontRenderContext rc)778 public abstract Rectangle2D getMaxCharBounds (Font font, 779 FontRenderContext rc); 780 781 /** 782 * Implementation of {@link Font#getStringBounds(CharacterIterator, int, 783 * int, FontRenderContext)} 784 * 785 * @param font the font this peer is being called from. This may be 786 * useful if you are sharing peers between Font objects. Otherwise it may 787 * be ignored. 788 */ 789 getStringBounds(Font font, CharacterIterator ci, int begin, int limit, FontRenderContext frc)790 public abstract Rectangle2D getStringBounds (Font font, 791 CharacterIterator ci, 792 int begin, int limit, 793 FontRenderContext frc); 794 795 } 796