summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrancis Kung <fkung@redhat.com>2007-04-02 21:28:58 +0000
committerFrancis Kung <fkung@redhat.com>2007-04-02 21:28:58 +0000
commit591c8432e867bb788ac85a112a1714a87ab5d078 (patch)
treeed68919e2714c73b578315b27f019f90ee5707f4
parentaeef369d0ccca3535157963bbb7fab4758df6314 (diff)
downloadclasspath-591c8432e867bb788ac85a112a1714a87ab5d078.tar.gz
2007-04-02 Francis Kung <fkung@redhat.com>
* gnu/java/awt/peer/gtk/FreetypeGlyphVector.java (fontSet): Initialize to null. (FreetypeGlyphVector(Font, int[], FontRenderContext)): Populate fontSet array with default font if needed. (FreetypeGlyphVector(FreetypeGlyphVector)): Clone all fields. (getNativeFontPointer): New native method. * include/gnu_java_awt_peer_gtk_FreetypeGlyphVector.h: Regenerated. * native/jni/gtk-peer/gnu_java_awt_peer_gtk_FreetypeGlyphVector.c (Java_gnu_java_awt_peer_gtk_FreetypeGlyphVector_getNativeFontPointer): New function.
-rw-r--r--ChangeLog13
-rw-r--r--gnu/java/awt/peer/gtk/FreetypeGlyphVector.java23
-rw-r--r--include/gnu_java_awt_peer_gtk_FreetypeGlyphVector.h1
-rw-r--r--native/jni/gtk-peer/gnu_java_awt_peer_gtk_FreetypeGlyphVector.c13
4 files changed, 49 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index a432bbab0..3b68ab2e0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,18 @@
2007-04-02 Francis Kung <fkung@redhat.com>
+ * gnu/java/awt/peer/gtk/FreetypeGlyphVector.java
+ (fontSet): Initialize to null.
+ (FreetypeGlyphVector(Font, int[], FontRenderContext)): Populate fontSet
+ array with default font if needed.
+ (FreetypeGlyphVector(FreetypeGlyphVector)): Clone all fields.
+ (getNativeFontPointer): New native method.
+ * include/gnu_java_awt_peer_gtk_FreetypeGlyphVector.h: Regenerated.
+ * native/jni/gtk-peer/gnu_java_awt_peer_gtk_FreetypeGlyphVector.c
+ (Java_gnu_java_awt_peer_gtk_FreetypeGlyphVector_getNativeFontPointer):
+ New function.
+
+2007-04-02 Francis Kung <fkung@redhat.com>
+
* INSTALL: Document known bug in at-spi, atk, and gail packages prior to
version 1.18.0.
diff --git a/gnu/java/awt/peer/gtk/FreetypeGlyphVector.java b/gnu/java/awt/peer/gtk/FreetypeGlyphVector.java
index fe75c510c..974aab5e2 100644
--- a/gnu/java/awt/peer/gtk/FreetypeGlyphVector.java
+++ b/gnu/java/awt/peer/gtk/FreetypeGlyphVector.java
@@ -83,7 +83,7 @@ public class FreetypeGlyphVector extends GlyphVector
/**
* The set of fonts used in this glyph vector.
*/
- private long[] fontSet;
+ private long[] fontSet = null;
/**
* Glyph transforms. (de facto only the translation is used)
@@ -93,6 +93,17 @@ public class FreetypeGlyphVector extends GlyphVector
private GlyphMetrics[] metricsCache;
private native void dispose(long[] fonts);
+
+ /**
+ * Returns a pointer to the native PangoFcFont object.
+ *
+ * The object will be referenced with g_object_ref n times before being
+ * returned, and must be unreferenced a corresponding number of times.
+ *
+ * @param n Number of times to reference the object.
+ * @return Pointer to the native default font.
+ */
+ private native long getNativeFontPointer(int n);
/**
* Create a glyphvector from a given (Freetype) font and a String.
@@ -142,6 +153,13 @@ public class FreetypeGlyphVector extends GlyphVector
glyphCodes = new int[ codes.length ];
System.arraycopy(codes, 0, glyphCodes, 0, codes.length);
nGlyphs = glyphCodes.length;
+
+ if (fontSet == null)
+ {
+ fontSet = new long[nGlyphs];
+ Arrays.fill(fontSet, getNativeFontPointer(nGlyphs));
+ }
+
performDefaultLayout();
}
@@ -164,6 +182,7 @@ public class FreetypeGlyphVector extends GlyphVector
}
glyphCodes = new int[ nGlyphs ];
+ fontSet = new long[nGlyphs];
glyphPositions = new float[(nGlyphs + 1) * 2];
glyphTransforms = new AffineTransform[ nGlyphs ];
for(int i = 0; i < nGlyphs; i++ )
@@ -173,6 +192,8 @@ public class FreetypeGlyphVector extends GlyphVector
}
System.arraycopy(gv.glyphPositions, 0, glyphPositions, 0,
glyphPositions.length);
+ System.arraycopy(gv.glyphCodes, 0, glyphCodes, 0, nGlyphs);
+ System.arraycopy(gv.fontSet, 0, fontSet, 0, nGlyphs);
}
public void finalize()
diff --git a/include/gnu_java_awt_peer_gtk_FreetypeGlyphVector.h b/include/gnu_java_awt_peer_gtk_FreetypeGlyphVector.h
index 54a66eeb9..954632293 100644
--- a/include/gnu_java_awt_peer_gtk_FreetypeGlyphVector.h
+++ b/include/gnu_java_awt_peer_gtk_FreetypeGlyphVector.h
@@ -15,6 +15,7 @@ JNIEXPORT jobject JNICALL Java_gnu_java_awt_peer_gtk_FreetypeGlyphVector_getKern
JNIEXPORT jdoubleArray JNICALL Java_gnu_java_awt_peer_gtk_FreetypeGlyphVector_getMetricsNative (JNIEnv *env, jobject, jint, jlong);
JNIEXPORT jobject JNICALL Java_gnu_java_awt_peer_gtk_FreetypeGlyphVector_getGlyphOutlineNative (JNIEnv *env, jobject, jint, jlong);
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_FreetypeGlyphVector_dispose (JNIEnv *env, jobject, jlongArray);
+JNIEXPORT jlong JNICALL Java_gnu_java_awt_peer_gtk_FreetypeGlyphVector_getNativeFontPointer (JNIEnv *env, jobject, jint);
#ifdef __cplusplus
}
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 ec38069bf..71a14c50e 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
@@ -420,3 +420,16 @@ Java_gnu_java_awt_peer_gtk_FreetypeGlyphVector_dispose
(*env)->ReleaseLongArrayElements (env, fontset, fontArray, 0);
}
+
+JNIEXPORT jlong JNICALL
+Java_gnu_java_awt_peer_gtk_FreetypeGlyphVector_getNativeFontPointer
+ (JNIEnv *env, jobject obj, jint n)
+{
+ int i;
+ PangoFcFont *font = getFont(env, obj);
+
+ for (i = 0; i < n; i++)
+ g_object_ref(font);
+
+ return PTR_TO_JLONG(font);
+}