0N/A/*
2362N/A * Copyright (c) 1998, 2003, Oracle and/or its affiliates. All rights reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
2362N/A * published by the Free Software Foundation. Oracle designates this
0N/A * particular file as subject to the "Classpath" exception as provided
2362N/A * by Oracle in the LICENSE file that accompanied this code.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A *
2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A * or visit www.oracle.com if you need additional information or have any
2362N/A * questions.
0N/A */
0N/A/*
0N/A *
0N/A * (C) Copyright IBM Corp. 1998-2003- All Rights Reserved.
0N/A */
0N/A
0N/Apackage sun.font;
0N/A
0N/Aimport java.awt.Font;
0N/A
0N/Aimport java.awt.font.GlyphJustificationInfo;
0N/Aimport java.awt.font.LineMetrics;
0N/A
0N/Aimport java.awt.geom.Point2D;
0N/Aimport java.awt.geom.Rectangle2D;
0N/A
0N/A/**
0N/A * An extension of TextLabel that maintains information
0N/A * about characters.
0N/A */
0N/A
0N/Apublic abstract class ExtendedTextLabel extends TextLabel
0N/A implements TextLineComponent{
0N/A /**
0N/A * Return the number of characters represented by this label.
0N/A */
0N/A public abstract int getNumCharacters();
0N/A
0N/A /**
0N/A * Return the line metrics for all text in this label.
0N/A */
0N/A public abstract CoreMetrics getCoreMetrics();
0N/A
0N/A /**
0N/A * Return the x location of the character at the given logical index.
0N/A */
0N/A public abstract float getCharX(int logicalIndex);
0N/A
0N/A /**
0N/A * Return the y location of the character at the given logical index.
0N/A */
0N/A public abstract float getCharY(int logicalIndex);
0N/A
0N/A /**
0N/A * Return the advance of the character at the given logical index.
0N/A */
0N/A public abstract float getCharAdvance(int logicalIndex);
0N/A
0N/A /**
0N/A * Return the visual bounds of the character at the given logical index.
0N/A * This bounds encloses all the pixels of the character when the label is rendered
0N/A * at x, y.
0N/A */
0N/A public abstract Rectangle2D getCharVisualBounds(int logicalIndex, float x, float y);
0N/A
0N/A /**
0N/A * Return the visual index of the character at the given logical index.
0N/A */
0N/A public abstract int logicalToVisual(int logicalIndex);
0N/A
0N/A /**
0N/A * Return the logical index of the character at the given visual index.
0N/A */
0N/A public abstract int visualToLogical(int visualIndex);
0N/A
0N/A /**
0N/A * Return the logical index of the character, starting with the character at
0N/A * logicalStart, whose accumulated advance exceeds width. If the advances of
0N/A * all characters do not exceed width, return getNumCharacters. If width is
0N/A * less than zero, return logicalStart - 1.
0N/A */
0N/A public abstract int getLineBreakIndex(int logicalStart, float width);
0N/A
0N/A /**
0N/A * Return the accumulated advances of all characters between logicalStart and
0N/A * logicalLimit.
0N/A */
0N/A public abstract float getAdvanceBetween(int logicalStart, int logicalLimit);
0N/A
0N/A /**
0N/A * Return whether a caret can exist on the leading edge of the
0N/A * character at offset. If the character is part of a ligature
0N/A * (for example) a caret may not be appropriate at offset.
0N/A */
0N/A public abstract boolean caretAtOffsetIsValid(int offset);
0N/A
0N/A /**
0N/A * A convenience overload of getCharVisualBounds that defaults the label origin
0N/A * to 0, 0.
0N/A */
0N/A public Rectangle2D getCharVisualBounds(int logicalIndex) {
0N/A return getCharVisualBounds(logicalIndex, 0, 0);
0N/A }
0N/A
0N/A public abstract TextLineComponent getSubset(int start, int limit, int dir);
0N/A
0N/A /**
0N/A * Return the number of justification records this uses.
0N/A */
0N/A public abstract int getNumJustificationInfos();
0N/A
0N/A /**
0N/A * Return GlyphJustificationInfo objects for the characters between
0N/A * charStart and charLimit, starting at offset infoStart. Infos
0N/A * will be in visual order. All positions between infoStart and
0N/A * getNumJustificationInfos will be set. If a position corresponds
0N/A * to a character outside the provided range, it is set to null.
0N/A */
0N/A public abstract void getJustificationInfos(GlyphJustificationInfo[] infos, int infoStart, int charStart, int charLimit);
0N/A
0N/A /**
0N/A * Apply deltas to the data in this component, starting at offset
0N/A * deltaStart, and return the new component. There are two floats
0N/A * for each justification info, for a total of 2 * getNumJustificationInfos.
0N/A * The first delta is the left adjustment, the second is the right
0N/A * adjustment.
0N/A * <p>
0N/A * If flags[0] is true on entry, rejustification is allowed. If
0N/A * the new component requires rejustification (ligatures were
0N/A * formed or split), flags[0] will be set on exit.
0N/A */
0N/A public abstract TextLineComponent applyJustificationDeltas(float[] deltas, int deltaStart, boolean[] flags);
0N/A}