1 /* 2 * Copyright (c) 1998, 2003, 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 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. */ getChars()44 public abstract char[] getChars(); 45 46 /** Start of source data in char array returned from getChars. */ getStart()47 public abstract int getStart(); 48 49 /** Length of source data. */ getLength()50 public abstract int getLength(); 51 52 /** Start of context data in char array returned from getChars. */ getContextStart()53 public abstract int getContextStart(); 54 55 /** Length of context data. */ getContextLength()56 public abstract int getContextLength(); 57 58 /** Return the layout flags */ getLayoutFlags()59 public abstract int getLayoutFlags(); 60 61 /** Bidi level of all the characters in context. */ getBidiLevel()62 public abstract int getBidiLevel(); 63 64 /** Font for source data. */ getFont()65 public abstract Font getFont(); 66 67 /** Font render context to use when measuring or rendering source data. */ getFRC()68 public abstract FontRenderContext getFRC(); 69 70 /** Line metrics for source data. */ getCoreMetrics()71 public abstract CoreMetrics getCoreMetrics(); 72 73 /** Get subrange of this TextSource. dir is one of the TextLineComponent constants */ getSubSource(int start, int length, int dir)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. */ toString(boolean withContext)87 public abstract String toString(boolean withContext); 88 } 89