1 /* Point.java -- Holds information for one point on a glyph outline
2 Copyright (C) 2006 Free Software Foundation, Inc.
4 This file is part of GNU Classpath.
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)
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.
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
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
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. */
39 package gnu
.java
.awt
.font
.opentype
.truetype
;
41 import gnu
.java
.lang
.CPStringBuilder
;
44 * Encapsulates information regarding one point on a glyph outline.
48 public static final short FLAG_TOUCHED_X
= 1;
49 public static final short FLAG_TOUCHED_Y
= 2;
50 public static final short FLAG_ON_CURVE
= 4;
51 public static final short FLAG_CONTOUR_END
= 8;
52 public static final short FLAG_WEAK_INTERPOLATION
= 16;
53 public static final short FLAG_INFLECTION
= 32;
54 public static final short FLAG_DONE_X
= 64;
55 public static final short FLAG_DONE_Y
= 128;
60 public static final int DIR_RIGHT
= 1;
65 public static final int DIR_LEFT
= -1;
70 public static final int DIR_UP
= 2;
75 public static final int DIR_DOWN
= -2;
78 * The original x coordinate in font units.
83 * The original y coordinate in font units.
88 * The x coordinate scaled to the target.
93 * The y coordinate scaled to the target.
98 * The final hinted and scaled x coordinate.
103 * The final hinted and scaled y coordinate.
116 * The previous point in the contour.
121 * The next point in the contour.
126 * The in-direction of the point, according to the DIR_* constants of this
132 * The out-direction of the point, according to the DIR_* constants of this
137 public Point
getNext()
142 public void setNext(Point next
)
147 public Point
getPrev()
152 public void setPrev(Point prev
)
157 public int getOrigX()
162 public void setOrigX(int origX
)
167 public int getOrigY()
172 public void setOrigY(int origY
)
177 public int getInDir()
182 public void setInDir(int inDir
)
187 public int getOutDir()
192 public void setOutDir(int outDir
)
194 this.outDir
= outDir
;
197 public short getFlags()
202 public void setFlags(short flags
)
207 public void addFlags(short flags
)
212 public boolean isControlPoint()
214 return (flags
& FLAG_ON_CURVE
) == 0;
222 public void setU(int u
)
232 public void setV(int v
)
237 public String
toString()
239 CPStringBuilder s
= new CPStringBuilder();
240 s
.append("[Point] origX: ");
242 s
.append(", origY: ");
244 // TODO: Add more info when needed.
253 public void setX(int x
)
263 public void setY(int y
)
268 public int getScaledX()
273 public void setScaledX(int scaledX
)
275 this.scaledX
= scaledX
;
278 public int getScaledY()
283 public void setScaledY(int scaledY
)
285 this.scaledY
= scaledY
;