/*
* 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.
*/
// Creates the native strike
double[] glyphTx,
double[] invDevTxMatrix,
int aaHint,
int fmHint);
// Disposes the native strike
// Creates a StrikeMetrics from the underlying native system fonts
// Returns native struct pointers used by the Sun 2D Renderer
long[] glyphInfos,
// Returns the advance give a glyph code. It should be used only
// when the glyph code belongs to the CFont passed in.
int glyphCode);
// Returns the outline shape of a glyph
int glyphCode,
double x,
double y);
// returns the bounding rect for a glyph
int glyphCode,
double x, double y);
private long nativeStrikePtr;
nativeFont = font;
glyphAdvanceCache = new GlyphAdvanceCache();
// Normally the device transform should be the identity transform
// for screen operations. The device transform only becomes
// interesting when we are outputting between different dpi surfaces,
// like when we are printing to postscript.
try {
} catch (NoninvertibleTransformException e) {
// ignored, since device transforms should not be that
// complicated, and if they are - there is nothing we can do,
// so we won't worry about it.
}
}
}
public long getNativeStrikePtr() {
if (nativeStrikePtr != 0) {
return nativeStrikePtr;
}
final double[] glyphTx = new double[6];
final double[] invDevTxMatrix = new double[6];
} else {
}
synchronized (this) {
if (nativeStrikePtr != 0) {
return nativeStrikePtr;
}
}
return nativeStrikePtr;
}
if (nativeStrikePtr != 0) {
}
nativeStrikePtr = 0;
}
// the fractional metrics default on our platform is OFF
private boolean useFractionalMetrics() {
}
public int getNumGlyphs() {
return nativeFont.getNumGlyphs();
}
if (strikeMetrics == null) {
}
}
return strikeMetrics;
}
}
if (devScaleX == 0) {
}
if (devScaleX == 0) {
}
}
// calculate an advance, and round if not using fractional metrics
}
}
return getScaledPointForAdvance(getCachedNativeGlyphAdvance(nativeFont.getMapper().charToGlyph(ch)));
}
}
// calculate an advance point, and round if not using fractional metrics
return scalePoint(pt);
}
if (!useFractionalMetrics()) {
}
return pt;
}
// transform the point out of the device space first
}
if (!useFractionalMetrics()) {
}
return pt;
}
} else {
}
return r2df;
}
// pt, result in device space
}
return;
}
}
}
}
// should implement, however not called though any path that is publicly exposed
throw new Error("not implemented yet");
}
// called from the Sun2D renderer
synchronized (glyphInfoCache) {
long[] ptrs = new long[1];
int[] codes = new int[1];
return ptr;
}
}
// called from the Sun2D renderer
synchronized (glyphInfoCache) {
// fill the image pointer array with existing pointers
// from the cache
int missed = 0;
for (int i = 0; i < len; i++) {
int code = glyphCodes[i];
if (ptr != 0L) {
} else {
// zero this element out, because the caller does not
// promise to keep it clean
images[i] = 0L;
missed++;
}
}
if (missed == 0) {
return; // horray! we got away without touching native!
}
// all distinct glyph codes requested (partially filled)
final int[] filteredCodes = new int[missed];
// indices into filteredCodes array (totally filled)
final int[] filteredIndicies = new int[missed];
// scan, mark, and store the requested glyph codes again to
// send into native
int j = 0;
int dupes = 0;
for (int i = 0; i < len; i++) {
final int code = glyphCodes[i];
// we have already promised to strike this glyph - this is
// a dupe
filteredIndicies[j] = -1;
dupes++;
j++;
continue;
}
// this is a distinct glyph we have not struck before, or
// promised to strike mark this one as "promise to strike"
// in the global cache with a -1L
final int k = j - dupes;
filteredCodes[k] = code;
filteredIndicies[j] = k;
j++;
}
final int filteredRunLen = j - dupes;
final long[] filteredImages = new long[filteredRunLen];
// bulk call to fill in the distinct glyph pointers from native
// scan the requested glyph list, and fill in pointers from our
// distinct glyph list which has been filled from native
j = 0;
for (int i = 0; i < len; i++) {
continue; // already placed
}
// index into filteredImages array
final int k = filteredIndicies[j];
final int code = glyphCodes[i];
if (k == -1L) {
// we should have already filled the cache with this pointer
} else {
// fill the particular glyph code request, and store
// in the cache
final long ptr = filteredImages[k];
}
j++;
}
}
}
{
}
synchronized(glyphAdvanceCache) {
if (advance != 0) {
return advance;
}
return advance;
}
}
// This class stores glyph pointers, and is indexed based on glyph codes,
// and negative unicode values. See the comments in
// CCharToGlyphMapper for more details on our glyph code strategy.
// rdar://problem/5204197
private boolean disposed = false;
private final long[] firstLayerCache;
final FontStrikeDesc desc)
{
super(nativeFont, desc);
firstLayerCache = new long[FIRST_LAYER_SIZE];
}
if (index < 0) {
if (-index < SECOND_LAYER_SIZE) {
// catch common unicodes
if (secondLayerCache == null) {
return 0L;
}
}
} else {
if (index < FIRST_LAYER_SIZE) {
// catch common glyphcodes
return firstLayerCache[index];
}
}
if (generalCache == null) {
return 0L;
}
return 0L;
}
}
if (index < 0) {
if (-index < SECOND_LAYER_SIZE) {
// catch common unicodes
if (secondLayerCache == null) {
}
return;
}
} else {
if (index < FIRST_LAYER_SIZE) {
// catch common glyphcodes
return;
}
}
if (generalCache == null) {
}
}
public synchronized void dispose() {
// rdar://problem/5204197
// Note that sun.font.Font2D.getStrike() actively disposes
// cleared strikeRef. We need to check the disposed flag to
// prevent double frees of native resources.
if (disposed) {
return;
}
super.dispose();
// clean out the first array
// clean out the two layer arrays
if (secondLayerCache != null) {
final long[] longArray = secondLayerLongArrayArray[i];
}
}
// clean up everyone else
if (generalCache != null) {
while (i.hasNext()) {
}
}
}
// rdar://problem/5204197
// Finally, set the flag.
disposed = true;
}
}
}
}
private static class SparseBitShiftingTwoLayerArray {
final long[][] cache;
final int shift;
final int secondLayerLength;
}
}
if (firstLayerRow == null) {
}
}
}
}
private static class GlyphAdvanceCache {
if (index < 0) {
if (-index < SECOND_LAYER_SIZE) {
// catch common unicodes
}
} else {
if (index < FIRST_LAYER_SIZE) {
// catch common glyphcodes
return firstLayerCache[index];
}
}
return value.floatValue();
}
if (index < 0) {
if (-index < SECOND_LAYER_SIZE) {
// catch common unicodes
if (secondLayerCache == null) {
}
return;
}
} else {
if (index < FIRST_LAYER_SIZE) {
// catch common glyphcodes
return;
}
}
if (generalCache == null) {
}
}
private static class SparseBitShiftingTwoLayerArray {
final float[][] cache;
final int shift;
final int secondLayerLength;
final int shift)
{
}
}
if (firstLayerRow == null) {
new float[secondLayerLength];
}
}
}
}
}