J. Duke | 319a3b9 | 2007-12-01 00:00:00 +0000 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright 1998-2003 Sun Microsystems, Inc. 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. Sun designates this |
| 8 | * particular file as subject to the "Classpath" exception as provided |
| 9 | * by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, |
| 22 | * CA 95054 USA or visit www.sun.com if you need additional information or |
| 23 | * have any questions. |
| 24 | */ |
| 25 | /* |
| 26 | * |
| 27 | * (C) Copyright IBM Corp. 1998-2003 - All Rights Reserved |
| 28 | */ |
| 29 | |
| 30 | package sun.font; |
| 31 | |
| 32 | import java.awt.Font; |
| 33 | import java.awt.font.FontRenderContext; |
| 34 | import java.awt.font.LineMetrics; |
| 35 | |
| 36 | /** |
| 37 | * A text source represents text for rendering, plus context information. |
| 38 | * All text in the source uses the same font, metrics, and render context, |
| 39 | * and is at the same bidi level. |
| 40 | */ |
| 41 | |
| 42 | public abstract class TextSource { |
| 43 | /** Source character data. */ |
| 44 | public abstract char[] getChars(); |
| 45 | |
| 46 | /** Start of source data in char array returned from getChars. */ |
| 47 | public abstract int getStart(); |
| 48 | |
| 49 | /** Length of source data. */ |
| 50 | public abstract int getLength(); |
| 51 | |
| 52 | /** Start of context data in char array returned from getChars. */ |
| 53 | public abstract int getContextStart(); |
| 54 | |
| 55 | /** Length of context data. */ |
| 56 | public abstract int getContextLength(); |
| 57 | |
| 58 | /** Return the layout flags */ |
| 59 | public abstract int getLayoutFlags(); |
| 60 | |
| 61 | /** Bidi level of all the characters in context. */ |
| 62 | public abstract int getBidiLevel(); |
| 63 | |
| 64 | /** Font for source data. */ |
| 65 | public abstract Font getFont(); |
| 66 | |
| 67 | /** Font render context to use when measuring or rendering source data. */ |
| 68 | public abstract FontRenderContext getFRC(); |
| 69 | |
| 70 | /** Line metrics for source data. */ |
| 71 | public abstract CoreMetrics getCoreMetrics(); |
| 72 | |
| 73 | /** Get subrange of this TextSource. dir is one of the TextLineComponent constants */ |
| 74 | public abstract TextSource getSubSource(int start, int length, int dir); |
| 75 | |
| 76 | /** Constant for toString(boolean). Indicates that toString should not return info |
| 77 | outside of the context of this instance. */ |
| 78 | public static final boolean WITHOUT_CONTEXT = false; |
| 79 | |
| 80 | /** Constant for toString(boolean). Indicates that toString should return info |
| 81 | outside of the context of this instance. */ |
| 82 | public static final boolean WITH_CONTEXT = true; |
| 83 | |
| 84 | /** Get debugging info about this TextSource instance. Default implementation just |
| 85 | returns toString. Subclasses should implement this to match the semantics of |
| 86 | the toString constants. */ |
| 87 | public abstract String toString(boolean withContext); |
| 88 | } |