/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* (C) Copyright Taligent, Inc. 1996 - 1997, All Rights Reserved
* (C) Copyright IBM Corp. 1996 - 1998, All Rights Reserved
*
* The original version of this source code and documentation is
* copyrighted and owned by Taligent, Inc., a wholly-owned subsidiary
* of IBM. These materials are provided under terms of a License
* Agreement between Taligent and Sun. This technology is protected
* by multiple US and International patents.
*
* This notice and attribution to Taligent may not be removed.
* Taligent is a registered trademark of Taligent, Inc.
*
*/
/*
* one info for each side of each glyph
* separate infos for grow and shrink case
* !!! this doesn't really need to be a separate class. If we keep it
* separate, probably the newJustify code from TextLayout belongs here as well.
*/
class TextJustifier {
private int start;
private int limit;
static boolean DEBUG = false;
/**
* Initialize the justifier with an array of infos corresponding to each
* glyph. Start and limit indicate the range of the array to examine.
*/
if (DEBUG) {
}
}
}
/**
* Return an array of deltas twice as long as the original info array,
* indicating the amount by which each side of each glyph should grow
* or shrink.
*
* Delta should be positive to expand the line, and negative to compress it.
*/
if (DEBUG)
// make separate passes through glyphs in order of decreasing priority
// until justifyDelta is zero or we run out of priorities.
int fallbackPriority = -1;
/*
* special case 'fallback' iteration, set flag and recheck
* highest priority
*/
boolean lastPass = p > MAX_PRIORITY;
if (lastPass)
p = fallbackPriority;
// pass through glyphs, first collecting weights and limits
float weight = 0;
float gslimit = 0;
float absorbweight = 0;
if (fallbackPriority == -1) {
fallbackPriority = p;
}
if (i != start) { // ignore left of first character
if (grow) {
if (gi.growAbsorb) {
}
} else {
if (gi.shrinkAbsorb) {
}
}
}
if (grow) {
if (gi.growAbsorb) {
}
} else {
if (gi.shrinkAbsorb) {
}
}
}
}
}
// did we hit the limit?
if (!grow) {
}
// predivide delta by weight
float weightedAbsorb = 0;
}
if (DEBUG) {
", d: " + delta +
", l: " + gslimit +
", w: " + weight +
", aw: " + absorbweight +
", wd: " + weightedDelta +
", wa: " + weightedAbsorb +
}
// now allocate this based on ratio of weight to total weight
int n = start * 2;
if (i != start) { // ignore left
float d;
if (hitLimit) {
// factor in sign
if (absorbing) {
// sign factored in already
}
} else {
// sign factored in already
}
deltas[n] += d;
}
n++;
float d;
if (hitLimit) {
if (absorbing) {
}
} else {
}
deltas[n] += d;
}
n++;
} else {
n += 2;
}
}
} else {
}
}
if (DEBUG) {
float total = 0;
if (i % 20 == 9) {
}
}
}
return deltas;
}
}