OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libjava/] [classpath/] [java/] [awt/] [font/] [GlyphVector.java] - Blame information for rev 771

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 771 jeremybenn
/* GlyphVector.java
2
   Copyright (C) 2002 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 java.awt.font;
40
 
41
import java.awt.Font;
42
import java.awt.Rectangle;
43
import java.awt.Shape;
44
import java.awt.geom.AffineTransform;
45
import java.awt.geom.Point2D;
46
import java.awt.geom.Rectangle2D;
47
 
48
/**
49
 * @author Lillian Angel (langel at redhat dot com)
50
 * @author Michael Koch
51
 */
52
public abstract class GlyphVector implements Cloneable
53
{
54
  public static final int FLAG_COMPLEX_GLYPHS = 8;
55
  public static final int FLAG_HAS_POSITION_ADJUSTMENTS = 2;
56
  public static final int FLAG_HAS_TRANSFORMS = 1;
57
  public static final int FLAG_MASK = 15;
58
  public static final int FLAG_RUN_RTL = 4;
59
 
60
  /**
61
   * Constructs a <code>GlyphVector</code> object.
62
   */
63
  public GlyphVector ()
64
  {
65
  }
66
 
67
  public abstract boolean equals (GlyphVector set);
68
 
69
  public abstract Font getFont ();
70
 
71
  public abstract FontRenderContext getFontRenderContext ();
72
 
73
  public int getGlyphCharIndex (int glyphIndex)
74
  {
75
    return glyphIndex;
76
  }
77
 
78
  public int[] getGlyphCharIndices(int beginGlyphIndex, int numEntries,
79
                                   int[] codeReturn)
80
  {
81
    if (codeReturn == null)
82
      codeReturn = new int[numEntries];
83
 
84
    int i = 0;
85
    int j = beginGlyphIndex;
86
    while (j < numEntries)
87
      codeReturn[i++] = getGlyphCharIndex(j++);
88
 
89
    return codeReturn;
90
  }
91
 
92
  public abstract int getGlyphCode (int glyphIndex);
93
 
94
  public abstract int[] getGlyphCodes (int beginGlyphIndex, int numEntries,
95
                                       int[] codeReturn);
96
 
97
  public abstract GlyphJustificationInfo getGlyphJustificationInfo
98
    (int glyphIndex);
99
 
100
  public abstract Shape getGlyphLogicalBounds (int glyphIndex);
101
 
102
  public abstract GlyphMetrics getGlyphMetrics (int glyphIndex);
103
 
104
  public abstract Shape getGlyphOutline (int glyphIndex);
105
 
106
  public Shape getGlyphOutline(int glyphIndex, float x, float y)
107
  {
108
    Shape s = getGlyphOutline(glyphIndex);
109
 
110
    // This is the only way to translate the origin of a shape
111
    AffineTransform at = AffineTransform.getTranslateInstance(x, y);
112
    return at.createTransformedShape(s);
113
  }
114
 
115
  public Rectangle getGlyphPixelBounds(int index, FontRenderContext renderFRC,
116
                                       float x, float y)
117
  {
118
    Rectangle bounds = new Rectangle();
119
    Rectangle2D rect = getGlyphVisualBounds(index).getBounds2D();
120
 
121
    bounds.x = (int) (rect.getX() + x);
122
    bounds.y = (int) (rect.getY() + y);
123
    bounds.width = (int) rect.getMaxX() - bounds.x;
124
    bounds.height = (int) rect.getMaxY() - bounds.y;
125
 
126
    return bounds;
127
  }
128
 
129
  public abstract Point2D getGlyphPosition (int glyphIndex);
130
 
131
  public abstract float[] getGlyphPositions (int beginGlyphIndex,
132
                                             int numEntries,
133
                                             float[] positionReturn);
134
 
135
  public abstract AffineTransform getGlyphTransform (int glyphIndex);
136
 
137
  public abstract Shape getGlyphVisualBounds (int glyphIndex);
138
 
139
  public int getLayoutFlags()
140
  {
141
    return 0;
142
  }
143
 
144
  public abstract Rectangle2D getLogicalBounds ();
145
 
146
  public abstract int getNumGlyphs ();
147
 
148
  public abstract Shape getOutline ();
149
 
150
  public abstract Shape getOutline (float x, float y);
151
 
152
  public Rectangle getPixelBounds (FontRenderContext renderFRC,
153
                                   float x, float y)
154
  {
155
    Rectangle bounds = new Rectangle();
156
    Rectangle2D rect = getVisualBounds();
157
 
158
    bounds.x = (int) (rect.getX() + x);
159
    bounds.y = (int) (rect.getY() + y);
160
    bounds.width = (int) rect.getMaxX() - bounds.x;
161
    bounds.height = (int) rect.getMaxY() - bounds.y;
162
 
163
    return bounds;
164
  }
165
 
166
  public abstract Rectangle2D getVisualBounds ();
167
 
168
  public abstract void performDefaultLayout ();
169
 
170
  public abstract void setGlyphPosition (int glyphIndex, Point2D newPos);
171
 
172
  public abstract void setGlyphTransform (int glyphIndex,
173
                                          AffineTransform newTX);
174
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.