2362N/A * Copyright (c) 1998, 2006, Oracle and/or its affiliates. All rights reserved. 0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 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 * 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 * 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. 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 0N/A * (C) Copyright IBM Corp. 1998-2003, All Rights Reserved 0N/A private float[]
locs;
// x,y pairs for components in visual order 0N/A "char count is different from " +
0N/A "sum of char counts of components.");
0N/A // first, we need to check for graphic components on the TOP or BOTTOM baselines. So 0N/A // we perform the work that used to be in getMetrics here. 0N/A // ascent + descent must not be less than this value 0N/A // walk through EGA's 0N/A // we now know enough to compute the locs, but we need the final loc 0N/A // for the advance before we can create the metrics object 0N/A // we have top or bottom baselines, so expand the baselines array 0N/A // full offsets are needed by CoreMetrics.effectiveBaselineOffset 0N/A // 1) compute the area of overlap - min effective ascent and min effective descent 0N/A // 2) compute the x positions along italic angle of ascent and descent for left and right 0N/A // 3) compute maximum left - right, adjust right position by this value 0N/A // this is a crude form of kerning between textcomponents 0N/A // note glyphvectors preposition glyphs based on offset, 0N/A // so tl doesn't need to adjust glyphvector position 0N/A // pb += pcm.ssOffset; 0N/A // cb += cm.ssOffset; 0N/A // no italic adjustment for x, but still need to compute y 0N/A // do we want italic padding at the right of the line? 0N/A // locs[locs.length - 1] = 0; // final offset is always back on baseline 0N/A // ok, build fMetrics since we have the final advance 0N/A // build path if we need it 0N/A // if we have a matching frc, set it to null so we don't have to test it 0N/A // for each component 0N/A // only cache integral locations with the default frc, this is a bit strict 0N/A // couldn't use cache, or didn't have it, so compute 0N/A if (
isSimple) {
// all glyphvectors with no decorations, no layout path 0N/A }
else {
// draw and test 0N/A int l = -
1, t = -
1, r = w, b = h;
0N/A for (
int i = t; i < b; ++i) {
0N/A for (
int i = t; i < b; ++i) {
0N/A // charPos is relative to the component - adjust for 0N/A * map a component visual index to the logical index. 0N/A * map a component logical index to the visual index. 0N/A * Return the union of the visual bounds of all the components. 0N/A * This incorporates the path. It does not include logical 0N/A * bounds (used by carets). 0N/A * Create a TextLine from the text. The Font must be able to 0N/A * display all of the text. 0N/A * attributes==null is equivalent to using an empty Map for 0N/A // dlf: get baseRot from font for now??? 0N/A int layoutFlags =
0;
// no extra info yet, bidi determines run and line direction 0N/A * Returns an array in logical order of the TextLineComponents on 0N/A * the text in the given range, with the given attributes. 0N/A * Returns an array (in logical order) of the TextLineComponents representing 0N/A * the text. The components are both logically and visually contiguous. 0N/A // AffineTransform baseRot = styledParagraph.getBaselineRotationAt(pos); 0N/A // !!! For now, let's assign runs of text with both fonts and graphic attributes 0N/A // a null rotation (e.g. the baseline rotation goes away when a graphic 0N/A * Create a TextLine from the Font and character data over the 0N/A * range. The range is relative to both the StyledParagraph and the 0N/A * Compute the components order from the given components array and 0N/A * logical-to-visual character mapping. May return null if canonical. 0N/A * Create a visual ordering for the glyph sets. The important thing 0N/A * here is that the values have the proper rank with respect to 0N/A * each other, not the exact values. For example, the first glyph 0N/A * set that appears visually should have the lowest value. The last 0N/A * should have the highest value. The values are then normalized 0N/A * to map 1-1 with positions in glyphs. 0N/A * Create a TextLine from the text. chars is just the text in the iterator. 0N/A int layoutFlags =
0;
// no extra info yet, bidi determines run and line direction 0N/A * A utility to get a range of text that is both logically and visually 0N/A * If the entire range is ok, return limit, otherwise return the first 0N/A * directional change after start. We could do better than this, but 0N/A * it doesn't seem worth it at the moment. 0N/A private static int firstVisualChunk(int order[], byte direction[], 0N/A int start, int limit) 0N/A if (order != null) { 0N/A int min = order[start]; 0N/A int max = order[start]; 0N/A int count = limit - start; 0N/A for (int i = start + 1; i < limit; i++) { 0N/A min = Math.min(min, order[i]); 0N/A max = Math.max(max, order[i]); 0N/A if (max - min >= count) { 0N/A if (direction != null) { 0N/A byte baseLevel = direction[start]; 0N/A for (int j = start + 1; j < i; j++) { 0N/A if (direction[j] != baseLevel) { 0N/A * When this returns, the ACI's current position will be at the start of the 0N/A * first run which does NOT contain a GraphicAttribute. If no such run exists 0N/A * the ACI's position will be at the end, and this method will return false. 0N/A * The new version requires that chunks be at the same level. 0N/A * create a new line with characters between charStart and charLimit 0N/A * justified using the provided width and ratio. 0N/A // all characters outside the justification range must be in the base direction 0N/A // of the layout, otherwise justification makes no sense. 0N/A // get the actual justification delta 0N/A // generate an array of GlyphJustificationInfo records to pass to 0N/A // the justifier. Array is visually ordered. 0N/A // get positions that each component will be using 0N/A // get justification infos 0N/A // records are visually ordered, and contiguous, so start and end are 0N/A // simply the places where we didn't fetch records 0N/A // invoke justifier on the records 0N/A // apply justification deltas 0N/A // return the sum of the advances of text between the logical start and limit