001: /*
002:
003: Licensed to the Apache Software Foundation (ASF) under one or more
004: contributor license agreements. See the NOTICE file distributed with
005: this work for additional information regarding copyright ownership.
006: The ASF licenses this file to You under the Apache License, Version 2.0
007: (the "License"); you may not use this file except in compliance with
008: the License. You may obtain a copy of the License at
009:
010: http://www.apache.org/licenses/LICENSE-2.0
011:
012: Unless required by applicable law or agreed to in writing, software
013: distributed under the License is distributed on an "AS IS" BASIS,
014: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
015: See the License for the specific language governing permissions and
016: limitations under the License.
017:
018: */
019: package org.apache.batik.gvt.font;
020:
021: import java.awt.font.FontRenderContext;
022: import java.text.CharacterIterator;
023:
024: /**
025: * An interface for all GVT font classes.
026: *
027: * @author <a href="mailto:bella.robinson@cmis.csiro.au">Bella Robinson</a>
028: * @version $Id: GVTFont.java 478188 2006-11-22 15:19:17Z dvholten $
029: */
030: public interface GVTFont {
031:
032: /**
033: * Checks if this Font has a glyph for the specified character.
034: */
035: boolean canDisplay(char c);
036:
037: /**
038: * Indicates whether or not this Font can display the characters in the
039: * specified text starting at start and ending at limit.
040: */
041: int canDisplayUpTo(char[] text, int start, int limit);
042:
043: /**
044: * Indicates whether or not this Font can display the the characters in
045: * the specified CharacterIterator starting at start and ending at limit.
046: */
047: int canDisplayUpTo(CharacterIterator iter, int start, int limit);
048:
049: /**
050: * Indicates whether or not this Font can display a specified String.
051: */
052: int canDisplayUpTo(String str);
053:
054: /**
055: * Returns a new GlyphVector object created with the specified array of
056: * characters and the specified FontRenderContext.
057: */
058: GVTGlyphVector createGlyphVector(FontRenderContext frc, char[] chars);
059:
060: /**
061: * Returns a new GlyphVector object created with the specified
062: * CharacterIterator and the specified FontRenderContext.
063: */
064: GVTGlyphVector createGlyphVector(FontRenderContext frc,
065: CharacterIterator ci);
066:
067: /**
068: * Returns a new GlyphVector object created with the specified integer
069: * array and the specified FontRenderContext.
070: */
071: GVTGlyphVector createGlyphVector(FontRenderContext frc,
072: int[] glyphCodes, CharacterIterator ci);
073:
074: /**
075: * Returns a new GlyphVector object created with the specified String and
076: * the specified FontRenderContext.
077: */
078: GVTGlyphVector createGlyphVector(FontRenderContext frc, String str);
079:
080: /**
081: * Creates a new Font object by replicating the current Font object and
082: * applying a new size to it.
083: */
084: GVTFont deriveFont(float size);
085:
086: /**
087: * Returns the font family name of this font.
088: */
089: String getFamilyName();
090:
091: /**
092: * Returns a GVTLineMetrics object created with the specified arguments.
093: */
094: GVTLineMetrics getLineMetrics(char[] chars, int beginIndex,
095: int limit, FontRenderContext frc);
096:
097: /**
098: * Returns a GVTLineMetrics object created with the specified arguments.
099: */
100: GVTLineMetrics getLineMetrics(CharacterIterator ci, int beginIndex,
101: int limit, FontRenderContext frc);
102:
103: /**
104: * Returns a GVTLineMetrics object created with the specified String and
105: * FontRenderContext.
106: */
107: GVTLineMetrics getLineMetrics(String str, FontRenderContext frc);
108:
109: /**
110: * Returns a GVTLineMetrics object created with the specified arguments.
111: */
112: GVTLineMetrics getLineMetrics(String str, int beginIndex,
113: int limit, FontRenderContext frc);
114:
115: /**
116: * Returns the size of this font.
117: */
118: float getSize();
119:
120: /**
121: * Returns the horizontal kerning value of this glyph pair.
122: */
123: float getVKern(int glyphCode1, int glyphCode2);
124:
125: /**
126: * Returns the vertical kerning value of this glyph pair.
127: */
128: float getHKern(int glyphCode1, int glyphCode2);
129:
130: String toString();
131: }
|