/*
* 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 IBM Corp. 1999-2003 - All Rights Reserved
*
* The original version of this source code and documentation is
* copyrighted and owned by IBM. These materials are provided
* under terms of a License Agreement between IBM and Sun.
* This technology is protected by multiple US and International
* patents. This notice and attribution to IBM may not be removed.
*/
/*
* GlyphLayout is used to process a run of text into a run of run of
* glyphs, optionally with position and char mapping info.
*
* The text has already been processed for numeric shaping and bidi.
* The run of text that layout works on has a single bidi level. It
* on (shaping, script resolution) so context for the text run text is
* provided. It is assumed that the text array contains sufficient
* context, and the offset and count delimit the portion of the text
* that needs to actually be processed.
*
* The font might be a composite font. Layout generally requires
* tables from a single physical font to operate, and so it must
* resolve the 'single' font run into runs of physical fonts.
*
* Some characters are supported by several fonts of a composite, and
* in order to properly emulate the glyph substitution behavior of a
* single physical font, these characters might need to be mapped to
* different physical fonts. The script code that is assigned
* characters normally considered 'common script' can be used to
* resolve which physical font to use for these characters. The input
* to the char to glyph mapper (which assigns physical fonts as it
* processes the glyphs) should include the script code, and the
* mapper should operate on runs of a single script.
*
* To perform layout, call get() to get a new (or reuse an old)
* GlyphLayout, call layout on it, then call done(GlyphLayout) when
* finished. There's no particular problem if you don't call done,
* but it assists in reuse of the GlyphLayout.
*/
public final class GlyphLayout {
// data for glyph vector
// cached glyph layout data for reuse
private int _ercount;
private float[] _mat;
private int _typo_flags;
private int _offset;
public static final class LayoutEngineKey {
private int script;
private int lang;
LayoutEngineKey() {
}
}
}
}
return font;
}
int script() {
return script;
}
int lang() {
return lang;
}
if (this == rhs) return true;
try {
}
catch (ClassCastException e) {
return false;
}
}
public int hashCode() {
}
}
public static interface LayoutEngineFactory {
/**
* Given a font, script, and language, determine a layout engine to use.
*/
/**
* Given a key, determine a layout engine to use.
*/
}
public static interface LayoutEngine {
/**
* Given a strike descriptor, text, rtl flag, and starting point, append information about
* glyphs, positions, and character indices to the glyphvector data, and advance the point.
*
* If the GVData does not have room for the glyphs, throws an IndexOutOfBoundsException and
* leave pt and the gvdata unchanged.
*/
}
/**
* Return a new instance of GlyphLayout, using the provided layout engine factory.
* If null, the system layout engine factory will be used.
*/
}
synchronized(GlyphLayout.class) {
}
}
result = new GlyphLayout();
}
return result;
}
/**
* Return the old instance of GlyphLayout when you are done. This enables reuse
* of GlyphLayout objects.
*/
}
private static final class SDCache {
// !!! add getVectorTransform and hasVectorTransform to frc? then
// we could just skip this work...
0, 0);
if (!dtx.isIdentity()) {
try {
}
catch (NoninvertibleTransformException e) {
throw new InternalError();
}
}
if (font.isTransformed()) {
(float)gtx.getTranslateY());
0, 0);
} else {
delta = ZERO_DELTA;
}
/* Similar logic to that used in SunGraphics2D.checkFontInfo().
* Whether a grey (AA) strike is needed is size dependent if
* AA mode is 'gasp'.
*/
int aa =
}
private static
private static final class SDKey {
private final int hash;
}
public int hashCode() {
return hash;
}
try {
return
}
catch (ClassCastException e) {
}
return false;
}
}
// It is possible a translation component will be in the FRC.
// It doesn't affect us except adversely as we would consider
// FRC's which are really the same to be different. If we
// detect a translation component, then we need to exclude it
// by creating a new transform which excludes the translation.
if (frc.isTransformed()) {
0, 0);
);
}
}
}
}
cacheRef = new
}
}
return res;
}
}
/**
* Create a glyph vector.
* @param font the font to use
* @param frc the font render context
* @param text the text, including optional context before start and after start + count
* @param offset the start of the text to lay out
* @param count the length of the text to lay out
* @param flags bidi and context flags {@see #java.awt.Font}
* @param result a StandardGlyphVector to modify, can be null
* @return the layed out glyphvector, if result was passed in, it is returned
*/
{
throw new IllegalArgumentException();
}
// need to set after init
// go through the back door for this
if (font.hasLayoutAttributes()) {
}
// use cache now - can we use the strike cache for this?
int min = 0;
if (flags != 0) {
}
}
}
}
if (font2D instanceof CompositeFont) {
while (_scriptRuns.next()) {
/* layout can't deal with NativeFont instances. The
* native font is assumed to know of a suitable non-native
* substitute font. This currently works because
* its consistent with the way NativeFonts delegate
* in other cases too.
*/
if (pfont instanceof NativeFont) {
}
}
}
} else {
while (_scriptRuns.next()) {
}
}
int ix = 0;
int dir = 1;
stop = -1;
dir = -1;
}
// _sd.init(dtx, gtx, font.getStyle(), frc.isAntiAliased(), frc.usesFractionalMetrics());
for (;;) {
try {
break;
}
catch (IndexOutOfBoundsException e) {
}
}
break;
}
}
}
// if (txinfo.invdtx != null) {
// _gvdata.adjustPositions(txinfo.invdtx);
// }
// If layout fails (negative glyph count) create an un-laid out GV instead.
// ie default positions. This will be a lot better than the alternative of
// a complete blank layout.
if (FontUtilities.debugFonts()) {
font);
}
} else {
}
// System.err.println("Layout returns: " + gv);
return gv;
}
//
// private methods
//
private GlyphLayout() {
this._textRecord = new TextRecord();
this._scriptRuns = new ScriptRun();
this._fontRuns = new FontRunIterator();
this._sd = new FontStrikeDesc();
this._mat = new float[4];
}
this._typo_flags = 0;
this._ercount = 0;
}
er = new EngineRecord();
} else {
}
++_ercount;
}
/**
* Storage for layout to build glyph vector data, then generate a real GlyphVector
*/
public static final class GVData {
public int _flags;
public int[] _glyphs;
public float[] _positions;
public int[] _indices;
_count = 0;
if (size < 20) {
size = 20;
}
}
}
public void grow() {
}
}
}
public StandardGlyphVector createGlyphVector(Font font, FontRenderContext frc, StandardGlyphVector result) {
// !!! default initialization until we let layout engines do it
if (_flags == UNINITIALIZED_FLAGS) {
_flags = 0;
boolean ltr = true;
boolean rtl = true;
}
}
// !!! layout engines need to tell us whether they performed
// position adjustments. currently they don't tell us, so
// we must assume they did
}
}
}
} else {
}
return result;
}
}
/**
* Utility class to keep track of script runs, which may have to be reordered rtl when we're
* finished.
*/
private final class EngineRecord {
private int start;
private int limit;
private int gmask;
private int eflags;
EngineRecord() {
key = new LayoutEngineKey();
}
this.eflags = 0;
// only request canonical substitution if we have combining marks
if (isHighSurrogate((char)ch) &&
i < limit - 1 &&
// rare case
}
if (gc == NON_SPACING_MARK ||
gc == ENCLOSING_MARK ||
this.eflags = 0x4;
break;
}
}
}
void layout() {
}
}
}