Showing the changes to java/pkg/sun/font/TextLineComponent.java (1 of 18352 files). Show all
Unified · Split
| @@ -0,0 +1,126 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (c) 1998, 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 | ||
| 23 | * questions. | ||
| 24 | */ | ||
| 25 | |||
| 26 | /* | ||
| 27 | * (C) Copyright IBM Corp. 1998-2003 All Rights Reserved | ||
| 28 | * | ||
| 29 | */ | ||
| 30 | |||
| 31 | package sun.font; | ||
| 32 | |||
| 33 | import java.awt.Graphics2D; | ||
| 34 | import java.awt.Rectangle; | ||
| 35 | import java.awt.Shape; | ||
| 36 | import java.awt.font.GlyphJustificationInfo; | ||
| 37 | import java.awt.font.FontRenderContext; | ||
| 38 | import java.awt.font.LineMetrics; | ||
| 39 | import java.awt.geom.AffineTransform; | ||
| 40 | import java.awt.geom.Rectangle2D; | ||
| 41 | |||
| 42 | public interface TextLineComponent { | ||
| 43 | |||
| 44 | public CoreMetrics getCoreMetrics(); | ||
| 45 | public void draw(Graphics2D g2d, float x, float y); | ||
| 46 | public Rectangle2D getCharVisualBounds(int index); | ||
| 47 | public Rectangle2D getVisualBounds(); | ||
| 48 | public float getAdvance(); | ||
| 49 | public Shape getOutline(float x, float y); | ||
| 50 | |||
| 51 | public int getNumCharacters(); | ||
| 52 | |||
| 53 | public float getCharX(int index); | ||
| 54 | public float getCharY(int index); | ||
| 55 | public float getCharAdvance(int index); | ||
| 56 | public boolean caretAtOffsetIsValid(int index); | ||
| 57 | |||
| 58 | // measures characters in context, in logical order | ||
| 59 | public int getLineBreakIndex(int start, float width); | ||
| 60 | |||
| 61 | // measures characters in context, in logical order | ||
| 62 | public float getAdvanceBetween(int start, int limit); | ||
| 63 | |||
| 64 | public Rectangle2D getLogicalBounds(); | ||
| 65 | |||
| 66 | public Rectangle2D getItalicBounds(); | ||
| 67 | |||
| 68 | public AffineTransform getBaselineTransform(); | ||
| 69 | |||
| 70 | // return true if this wraps a glyphvector with no baseline rotation and | ||
| 71 | // has no styles requiring complex pixel bounds calculations. | ||
| 72 | public boolean isSimple(); | ||
| 73 | |||
| 74 | // return the pixel bounds if we wrap a glyphvector, else throw an | ||
| 75 | // internal error | ||
| 76 | public Rectangle getPixelBounds(FontRenderContext frc, float x, float y); | ||
| 77 | |||
| 78 | /** | ||
| 79 | * Force subset characters to run left-to-right. | ||
| 80 | */ | ||
| 81 | public static final int LEFT_TO_RIGHT = 0; | ||
| 82 | /** | ||
| 83 | * Force subset characters to run right-to-left. | ||
| 84 | */ | ||
| 85 | public static final int RIGHT_TO_LEFT = 1; | ||
| 86 | |||
| 87 | /** | ||
| 88 | * Leave subset character direction and ordering unchanged. | ||
| 89 | */ | ||
| 90 | public static final int UNCHANGED = 2; | ||
| 91 | |||
| 92 | /** | ||
| 93 | * Return a TextLineComponent for the characters in the range | ||
| 94 | * start, limit. The range is relative to this TextLineComponent | ||
| 95 | * (ie, the first character is at 0). | ||
| 96 | * @param dir one of the constants LEFT_TO_RIGHT, RIGHT_TO_LEFT, or UNCHANGED | ||
| 97 | */ | ||
| 98 | public TextLineComponent getSubset(int start, int limit, int dir); | ||
| 99 | |||
| 100 | /** | ||
| 101 | * Return the number of justification records this uses. | ||
| 102 | */ | ||
| 103 | public int getNumJustificationInfos(); | ||
| 104 | |||
| 105 | /** | ||
| 106 | * Return GlyphJustificationInfo objects for the characters between | ||
| 107 | * charStart and charLimit, starting at offset infoStart. Infos | ||
| 108 | * will be in visual order. All positions between infoStart and | ||
| 109 | * getNumJustificationInfos will be set. If a position corresponds | ||
| 110 | * to a character outside the provided range, it is set to null. | ||
| 111 | */ | ||
| 112 | public void getJustificationInfos(GlyphJustificationInfo[] infos, int infoStart, int charStart, int charLimit); | ||
| 113 | |||
| 114 | /** | ||
| 115 | * Apply deltas to the data in this component, starting at offset | ||
| 116 | * deltaStart, and return the new component. There are two floats | ||
| 117 | * for each justification info, for a total of 2 * getNumJustificationInfos. | ||
| 118 | * The first delta is the left adjustment, the second is the right | ||
| 119 | * adjustment. | ||
| 120 | * <p> | ||
| 121 | * If flags[0] is true on entry, rejustification is allowed. If | ||
| 122 | * the new component requires rejustification (ligatures were | ||
| 123 | * formed or split), flags[0] will be set on exit. | ||
| 124 | */ | ||
| 125 | public TextLineComponent applyJustificationDeltas(float[] deltas, int deltaStart, boolean[] flags); | ||
| 126 | } | ||