1 /*
2 * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
24 */
25 /*
26 * (C) Copyright IBM Corp. 2005, All Rights Reserved.
27 */
28 package java.awt.font;
29
30 import java.awt.geom.Point2D;
31
32 /**
33 * LayoutPath provides a mapping between locations relative to the
34 * baseline and points in user space. Locations consist of an advance
35 * along the baseline, and an offset perpendicular to the baseline at
36 * the advance. Positive values along the perpendicular are in the
37 * direction that is 90 degrees clockwise from the baseline vector.
38 * Locations are represented as a {@code Point2D}, where x is the advance and
39 * y is the offset.
40 *
41 * @since 1.6
42 */
43 public abstract class LayoutPath {
44 /**
45 * Convert a point in user space to a location relative to the
46 * path. The location is chosen so as to minimize the distance
47 * from the point to the path (e.g., the magnitude of the offset
48 * will be smallest). If there is more than one such location,
49 * the location with the smallest advance is chosen.
50 * @param point the point to convert. If it is not the same
51 * object as location, point will remain unmodified by this call.
52 * @param location a {@code Point2D} to hold the returned location.
53 * It can be the same object as point.
54 * @return true if the point is associated with the portion of the
55 * path preceding the location, false if it is associated with
56 * the portion following. The default, if the location is not at
57 * a break or sharp bend in the path, is to return true.
58 * @throws NullPointerException if point or location is null
59 * @since 1.6
60 */
61 public abstract boolean pointToPath(Point2D point, Point2D location);
62
63 /**
|
1 /*
2 * Copyright (c) 2005, 2020, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
24 */
25 /*
26 * (C) Copyright IBM Corp. 2005, All Rights Reserved.
27 */
28 package java.awt.font;
29
30 import java.awt.geom.Point2D;
31
32 /**
33 * LayoutPath provides a mapping between locations relative to the
34 * baseline and points in user space. Locations consist of an advance
35 * along the baseline, and an offset perpendicular to the baseline at
36 * the advance. Positive values along the perpendicular are in the
37 * direction that is 90 degrees clockwise from the baseline vector.
38 * Locations are represented as a {@code Point2D}, where x is the advance and
39 * y is the offset.
40 *
41 * @since 1.6
42 */
43 public abstract class LayoutPath {
44
45 /**
46 * Creates a {@code LayoutPath}.
47 */
48 protected LayoutPath() {}
49
50 /**
51 * Convert a point in user space to a location relative to the
52 * path. The location is chosen so as to minimize the distance
53 * from the point to the path (e.g., the magnitude of the offset
54 * will be smallest). If there is more than one such location,
55 * the location with the smallest advance is chosen.
56 * @param point the point to convert. If it is not the same
57 * object as location, point will remain unmodified by this call.
58 * @param location a {@code Point2D} to hold the returned location.
59 * It can be the same object as point.
60 * @return true if the point is associated with the portion of the
61 * path preceding the location, false if it is associated with
62 * the portion following. The default, if the location is not at
63 * a break or sharp bend in the path, is to return true.
64 * @throws NullPointerException if point or location is null
65 * @since 1.6
66 */
67 public abstract boolean pointToPath(Point2D point, Point2D location);
68
69 /**
|