summaryrefslogtreecommitdiff
path: root/native
diff options
context:
space:
mode:
authorSven de Marothy <sven@physto.se>2006-06-11 08:29:56 +0000
committerSven de Marothy <sven@physto.se>2006-06-11 08:29:56 +0000
commit84bc18d487f12ddc18bf2cd8118e2b11ee005e88 (patch)
tree82edb7daca6939ed17b5cdca54df48aaf7664c30 /native
parent2f28c0ffa94333dae8558642ba40132979428a9d (diff)
downloadclasspath-84bc18d487f12ddc18bf2cd8118e2b11ee005e88.tar.gz
2006-06-11 Sven de Marothy <sven@physto.se>
* gnu/java/awt/peer/gtk/FreetypeGlyphVector.java (setupGlyphMetrics): New method. Add glyphmetrics caching. (getOutline): Operate on the shape directly. * gnu/java/awt/peer/gtk/GdkFontPeer.java (getGlyphMetrics,putGlyphMetrics): Add GlyphMetrics caching. * include/gnu_java_awt_peer_gtk_FreetypeGlyphVector.h (getGlyph renamed getGlyphs) * java/awt/geom/AffineTransform.java (getTranslateInstance): Set fields directly. * native/jni/gtk-peer/gnu_java_awt_peer_gtk_FreetypeGlyphVector.c (getGlyphs): Get all glyph codes at once.
Diffstat (limited to 'native')
-rw-r--r--native/jni/gtk-peer/gnu_java_awt_peer_gtk_FreetypeGlyphVector.c26
1 files changed, 20 insertions, 6 deletions
diff --git a/native/jni/gtk-peer/gnu_java_awt_peer_gtk_FreetypeGlyphVector.c b/native/jni/gtk-peer/gnu_java_awt_peer_gtk_FreetypeGlyphVector.c
index 42abd983c..361b67746 100644
--- a/native/jni/gtk-peer/gnu_java_awt_peer_gtk_FreetypeGlyphVector.c
+++ b/native/jni/gtk-peer/gnu_java_awt_peer_gtk_FreetypeGlyphVector.c
@@ -81,24 +81,38 @@ getFont(JNIEnv *env, jobject obj)
return (PangoFcFont *)pfont->font;
}
-JNIEXPORT jint JNICALL
-Java_gnu_java_awt_peer_gtk_FreetypeGlyphVector_getGlyph
- (JNIEnv *env, jobject obj, jint codepoint)
+JNIEXPORT jintArray JNICALL
+Java_gnu_java_awt_peer_gtk_FreetypeGlyphVector_getGlyphs
+ (JNIEnv *env, jobject obj, jintArray codepoints)
{
FT_Face ft_face;
jint glyph_index;
+ jintArray retArray;
PangoFcFont *font;
+ jint *values, *cpvals;
+ jint length;
+ int i;
font = getFont(env, obj);
ft_face = pango_fc_font_lock_face( font );
g_assert (ft_face != NULL);
- glyph_index = FT_Get_Char_Index( ft_face, codepoint );
+ length = (*env)->GetArrayLength (env, codepoints);
+ cpvals = (*env)->GetIntArrayElements (env, codepoints, NULL);
+
+ retArray = (*env)->NewIntArray (env, length);
+ values = (*env)->GetIntArrayElements (env, retArray, NULL);
+
+ for( i = 0; i < length; i++ )
+ values[i] = FT_Get_Char_Index( ft_face, cpvals[i] );
+
+ (*env)->ReleaseIntArrayElements (env, retArray, values, 0);
+ (*env)->ReleaseIntArrayElements (env, codepoints, cpvals, 0);
pango_fc_font_unlock_face (font);
- return glyph_index;
+ return retArray;
}
JNIEXPORT jobject JNICALL
@@ -143,7 +157,7 @@ Java_gnu_java_awt_peer_gtk_FreetypeGlyphVector_getMetricsNative
FT_Set_Transform( ft_face, NULL, NULL );
- if( FT_Load_Glyph( ft_face, glyphIndex, FT_LOAD_DEFAULT ) != 0 )
+ if( FT_Load_Glyph( ft_face, glyphIndex, FT_LOAD_NO_BITMAP ) != 0 )
{
pango_fc_font_unlock_face( font );
printf("Couldn't load glyph %i\n", glyphIndex);