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