diff options
author | Francis Kung <fkung@redhat.com> | 2007-04-02 21:28:58 +0000 |
---|---|---|
committer | Francis Kung <fkung@redhat.com> | 2007-04-02 21:28:58 +0000 |
commit | 591c8432e867bb788ac85a112a1714a87ab5d078 (patch) | |
tree | ed68919e2714c73b578315b27f019f90ee5707f4 /gnu/java/awt/peer/gtk | |
parent | aeef369d0ccca3535157963bbb7fab4758df6314 (diff) | |
download | classpath-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.
Diffstat (limited to 'gnu/java/awt/peer/gtk')
-rw-r--r-- | gnu/java/awt/peer/gtk/FreetypeGlyphVector.java | 23 |
1 files changed, 22 insertions, 1 deletions
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() |