/*
* 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.
*/
#import "java_awt_geom_PathIterator.h"
#import "sun_awt_SunHints.h"
#import "sun_font_CStrike.h"
#import "sun_font_CStrikeDisposer.h"
#import "CGGlyphImages.h"
#import "CGGlyphOutlines.h"
#import "AWTStrike.h"
#import "CoreTextSupport.h"
//#import "jni_util.h"
#include "fontscalerdefs.h"
if (self) {
fAltTx.b *= -1;
fAltTx.d *= -1;
invDevTx.b *= -1;
invDevTx.c *= -1;
// the "font size" is the square root of the determinant of the matrix
}
return self;
}
- (void) dealloc {
[super dealloc];
}
}
@end
#define AWT_FONT_CLEANUP_CHECK(a) \
if ((a) == NULL) { \
goto cleanup; \
} \
goto cleanup; \
}
if (_fontThrowJavaException == YES) { \
char s[512]; \
}
/*
* Creates an affine transform from the corresponding doubles sent
* from CStrike.getGlyphTx().
*/
static inline CGAffineTransform
{
return CGAffineTransformIdentity;
}
return tx;
}
/*
* Class: sun_font_CStrike
* Method: getNativeGlyphAdvance
* Signature: (JI)F
*/
{
// negative glyph codes are really unicodes, which were placed there by the mapper
// to indicate we should use CoreText to substitute the character
const CTFontRef fallback = CTS_CopyCTFallbackFontAndGlyphForJavaGlyphCode(awtFont, glyphCode, &glyph);
}
/*
* Class: sun_font_CStrike
* Method: getNativeGlyphImageBounds
* Signature: (JJILjava/awt/geom/Rectangle2D/Float;DD)V
*/
{
// negative glyph codes are really unicodes, which were placed there by the mapper
// to indicate we should use CoreText to substitute the character
const CTFontRef fallback = CTS_CopyCTFallbackFontAndGlyphForJavaGlyphCode(awtFont, glyphCode, &glyph);
// the origin of this bounding box is relative to the bottom-left corner baseline
// Rectangle2D.Float.setRect(float x, float y, float width, float height);
static JNF_CLASS_CACHE(sjc_Rectangle2D_Float, "java/awt/geom/Rectangle2D$Float"); // cache class id for Rectangle
JNFCallVoidMethod(env, result, sjr_Rectangle2DFloat_setRect, (jfloat)bbox.origin.x, (jfloat)bbox.origin.y, (jfloat)bbox.size.width, (jfloat)bbox.size.height);
}
/*
* Class: sun_font_CStrike
* Method: getNativeGlyphOutline
* Signature: (JJIDD)Ljava/awt/geom/GeneralPath;
*/
{
// inverting the shear order and sign to compensate for the flipped coordinate system
// get the right font and glyph for this "Java GlyphCode"
// get the advance of this glyph
// Create AWTPath
// Get the paths
(*env)->SetFloatArrayRegion(env, pointCoords, 0, path->fNumberOfDataElements, (jfloat*)path->fSegmentData);
// Copy the pointTypes to the general path
(*env)->SetByteArrayRegion(env, pointTypes, 0, path->fNumberOfSegments, (jbyte*)path->fSegmentType);
generalPath = JNFNewObject(env, jc_GeneralPath_ctor, java_awt_geom_PathIterator_WIND_NON_ZERO, pointTypes, path->fNumberOfSegments, pointCoords, path->fNumberOfDataElements); // AWT_THREADING Safe (known object)
// Cleanup
}
if (pointCoords != NULL) {
pointCoords = NULL;
}
if (pointTypes != NULL) {
pointTypes = NULL;
}
return generalPath;
}
/*
* Class: sun_font_CStrike
* Method: getGlyphImagePtrsNative
* Signature: (JJ[J[II)V
*/
{
jlong *glyphInfos =
rawGlyphCodes, len);
// Do not use JNI_COMMIT, as that will not free the buffer copy
// when +ProtectJavaHeap is on.
glyphInfos, 0);
}
/*
* Class: sun_font_CStrike
* Method: createNativeStrikePtr
* Signature: (J[D[DII)J
*/
(JNIEnv *env, jclass clazz, jlong nativeFontPtr, jdoubleArray glyphTxArray, jdoubleArray invDevTxArray, jint aaStyle, jint fmHint)
{
awtStrike = [AWTStrike awtStrikeForFont:awtFont tx:glyphTx invDevTx:invDevTx style:style aaStyle:aaStyle]; // autoreleased
if (awtStrike)
{
}
return ptr_to_jlong(awtStrike);
}
/*
* Class: sun_font_CStrike
* Method: disposeNativeStrikePtr
* Signature: (J)V
*/
{
if (awtStrike) {
}
}
/*
* Class: sun_font_CStrike
* Method: getFontMetrics
* Signature: (J)Lsun/font/StrikeMetrics;
*/
{
// Ascent
// Descent
// Leading
// Max Advance for Font Direction (Strictly horizontal)
/*
* ascent: no need to set ascentX - it will be zero.
* descent: no need to set descentX - it will be zero.
* baseline: old releases "made up" a number and also seemed to
* make it up for "X" and set "Y" to 0.
* leadingX: no need to set leadingX - it will be zero.
* leadingY: made-up number, but being compatible with what 1.4.x did.
* advance: no need to set yMaxLinearAdvanceWidth - it will be zero.
*/
return metrics;
}
/*
* Class: sun_font_CStrikeDisposer
* Method: removeGlyphInfoFromCache
* Signature: (J)V
*/
{
}