44 |
import java.awt.font.FontRenderContext; |
import java.awt.font.FontRenderContext; |
45 |
import java.awt.font.GlyphVector; |
import java.awt.font.GlyphVector; |
46 |
import java.awt.font.LineMetrics; |
import java.awt.font.LineMetrics; |
47 |
|
import java.awt.font.TextLayout; |
48 |
import java.awt.geom.AffineTransform; |
import java.awt.geom.AffineTransform; |
49 |
import java.awt.geom.Rectangle2D; |
import java.awt.geom.Rectangle2D; |
50 |
import java.awt.peer.FontPeer; |
import java.awt.peer.FontPeer; |
378 |
* |
* |
379 |
* @return The logical name of the font. |
* @return The logical name of the font. |
380 |
* |
* |
381 |
* @see getFamily() |
* @see #getFamily() |
382 |
* @see getFontName() |
* @see #getFontName() |
383 |
*/ |
*/ |
384 |
public String getName () |
public String getName () |
385 |
{ |
{ |
454 |
* |
* |
455 |
* @since 1.2 |
* @since 1.2 |
456 |
* |
* |
457 |
* @see getName() |
* @see #getName() |
458 |
* @see getFontName() |
* @see #getFontName() |
459 |
* @see GraphicsEnvironment.getAvailableFontFamilyNames() |
* @see GraphicsEnvironment#getAvailableFontFamilyNames() |
460 |
*/ |
*/ |
461 |
public String getFamily () |
public String getFamily () |
462 |
{ |
{ |
465 |
|
|
466 |
/** |
/** |
467 |
* Returns integer code representing the sum of style flags of this font, a |
* Returns integer code representing the sum of style flags of this font, a |
468 |
* combination of either {@link PLAIN}, {@link BOLD}, or {@link ITALIC}. |
* combination of either {@link #PLAIN}, {@link #BOLD}, or {@link #ITALIC}. |
469 |
* |
* |
470 |
* @return code representing the style of this font. |
* @return code representing the style of this font. |
471 |
* |
* |
472 |
* @see isPlain() |
* @see #isPlain() |
473 |
* @see isBold() |
* @see #isBold() |
474 |
* @see isItalic() |
* @see #isItalic() |
475 |
*/ |
*/ |
476 |
public int getStyle () |
public int getStyle () |
477 |
{ |
{ |
556 |
} |
} |
557 |
|
|
558 |
/** |
/** |
559 |
* Creates a new font with point size 1 and {@link PLAIN} style, |
* Creates a new font with point size 1 and {@link #PLAIN} style, |
560 |
* reading font data from the provided input stream. The resulting font |
* reading font data from the provided input stream. The resulting font |
561 |
* can have further fonts derived from it using its |
* can have further fonts derived from it using its |
562 |
* <code>deriveFont</code> method. |
* <code>deriveFont</code> method. |
563 |
* |
* |
564 |
* @param fontFormat Integer code indicating the format the font data is |
* @param fontFormat Integer code indicating the format the font data is |
565 |
* in.Currently this can only be {@link TRUETYPE_FONT}. |
* in.Currently this can only be {@link #TRUETYPE_FONT}. |
566 |
* @param is {@link InputStream} from which font data will be read. This |
* @param is {@link InputStream} from which font data will be read. This |
567 |
* stream is not closed after font data is extracted. |
* stream is not closed after font data is extracted. |
568 |
* |
* |
595 |
* @return A new {@link GlyphVector} containing glyphs mapped from str, |
* @return A new {@link GlyphVector} containing glyphs mapped from str, |
596 |
* through the font's cmap table. |
* through the font's cmap table. |
597 |
* |
* |
598 |
* @see layoutGlyphVector() |
* @see #layoutGlyphVector(FontRenderContext, char[], int, int, int) |
599 |
*/ |
*/ |
600 |
public GlyphVector createGlyphVector (FontRenderContext ctx, String str) |
public GlyphVector createGlyphVector (FontRenderContext ctx, String str) |
601 |
{ |
{ |
615 |
* @return A new {@link GlyphVector} containing glyphs mapped from str, |
* @return A new {@link GlyphVector} containing glyphs mapped from str, |
616 |
* through the font's cmap table. |
* through the font's cmap table. |
617 |
* |
* |
618 |
* @see layoutGlyphVector() |
* @see #layoutGlyphVector(FontRenderContext, char[], int, int, int) |
619 |
*/ |
*/ |
620 |
public GlyphVector createGlyphVector (FontRenderContext ctx, CharacterIterator i) |
public GlyphVector createGlyphVector (FontRenderContext ctx, CharacterIterator i) |
621 |
{ |
{ |
635 |
* @return A new {@link GlyphVector} containing glyphs mapped from str, |
* @return A new {@link GlyphVector} containing glyphs mapped from str, |
636 |
* through the font's cmap table. |
* through the font's cmap table. |
637 |
* |
* |
638 |
* @see layoutGlyphVector() |
* @see #layoutGlyphVector(FontRenderContext, char[], int, int, int) |
639 |
*/ |
*/ |
640 |
public GlyphVector createGlyphVector (FontRenderContext ctx, char[] chars) |
public GlyphVector createGlyphVector (FontRenderContext ctx, char[] chars) |
641 |
{ |
{ |
653 |
* @return A new {@link GlyphVector} containing glyphs mapped from str, |
* @return A new {@link GlyphVector} containing glyphs mapped from str, |
654 |
* through the font's cmap table. |
* through the font's cmap table. |
655 |
* |
* |
656 |
* @see layoutGlyphVector() |
* @see #layoutGlyphVector(FontRenderContext, char[], int, int, int) |
657 |
* |
* |
658 |
* @specnote This method is documented to perform character-to-glyph |
* @specnote This method is documented to perform character-to-glyph |
659 |
* conversions, in the Sun documentation, but its second parameter name is |
* conversions, in the Sun documentation, but its second parameter name is |
777 |
* |
* |
778 |
* @return A map of chracter attributes which this font currently has set. |
* @return A map of chracter attributes which this font currently has set. |
779 |
* |
* |
780 |
* @see getAvailableAttributes() |
* @see #getAvailableAttributes() |
781 |
* @see java.text.AttributedCharacterIterator.Attribute |
* @see java.text.AttributedCharacterIterator.Attribute |
782 |
* @see java.awt.font.TextAttribute |
* @see java.awt.font.TextAttribute |
783 |
*/ |
*/ |
791 |
* |
* |
792 |
* @return An array of chracter attribute keys which this font understands. |
* @return An array of chracter attribute keys which this font understands. |
793 |
* |
* |
794 |
* @see getAttributes() |
* @see #getAttributes() |
795 |
* @see java.text.AttributedCharacterIterator.Attribute |
* @see java.text.AttributedCharacterIterator.Attribute |
796 |
* @see java.awt.font.TextAttribute |
* @see java.awt.font.TextAttribute |
797 |
*/ |
*/ |
801 |
} |
} |
802 |
|
|
803 |
/** |
/** |
804 |
* Returns a baseline code (one of {@link ROMAN_BASELINE}, {@link |
* Returns a baseline code (one of {@link #ROMAN_BASELINE}, {@link |
805 |
* CENTER_BASELINE} or {@link HANGING_BASELINE}) indicating which baseline |
* #CENTER_BASELINE} or {@link #HANGING_BASELINE}) indicating which baseline |
806 |
* this font will measure baseline offsets for, when presenting glyph |
* this font will measure baseline offsets for, when presenting glyph |
807 |
* metrics for a given character. |
* metrics for a given character. |
808 |
* |
* |
819 |
* |
* |
820 |
* @since 1.2 |
* @since 1.2 |
821 |
* |
* |
822 |
* @see LineMetrics.getBaselineOffsets() |
* @see LineMetrics#getBaselineOffsets() |
823 |
*/ |
*/ |
824 |
public byte getBaselineFor (char c) |
public byte getBaselineFor (char c) |
825 |
{ |
{ |
839 |
* |
* |
840 |
* @since 1.2 |
* @since 1.2 |
841 |
* |
* |
842 |
* @see getName() |
* @see #getName() |
843 |
* @see getFontName() |
* @see #getFontName() |
844 |
* @see GraphicsEnvironment.getAvailableFontFamilyNames() |
* @see GraphicsEnvironment#getAvailableFontFamilyNames() |
845 |
* @see Locale |
* @see Locale |
846 |
*/ |
*/ |
847 |
public String getFamily (Locale lc) |
public String getFamily (Locale lc) |
858 |
* |
* |
859 |
* @since 1.2 |
* @since 1.2 |
860 |
* |
* |
861 |
* @see TextAttribure |
* @see java.awt.font.TextAttribute |
862 |
*/ |
*/ |
863 |
public static Font getFont (Map attributes) |
public static Font getFont (Map attributes) |
864 |
{ |
{ |
875 |
* |
* |
876 |
* @since 1.2 |
* @since 1.2 |
877 |
* |
* |
878 |
* @see getName() |
* @see #getName() |
879 |
* @see getFamily() |
* @see #getFamily() |
880 |
*/ |
*/ |
881 |
public String getFontName () |
public String getFontName () |
882 |
{ |
{ |
895 |
* |
* |
896 |
* @since 1.2 |
* @since 1.2 |
897 |
* |
* |
898 |
* @see getName() |
* @see #getName() |
899 |
* @see getFamily() |
* @see #getFamily() |
900 |
*/ |
*/ |
901 |
public String getFontName (Locale lc) |
public String getFontName (Locale lc) |
902 |
{ |
{ |
905 |
|
|
906 |
/** |
/** |
907 |
* Returns the italic angle of this font, a measurement of its slant when |
* Returns the italic angle of this font, a measurement of its slant when |
908 |
* style is {@link ITALIC}. The precise meaning is the inverse slope of a |
* style is {@link #ITALIC}. The precise meaning is the inverse slope of a |
909 |
* caret line which "best measures" the font's italic posture. |
* caret line which "best measures" the font's italic posture. |
910 |
* |
* |
911 |
* @return The italic angle. |
* @return The italic angle. |
912 |
* |
* |
913 |
* @see TextAttribute.POSTURE |
* @see java.awt.font.TextAttribute#POSTURE |
914 |
*/ |
*/ |
915 |
public float getItalicAngle () |
public float getItalicAngle () |
916 |
{ |
{ |
1029 |
* |
* |
1030 |
* @since 1.2 |
* @since 1.2 |
1031 |
* |
* |
1032 |
* @see getName() |
* @see #getName() |
1033 |
* @see getFamily() |
* @see #getFamily() |
1034 |
* @see getFontName() |
* @see #getFontName() |
1035 |
*/ |
*/ |
1036 |
public String getPSName () |
public String getPSName () |
1037 |
{ |
{ |
1043 |
* font in the specified {@link FontRenderContext}. This box will include the |
* font in the specified {@link FontRenderContext}. This box will include the |
1044 |
* glyph origin, ascent, advance, height, and leading, but may not include all |
* glyph origin, ascent, advance, height, and leading, but may not include all |
1045 |
* diacritics or accents. To get the complete visual bounding box of all the |
* diacritics or accents. To get the complete visual bounding box of all the |
1046 |
* glyphs in a run of text, use the {@link TextLayout#getBounds} method of |
* glyphs in a run of text, use the {@link TextLayout#getBounds} method of |
1047 |
* {@link TextLayout}. |
* {@link TextLayout}. |
1048 |
* |
* |
1049 |
* @param str The string to measure. |
* @param str The string to measure. |
1051 |
* |
* |
1052 |
* @return A bounding box covering the logical bounds of the specified text. |
* @return A bounding box covering the logical bounds of the specified text. |
1053 |
* |
* |
1054 |
* @see createGlyphVector() |
* @see #createGlyphVector(FontRenderContext, String) |
1055 |
*/ |
*/ |
1056 |
public Rectangle2D getStringBounds (String str, FontRenderContext frc) |
public Rectangle2D getStringBounds (String str, FontRenderContext frc) |
1057 |
{ |
{ |
1078 |
* |
* |
1079 |
* @since 1.2 |
* @since 1.2 |
1080 |
* |
* |
1081 |
* @see createGlyphVector() |
* @see #createGlyphVector(FontRenderContext, String) |
1082 |
*/ |
*/ |
1083 |
public Rectangle2D getStringBounds (String str, int begin, |
public Rectangle2D getStringBounds (String str, int begin, |
1084 |
int limit, FontRenderContext frc) |
int limit, FontRenderContext frc) |
1106 |
* |
* |
1107 |
* @since 1.2 |
* @since 1.2 |
1108 |
* |
* |
1109 |
* @see createGlyphVector() |
* @see #createGlyphVector(FontRenderContext, CharacterIterator) |
1110 |
*/ |
*/ |
1111 |
public Rectangle2D getStringBounds (CharacterIterator ci, int begin, |
public Rectangle2D getStringBounds (CharacterIterator ci, int begin, |
1112 |
int limit, FontRenderContext frc) |
int limit, FontRenderContext frc) |
1134 |
* |
* |
1135 |
* @since 1.2 |
* @since 1.2 |
1136 |
* |
* |
1137 |
* @see createGlyphVector() |
* @see #createGlyphVector(FontRenderContext, char[]) |
1138 |
*/ |
*/ |
1139 |
public Rectangle2D getStringBounds (char[] chars, int begin, |
public Rectangle2D getStringBounds (char[] chars, int begin, |
1140 |
int limit, FontRenderContext frc) |
int limit, FontRenderContext frc) |
1164 |
* @return Whether this font has uniform line metrics. |
* @return Whether this font has uniform line metrics. |
1165 |
* |
* |
1166 |
* @see LineMetrics |
* @see LineMetrics |
1167 |
* @see getLineMetrics() |
* @see #getLineMetrics(String, FontRenderContext) |
1168 |
*/ |
*/ |
1169 |
public boolean hasUniformLineMetrics () |
public boolean hasUniformLineMetrics () |
1170 |
{ |
{ |
1190 |
* |
* |
1191 |
* Bidirectional (bidi) layout is not performed in this method; text |
* Bidirectional (bidi) layout is not performed in this method; text |
1192 |
* should have its bidi direction specified with one of the flags {@link |
* should have its bidi direction specified with one of the flags {@link |
1193 |
* LAYOUT_LEFT_TO_RIGHT} or {@link LAYOUT_RIGHT_TO_LEFT}. |
* #LAYOUT_LEFT_TO_RIGHT} or {@link #LAYOUT_RIGHT_TO_LEFT}. |
1194 |
* |
* |
1195 |
* Some types of layout (notably Arabic glyph shaping) may examine context |
* Some types of layout (notably Arabic glyph shaping) may examine context |
1196 |
* characters beyond the bounds of the indicated range, in order to select |
* characters beyond the bounds of the indicated range, in order to select |
1197 |
* an appropriate shape. The flags {@link LAYOUT_NO_START_CONTEXT} and |
* an appropriate shape. The flags {@link #LAYOUT_NO_START_CONTEXT} and |
1198 |
* {@link LAYOUT_NO_LIMIT_CONTEXT} can be provided to prevent these extra |
* {@link #LAYOUT_NO_LIMIT_CONTEXT} can be provided to prevent these extra |
1199 |
* context areas from being examined, for instance if they contain invalid |
* context areas from being examined, for instance if they contain invalid |
1200 |
* characters. |
* characters. |
1201 |
* |
* |