[kaffe] CVS kaffe (robilad): Resynced with GNU Classpath: graydon's
awt fixes
Kaffe CVS
cvs-commits at kaffe.org
Mon Feb 14 12:06:40 PST 2005
PatchSet 5538
Date: 2005/02/14 20:01:18
Author: robilad
Branch: HEAD
Tag: (none)
Log:
Resynced with GNU Classpath: graydon's awt fixes
2005-02-14 Dalibor Topic <robilad at kaffe.org>
Resynced with GNU Classpath.
2005-02-12 Graydon Hoare <graydon at redhat.com>
* gnu/java/awt/peer/gtk/GdkGraphicsConfiguration.java: Add.
2005-02-12 Graydon Hoare <graydon at redhat.com>
* gnu/java/awt/peer/gtk/GdkFontPeer.java
(getGlyphVector):
(getFontMetrics):
(getTextMetrics): New native methods.
* gnu/java/awt/peer/gtk/GdkFontMetrics.java: Remove native parts.
* gnu/java/awt/peer/gtk/GdkGlyphVector.java: Likewise.
* gnu/java/awt/peer/gtk/GdkGraphicsEnvironment.java:
Hold reference to GtkToolkit.
* gnu/java/awt/peer/gtk/GdkGraphics2D.java
(cairoSetFont):
(cairoDrawGdkTextLayout):
(cairoDrawString):
(getPeerTextMetrics):
(getPeerFontMetrics): Remove.
(setFont): Don't call cairoSetFont.
(cairoDrawGlyphVector): Accept font peer argument.
(drawGlyphVector): Pass font peer to cairoDrawGlyphVector.
* gnu/java/awt/peer/gtk/GdkPixbufDecoder.java:
(finalize): Call finish from here.
(produce): Not from here.
* gnu/java/awt/peer/gtk/GdkScreenGraphicsDevice.java:
Hold reference to GdkGraphicsEnvironment.
* gnu/java/awt/peer/gtk/GtkToolkit.java:
(getFontMetrics): Change locking.
(getBounds): New method.
(getLocalGraphicsEnvironment): Pass reference to this.
* include/Makefile.am: Remove entries for GdkFontMetrics, GdkGlyphVector.
* include/gnu_java_awt_peer_gtk_GdkFontMetrics.h: Remove.
* include/gnu_java_awt_peer_gtk_GdkFontPeer.h: Regenerate.
* include/gnu_java_awt_peer_gtk_GdkGlyphVector.h: Remove.
* include/gnu_java_awt_peer_gtk_GdkGraphics2D.h: Regenerate.
* native/jni/gtk-peer/Makefile.am
Remove entries for GdkFontMetrics, GdkGlyphVector.
* native/jni/gtk-peer/gdkfont.h: Add #defines, remove struct glyphvec.
* native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.c
(ensure_metrics_cairo):
(Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetFont):
(Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoDrawString):
(Java_gnu_java_awt_peer_gtk_GdkGraphics2D_getPeerFontMetrics):
(Java_gnu_java_awt_peer_gtk_GdkGraphics2D_getPeerTextMetrics):
(metrics_cairo):
(metrics_surface): Remove.
(Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoDrawGlyphVector):
Pass and install font peer.
* native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkButtonPeer.c:
Release GDK lock while performing upcalls.
* native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontMetrics.c: Remove.
* native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontPeer.c
(Java_gnu_java_awt_peer_gtk_GdkFontPeer_getGlyphVector):
(Java_gnu_java_awt_peer_gtk_GdkFontPeer_getFontMetrics):
(Java_gnu_java_awt_peer_gtk_GdkFontPeer_getTextMetrics): New methods.
* native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGlyphVector.c: Remove.
Members:
ChangeLog:1.3582->1.3583
include/Makefile.am:1.90->1.91
include/Makefile.in:1.215->1.216
libraries/clib/awt/classpath-gtk/gtk-peer/Makefile.am:1.11->1.12
libraries/clib/awt/classpath-gtk/gtk-peer/Makefile.in:1.27->1.28
libraries/clib/awt/classpath-gtk/gtk-peer/gdkfont.h:1.3->1.4
libraries/clib/awt/classpath-gtk/gtk-peer/gnu_java_awt_peer_gtk_GdkFontMetrics.c:1.4->1.5(DEAD)
libraries/clib/awt/classpath-gtk/gtk-peer/gnu_java_awt_peer_gtk_GdkFontPeer.c:1.5->1.6
libraries/clib/awt/classpath-gtk/gtk-peer/gnu_java_awt_peer_gtk_GdkGlyphVector.c:1.5->1.6(DEAD)
libraries/clib/awt/classpath-gtk/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.c:1.10->1.11
libraries/clib/awt/classpath-gtk/gtk-peer/gnu_java_awt_peer_gtk_GtkButtonPeer.c:1.7->1.8
libraries/javalib/Makefile.am:1.309->1.310
libraries/javalib/Makefile.in:1.395->1.396
libraries/javalib/all.files:1.89->1.90
libraries/javalib/gnu/java/awt/peer/gtk/GdkFontMetrics.java:1.2->1.3
libraries/javalib/gnu/java/awt/peer/gtk/GdkFontPeer.java:1.3->1.4
libraries/javalib/gnu/java/awt/peer/gtk/GdkGlyphVector.java:1.4->1.5
libraries/javalib/gnu/java/awt/peer/gtk/GdkGraphics2D.java:1.14->1.15
libraries/javalib/gnu/java/awt/peer/gtk/GdkGraphicsConfiguration.java:INITIAL->1.1
libraries/javalib/gnu/java/awt/peer/gtk/GdkGraphicsEnvironment.java:1.5->1.6
libraries/javalib/gnu/java/awt/peer/gtk/GdkPixbufDecoder.java:1.5->1.6
libraries/javalib/gnu/java/awt/peer/gtk/GdkScreenGraphicsDevice.java:1.1->1.2
libraries/javalib/gnu/java/awt/peer/gtk/GtkToolkit.java:1.12->1.13
Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.3582 kaffe/ChangeLog:1.3583
--- kaffe/ChangeLog:1.3582 Mon Feb 14 19:00:23 2005
+++ kaffe/ChangeLog Mon Feb 14 20:01:18 2005
@@ -1,6 +1,71 @@
2005-02-14 Dalibor Topic <robilad at kaffe.org>
Resynced with GNU Classpath.
+
+ 2005-02-12 Graydon Hoare <graydon at redhat.com>
+
+ * gnu/java/awt/peer/gtk/GdkGraphicsConfiguration.java: Add.
+
+ 2005-02-12 Graydon Hoare <graydon at redhat.com>
+
+ * gnu/java/awt/peer/gtk/GdkFontPeer.java
+ (getGlyphVector):
+ (getFontMetrics):
+ (getTextMetrics): New native methods.
+ * gnu/java/awt/peer/gtk/GdkFontMetrics.java: Remove native parts.
+ * gnu/java/awt/peer/gtk/GdkGlyphVector.java: Likewise.
+ * gnu/java/awt/peer/gtk/GdkGraphicsEnvironment.java:
+ Hold reference to GtkToolkit.
+ * gnu/java/awt/peer/gtk/GdkGraphics2D.java
+ (cairoSetFont):
+ (cairoDrawGdkTextLayout):
+ (cairoDrawString):
+ (getPeerTextMetrics):
+ (getPeerFontMetrics): Remove.
+ (setFont): Don't call cairoSetFont.
+ (cairoDrawGlyphVector): Accept font peer argument.
+ (drawGlyphVector): Pass font peer to cairoDrawGlyphVector.
+ * gnu/java/awt/peer/gtk/GdkPixbufDecoder.java:
+ (finalize): Call finish from here.
+ (produce): Not from here.
+ * gnu/java/awt/peer/gtk/GdkScreenGraphicsDevice.java:
+ Hold reference to GdkGraphicsEnvironment.
+ * gnu/java/awt/peer/gtk/GtkToolkit.java:
+ (getFontMetrics): Change locking.
+ (getBounds): New method.
+ (getLocalGraphicsEnvironment): Pass reference to this.
+
+ * include/Makefile.am: Remove entries for GdkFontMetrics, GdkGlyphVector.
+ * include/gnu_java_awt_peer_gtk_GdkFontMetrics.h: Remove.
+ * include/gnu_java_awt_peer_gtk_GdkFontPeer.h: Regenerate.
+ * include/gnu_java_awt_peer_gtk_GdkGlyphVector.h: Remove.
+ * include/gnu_java_awt_peer_gtk_GdkGraphics2D.h: Regenerate.
+
+ * native/jni/gtk-peer/Makefile.am
+ Remove entries for GdkFontMetrics, GdkGlyphVector.
+ * native/jni/gtk-peer/gdkfont.h: Add #defines, remove struct glyphvec.
+ * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.c
+ (ensure_metrics_cairo):
+ (Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetFont):
+ (Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoDrawString):
+ (Java_gnu_java_awt_peer_gtk_GdkGraphics2D_getPeerFontMetrics):
+ (Java_gnu_java_awt_peer_gtk_GdkGraphics2D_getPeerTextMetrics):
+ (metrics_cairo):
+ (metrics_surface): Remove.
+ (Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoDrawGlyphVector):
+ Pass and install font peer.
+ * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkButtonPeer.c:
+ Release GDK lock while performing upcalls.
+ * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontMetrics.c: Remove.
+ * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkFontPeer.c
+ (Java_gnu_java_awt_peer_gtk_GdkFontPeer_getGlyphVector):
+ (Java_gnu_java_awt_peer_gtk_GdkFontPeer_getFontMetrics):
+ (Java_gnu_java_awt_peer_gtk_GdkFontPeer_getTextMetrics): New methods.
+ * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGlyphVector.c: Remove.
+
+2005-02-14 Dalibor Topic <robilad at kaffe.org>
+
+ Resynced with GNU Classpath.
2005-02-11 Craig Black <craig.black at aonix.com>
Index: kaffe/include/Makefile.am
diff -u kaffe/include/Makefile.am:1.90 kaffe/include/Makefile.am:1.91
--- kaffe/include/Makefile.am:1.90 Fri Feb 11 04:56:20 2005
+++ kaffe/include/Makefile.am Mon Feb 14 20:01:21 2005
@@ -150,9 +150,7 @@
gnu_xml_libxmlj_transform_GnomeTransformerFactory.h
LIBGTKPEER_JNI_HDRS = \
- gnu_java_awt_peer_gtk_GdkFontMetrics.h \
gnu_java_awt_peer_gtk_GdkFontPeer.h \
- gnu_java_awt_peer_gtk_GdkGlyphVector.h \
gnu_java_awt_peer_gtk_GdkGraphics.h \
gnu_java_awt_peer_gtk_GdkGraphics2D.h \
gnu_java_awt_peer_gtk_GdkGraphicsEnvironment.h \
Index: kaffe/include/Makefile.in
diff -u kaffe/include/Makefile.in:1.215 kaffe/include/Makefile.in:1.216
--- kaffe/include/Makefile.in:1.215 Sun Feb 13 21:55:25 2005
+++ kaffe/include/Makefile.in Mon Feb 14 20:01:23 2005
@@ -505,9 +505,7 @@
gnu_xml_libxmlj_transform_GnomeTransformerFactory.h
LIBGTKPEER_JNI_HDRS = \
- gnu_java_awt_peer_gtk_GdkFontMetrics.h \
gnu_java_awt_peer_gtk_GdkFontPeer.h \
- gnu_java_awt_peer_gtk_GdkGlyphVector.h \
gnu_java_awt_peer_gtk_GdkGraphics.h \
gnu_java_awt_peer_gtk_GdkGraphics2D.h \
gnu_java_awt_peer_gtk_GdkGraphicsEnvironment.h \
Index: kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/Makefile.am
diff -u kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/Makefile.am:1.11 kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/Makefile.am:1.12
--- kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/Makefile.am:1.11 Sun Jan 23 18:48:38 2005
+++ kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/Makefile.am Mon Feb 14 20:01:24 2005
@@ -3,7 +3,6 @@
# Gtk/Cairo JNI sources.
if GTK_CAIRO
gtk_cairo_c_source_files = \
- gnu_java_awt_peer_gtk_GdkGlyphVector.c \
gnu_java_awt_peer_gtk_GdkGraphics2D.c
endif
@@ -12,7 +11,6 @@
gdkfont.h \
gnu_java_awt_peer_gtk_GThreadNativeMethodRunner.c \
gnu_java_awt_peer_gtk_GThreadNativeMethodRunner.h \
- gnu_java_awt_peer_gtk_GdkFontMetrics.c \
gnu_java_awt_peer_gtk_GdkFontPeer.c \
gnu_java_awt_peer_gtk_GdkGraphics.c \
gnu_java_awt_peer_gtk_GdkGraphicsEnvironment.c \
Index: kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/Makefile.in
diff -u kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/Makefile.in:1.27 kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/Makefile.in:1.28
--- kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/Makefile.in:1.27 Sun Feb 13 21:56:01 2005
+++ kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/Makefile.in Mon Feb 14 20:01:24 2005
@@ -78,11 +78,9 @@
am__DEPENDENCIES_1 = \
$(top_builddir)/libraries/clib/classpath/libclasspath.la
am__libgtkpeer_la_SOURCES_DIST = \
- gnu_java_awt_peer_gtk_GdkGlyphVector.c \
gnu_java_awt_peer_gtk_GdkGraphics2D.c gdkfont.h \
gnu_java_awt_peer_gtk_GThreadNativeMethodRunner.c \
gnu_java_awt_peer_gtk_GThreadNativeMethodRunner.h \
- gnu_java_awt_peer_gtk_GdkFontMetrics.c \
gnu_java_awt_peer_gtk_GdkFontPeer.c \
gnu_java_awt_peer_gtk_GdkGraphics.c \
gnu_java_awt_peer_gtk_GdkGraphicsEnvironment.c \
@@ -119,11 +117,9 @@
gnu_java_awt_peer_gtk_GtkToolkit.c \
gnu_java_awt_peer_gtk_GtkWindowPeer.c gthread-jni.c \
gthread-jni.h gtkpeer.h
- at GTK_CAIRO_TRUE@am__objects_1 = libgtkpeer_la-gnu_java_awt_peer_gtk_GdkGlyphVector.lo \
- at GTK_CAIRO_TRUE@ libgtkpeer_la-gnu_java_awt_peer_gtk_GdkGraphics2D.lo
+ at GTK_CAIRO_TRUE@am__objects_1 = libgtkpeer_la-gnu_java_awt_peer_gtk_GdkGraphics2D.lo
am_libgtkpeer_la_OBJECTS = $(am__objects_1) \
libgtkpeer_la-gnu_java_awt_peer_gtk_GThreadNativeMethodRunner.lo \
- libgtkpeer_la-gnu_java_awt_peer_gtk_GdkFontMetrics.lo \
libgtkpeer_la-gnu_java_awt_peer_gtk_GdkFontPeer.lo \
libgtkpeer_la-gnu_java_awt_peer_gtk_GdkGraphics.lo \
libgtkpeer_la-gnu_java_awt_peer_gtk_GdkGraphicsEnvironment.lo \
@@ -455,7 +451,6 @@
# Gtk/Cairo JNI sources.
@GTK_CAIRO_TRUE at gtk_cairo_c_source_files = \
- at GTK_CAIRO_TRUE@ gnu_java_awt_peer_gtk_GdkGlyphVector.c \
@GTK_CAIRO_TRUE@ gnu_java_awt_peer_gtk_GdkGraphics2D.c
libgtkpeer_la_SOURCES = \
@@ -463,7 +458,6 @@
gdkfont.h \
gnu_java_awt_peer_gtk_GThreadNativeMethodRunner.c \
gnu_java_awt_peer_gtk_GThreadNativeMethodRunner.h \
- gnu_java_awt_peer_gtk_GdkFontMetrics.c \
gnu_java_awt_peer_gtk_GdkFontPeer.c \
gnu_java_awt_peer_gtk_GdkGraphics.c \
gnu_java_awt_peer_gtk_GdkGraphicsEnvironment.c \
@@ -598,9 +592,7 @@
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libgtkpeer_la-gnu_java_awt_peer_gtk_GThreadNativeMethodRunner.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libgtkpeer_la-gnu_java_awt_peer_gtk_GdkFontMetrics.Plo at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libgtkpeer_la-gnu_java_awt_peer_gtk_GdkFontPeer.Plo at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libgtkpeer_la-gnu_java_awt_peer_gtk_GdkGlyphVector.Plo at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libgtkpeer_la-gnu_java_awt_peer_gtk_GdkGraphics.Plo at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libgtkpeer_la-gnu_java_awt_peer_gtk_GdkGraphics2D.Plo at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libgtkpeer_la-gnu_java_awt_peer_gtk_GdkGraphicsEnvironment.Plo at am__quote@
@@ -659,13 +651,6 @@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
-libgtkpeer_la-gnu_java_awt_peer_gtk_GdkGlyphVector.lo: gnu_java_awt_peer_gtk_GdkGlyphVector.c
- at am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgtkpeer_la_CPPFLAGS) $(CPPFLAGS) $(libgtkpeer_la_CFLAGS) $(CFLAGS) -MT libgtkpeer_la-gnu_java_awt_peer_gtk_GdkGlyphVector.lo -MD -MP -MF "$(DEPDIR)/libgtkpeer_la-gnu_java_awt_peer_gtk_GdkGlyphVector.Tpo" -c -o libgtkpeer_la-gnu_java_awt_peer_gtk_GdkGlyphVector.lo `test -f 'gnu_java_awt_peer_gtk_GdkGlyphVector.c' || echo '$(srcdir)/'`gnu_java_awt_peer_gtk_GdkGlyphVector.c; \
- at am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgtkpeer_la-gnu_java_awt_peer_gtk_GdkGlyphVector.Tpo" "$(DEPDIR)/libgtkpeer_la-gnu_java_awt_peer_gtk_GdkGlyphVector.Plo"; else rm -f "$(DEPDIR)/libgtkpeer_la-gnu_java_awt_peer_gtk_GdkGlyphVector.Tpo"; exit 1; fi
- at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gnu_java_awt_peer_gtk_GdkGlyphVector.c' object='libgtkpeer_la-gnu_java_awt_peer_gtk_GdkGlyphVector.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgtkpeer_la_CPPFLAGS) $(CPPFLAGS) $(libgtkpeer_la_CFLAGS) $(CFLAGS) -c -o libgtkpeer_la-gnu_java_awt_peer_gtk_GdkGlyphVector.lo `test -f 'gnu_java_awt_peer_gtk_GdkGlyphVector.c' || echo '$(srcdir)/'`gnu_java_awt_peer_gtk_GdkGlyphVector.c
-
libgtkpeer_la-gnu_java_awt_peer_gtk_GdkGraphics2D.lo: gnu_java_awt_peer_gtk_GdkGraphics2D.c
@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgtkpeer_la_CPPFLAGS) $(CPPFLAGS) $(libgtkpeer_la_CFLAGS) $(CFLAGS) -MT libgtkpeer_la-gnu_java_awt_peer_gtk_GdkGraphics2D.lo -MD -MP -MF "$(DEPDIR)/libgtkpeer_la-gnu_java_awt_peer_gtk_GdkGraphics2D.Tpo" -c -o libgtkpeer_la-gnu_java_awt_peer_gtk_GdkGraphics2D.lo `test -f 'gnu_java_awt_peer_gtk_GdkGraphics2D.c' || echo '$(srcdir)/'`gnu_java_awt_peer_gtk_GdkGraphics2D.c; \
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgtkpeer_la-gnu_java_awt_peer_gtk_GdkGraphics2D.Tpo" "$(DEPDIR)/libgtkpeer_la-gnu_java_awt_peer_gtk_GdkGraphics2D.Plo"; else rm -f "$(DEPDIR)/libgtkpeer_la-gnu_java_awt_peer_gtk_GdkGraphics2D.Tpo"; exit 1; fi
@@ -679,13 +664,6 @@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gnu_java_awt_peer_gtk_GThreadNativeMethodRunner.c' object='libgtkpeer_la-gnu_java_awt_peer_gtk_GThreadNativeMethodRunner.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgtkpeer_la_CPPFLAGS) $(CPPFLAGS) $(libgtkpeer_la_CFLAGS) $(CFLAGS) -c -o libgtkpeer_la-gnu_java_awt_peer_gtk_GThreadNativeMethodRunner.lo `test -f 'gnu_java_awt_peer_gtk_GThreadNativeMethodRunner.c' || echo '$(srcdir)/'`gnu_java_awt_peer_gtk_GThreadNativeMethodRunner.c
-
-libgtkpeer_la-gnu_java_awt_peer_gtk_GdkFontMetrics.lo: gnu_java_awt_peer_gtk_GdkFontMetrics.c
- at am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgtkpeer_la_CPPFLAGS) $(CPPFLAGS) $(libgtkpeer_la_CFLAGS) $(CFLAGS) -MT libgtkpeer_la-gnu_java_awt_peer_gtk_GdkFontMetrics.lo -MD -MP -MF "$(DEPDIR)/libgtkpeer_la-gnu_java_awt_peer_gtk_GdkFontMetrics.Tpo" -c -o libgtkpeer_la-gnu_java_awt_peer_gtk_GdkFontMetrics.lo `test -f 'gnu_java_awt_peer_gtk_GdkFontMetrics.c' || echo '$(srcdir)/'`gnu_java_awt_peer_gtk_GdkFontMetrics.c; \
- at am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libgtkpeer_la-gnu_java_awt_peer_gtk_GdkFontMetrics.Tpo" "$(DEPDIR)/libgtkpeer_la-gnu_java_awt_peer_gtk_GdkFontMetrics.Plo"; else rm -f "$(DEPDIR)/libgtkpeer_la-gnu_java_awt_peer_gtk_GdkFontMetrics.Tpo"; exit 1; fi
- at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gnu_java_awt_peer_gtk_GdkFontMetrics.c' object='libgtkpeer_la-gnu_java_awt_peer_gtk_GdkFontMetrics.lo' libtool=yes @AMDEPBACKSLASH@
- at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgtkpeer_la_CPPFLAGS) $(CPPFLAGS) $(libgtkpeer_la_CFLAGS) $(CFLAGS) -c -o libgtkpeer_la-gnu_java_awt_peer_gtk_GdkFontMetrics.lo `test -f 'gnu_java_awt_peer_gtk_GdkFontMetrics.c' || echo '$(srcdir)/'`gnu_java_awt_peer_gtk_GdkFontMetrics.c
libgtkpeer_la-gnu_java_awt_peer_gtk_GdkFontPeer.lo: gnu_java_awt_peer_gtk_GdkFontPeer.c
@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgtkpeer_la_CPPFLAGS) $(CPPFLAGS) $(libgtkpeer_la_CFLAGS) $(CFLAGS) -MT libgtkpeer_la-gnu_java_awt_peer_gtk_GdkFontPeer.lo -MD -MP -MF "$(DEPDIR)/libgtkpeer_la-gnu_java_awt_peer_gtk_GdkFontPeer.Tpo" -c -o libgtkpeer_la-gnu_java_awt_peer_gtk_GdkFontPeer.lo `test -f 'gnu_java_awt_peer_gtk_GdkFontPeer.c' || echo '$(srcdir)/'`gnu_java_awt_peer_gtk_GdkFontPeer.c; \
Index: kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/gdkfont.h
diff -u kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/gdkfont.h:1.3 kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/gdkfont.h:1.4
--- kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/gdkfont.h:1.3 Sun Oct 10 16:28:45 2004
+++ kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/gdkfont.h Mon Feb 14 20:01:24 2005
@@ -102,6 +102,21 @@
#define TEXT_METRICS_Y_ADVANCE 5
#define NUM_TEXT_METRICS 6
+#define NUM_GLYPH_METRICS 10
+
+#define GLYPH_LOG_X(i) (NUM_GLYPH_METRICS * (i) )
+#define GLYPH_LOG_Y(i) (NUM_GLYPH_METRICS * (i) + 1)
+#define GLYPH_LOG_WIDTH(i) (NUM_GLYPH_METRICS * (i) + 2)
+#define GLYPH_LOG_HEIGHT(i) (NUM_GLYPH_METRICS * (i) + 3)
+
+#define GLYPH_INK_X(i) (NUM_GLYPH_METRICS * (i) + 4)
+#define GLYPH_INK_Y(i) (NUM_GLYPH_METRICS * (i) + 5)
+#define GLYPH_INK_WIDTH(i) (NUM_GLYPH_METRICS * (i) + 6)
+#define GLYPH_INK_HEIGHT(i) (NUM_GLYPH_METRICS * (i) + 7)
+
+#define GLYPH_POS_X(i) (NUM_GLYPH_METRICS * (i) + 8)
+#define GLYPH_POS_Y(i) (NUM_GLYPH_METRICS * (i) + 9)
+
struct peerfont
{
PangoFont *font;
@@ -117,16 +132,6 @@
* to invoke.
*/
void *graphics_resource;
-};
-
-struct glyphvec
-{
- /* the GList is list of PangoGlyphItems, each of which is a pair of 1
- PangoItem and 1 PangoGlyphString. */
- GList *glyphitems;
- PangoFontDescription *desc;
- PangoFont *font;
- PangoContext *ctx;
};
struct textlayout
===================================================================
Checking out kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/gnu_java_awt_peer_gtk_GdkFontMetrics.c
RCS: /home/cvs/kaffe/kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/Attic/gnu_java_awt_peer_gtk_GdkFontMetrics.c,v
VERS: 1.4
***************
--- kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/gnu_java_awt_peer_gtk_GdkFontMetrics.c Mon Feb 14 20:06:40 2005
+++ /dev/null Sun Aug 4 19:57:58 2002
@@ -1,115 +0,0 @@
-/* gdkfontmetrics.c
- Copyright (C) 1999, 2003, 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath 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 for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-02111-1307 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-#include "gtkpeer.h"
-#include "gdkfont.h"
-
-#include "gnu_java_awt_peer_gtk_GdkFontMetrics.h"
-#include <gdk/gdkx.h>
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GdkFontMetrics_getPeerFontMetrics
- (JNIEnv *env, jclass clazz __attribute__ ((unused)), jobject java_font, jdoubleArray java_metrics)
-{
- struct peerfont *pfont = NULL;
- jdouble *native_metrics = NULL;
- PangoFontMetrics *pango_metrics;
-
- gdk_threads_enter();
-
- pfont = (struct peerfont *) NSA_GET_FONT_PTR (env, java_font);
- g_assert (pfont != NULL);
-
- pango_metrics = pango_context_get_metrics (pfont->ctx, pfont->desc,
- gtk_get_default_language ());
-
- native_metrics = (*env)->GetDoubleArrayElements (env, java_metrics, NULL);
- g_assert (native_metrics != NULL);
-
- native_metrics[FONT_METRICS_ASCENT] = PANGO_PIXELS (pango_font_metrics_get_ascent (pango_metrics));
- native_metrics[FONT_METRICS_MAX_ASCENT] = native_metrics[FONT_METRICS_ASCENT];
- native_metrics[FONT_METRICS_DESCENT] = PANGO_PIXELS (pango_font_metrics_get_descent (pango_metrics));
- if (native_metrics[FONT_METRICS_DESCENT] < 0)
- native_metrics[FONT_METRICS_DESCENT] = - native_metrics[FONT_METRICS_DESCENT];
- native_metrics[FONT_METRICS_MAX_DESCENT] = native_metrics[FONT_METRICS_DESCENT];
- native_metrics[FONT_METRICS_MAX_ADVANCE] = PANGO_PIXELS (pango_font_metrics_get_approximate_char_width (pango_metrics));
-
- (*env)->ReleaseDoubleArrayElements (env, java_metrics, native_metrics, 0);
-
- pango_font_metrics_unref (pango_metrics);
-
- gdk_threads_leave();
-}
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GdkFontMetrics_getPeerTextMetrics
- (JNIEnv *env, jclass clazz __attribute__ ((unused)), jobject java_font, jstring str, jdoubleArray java_metrics)
-{
- struct peerfont *pfont = NULL;
- const char *cstr = NULL;
- jdouble *native_metrics = NULL;
- PangoRectangle log;
-
- gdk_threads_enter();
-
- pfont = (struct peerfont *)NSA_GET_FONT_PTR (env, java_font);
- g_assert (pfont != NULL);
-
- cstr = (*env)->GetStringUTFChars (env, str, NULL);
- g_assert(cstr != NULL);
-
- pango_layout_set_text (pfont->layout, cstr, -1);
- pango_layout_get_extents (pfont->layout, NULL, &log);
-
- (*env)->ReleaseStringUTFChars (env, str, cstr);
- pango_layout_set_text (pfont->layout, "", -1);
-
- native_metrics = (*env)->GetDoubleArrayElements (env, java_metrics, NULL);
- g_assert (native_metrics != NULL);
-
- native_metrics[TEXT_METRICS_X_BEARING] = PANGO_PIXELS(log.x);
- native_metrics[TEXT_METRICS_Y_BEARING] = PANGO_PIXELS(log.y);
- native_metrics[TEXT_METRICS_WIDTH] = PANGO_PIXELS(log.width);
- native_metrics[TEXT_METRICS_HEIGHT] = PANGO_PIXELS(log.height);
- native_metrics[TEXT_METRICS_X_ADVANCE] = PANGO_PIXELS(log.x + log.width);
- native_metrics[TEXT_METRICS_Y_ADVANCE] = PANGO_PIXELS(log.y + log.height);
-
- (*env)->ReleaseDoubleArrayElements (env, java_metrics, native_metrics, 0);
-
- gdk_threads_leave();
-}
-
Index: kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/gnu_java_awt_peer_gtk_GdkFontPeer.c
diff -u kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/gnu_java_awt_peer_gtk_GdkFontPeer.c:1.5 kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/gnu_java_awt_peer_gtk_GdkFontPeer.c:1.6
--- kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/gnu_java_awt_peer_gtk_GdkFontPeer.c:1.5 Mon Dec 20 02:34:53 2004
+++ kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/gnu_java_awt_peer_gtk_GdkFontPeer.c Mon Feb 14 20:01:24 2005
@@ -40,23 +40,6 @@
struct state_table *native_font_state_table;
-/*
-rough sketch of the mapping between java and
-pango text objects:
-
- Font <-> - PangoFont
- - PangoFontDescription
- - PangoContext
- - PangoLayout (for rendering and measuring)
-
- GlyphVector <-> - GList of PangoGlyphItem
- - PangoFontDescription
- - PangoContext
-
- FontRenderContext <-> stays in plain java
-
-*/
-
enum java_awt_font_style {
java_awt_font_PLAIN = 0,
java_awt_font_BOLD = 1,
@@ -69,11 +52,22 @@
java_awt_font_HANGING_BASELINE = 2
};
+static jmethodID glyphVector_ctor;
+static jclass glyphVector_class;
+static PangoAttrList *attrs = NULL;
+
JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_GdkFontPeer_initStaticState
(JNIEnv *env, jclass clazz)
{
NSA_FONT_INIT (env, clazz);
+
+ glyphVector_class = (*env)->FindClass
+ (env, "gnu/java/awt/peer/gtk/GdkGlyphVector");
+
+ glyphVector_ctor = (*env)->GetMethodID
+ (env, glyphVector_class, "<init>",
+ "([D[ILjava/awt/Font;Ljava/awt/font/FontRenderContext;)V");
}
JNIEXPORT void JNICALL
@@ -111,6 +105,223 @@
gdk_threads_leave ();
}
+
+JNIEXPORT jobject JNICALL
+Java_gnu_java_awt_peer_gtk_GdkFontPeer_getGlyphVector
+ (JNIEnv *env, jobject self,
+ jstring chars,
+ jobject font,
+ jobject fontRenderContext)
+{
+ struct peerfont *pfont = NULL;
+ GList *items = NULL, *i = NULL;
+ gchar *str = NULL;
+ int len, j;
+ double *native_extents;
+ int *native_codes;
+ jintArray java_codes = NULL;
+ jdoubleArray java_extents = NULL;
+
+ gdk_threads_enter ();
+
+ pfont = (struct peerfont *)NSA_GET_FONT_PTR (env, self);
+ g_assert (pfont != NULL);
+
+ len = (*gdk_env())->GetStringUTFLength (env, chars);
+ str = (gchar *)(*env)->GetStringUTFChars (env, chars, NULL);
+ g_assert (str != NULL);
+
+ if (attrs == NULL)
+ attrs = pango_attr_list_new ();
+
+ if (len > 0 && str[len-1] == '\0')
+ len--;
+
+ items = pango_itemize (pfont->ctx, str, 0, len, attrs, NULL);
+
+ i = g_list_first (items);
+
+ if (i == NULL)
+ {
+ java_extents = (*env)->NewDoubleArray (env, 0);
+ java_codes = (*env)->NewIntArray (env, 0);
+ }
+ else
+ {
+ PangoGlyphString *glyphs;
+ PangoItem *item = (PangoItem *)i->data;
+
+ pango_context_set_font_description (pfont->ctx, pfont->desc);
+ pango_context_set_language (pfont->ctx, gtk_get_default_language());
+ pango_context_load_font (pfont->ctx, pfont->desc);
+
+ glyphs = pango_glyph_string_new ();
+ g_assert (glyphs != NULL);
+
+ pango_shape (str + item->offset, item->length,
+ &(item->analysis), glyphs);
+
+ if (glyphs->num_glyphs > 0)
+ {
+ int x = 0;
+ double scale = ((double) PANGO_SCALE);
+
+ java_extents = (*env)->NewDoubleArray (env, glyphs->num_glyphs * NUM_GLYPH_METRICS);
+ java_codes = (*env)->NewIntArray (env, glyphs->num_glyphs);
+ native_extents = (*env)->GetDoubleArrayElements (env, java_extents, NULL);
+ native_codes = (*env)->GetIntArrayElements (env, java_codes, NULL);
+
+ for (j = 0; j < glyphs->num_glyphs; ++j)
+ {
+ PangoRectangle ink;
+ PangoRectangle logical;
+ PangoGlyphGeometry *geom = &glyphs->glyphs[j].geometry;
+
+ pango_font_get_glyph_extents (pfont->font,
+ glyphs->glyphs[j].glyph,
+ &ink, &logical);
+
+ native_codes[j] = glyphs->glyphs[j].glyph;
+
+ native_extents[ GLYPH_LOG_X(j) ] = (logical.x) / scale;
+ native_extents[ GLYPH_LOG_Y(j) ] = (- logical.y) / scale;
+ native_extents[ GLYPH_LOG_WIDTH(j) ] = (logical.width) / scale;
+ native_extents[ GLYPH_LOG_HEIGHT(j) ] = (logical.height) / scale;
+
+ native_extents[ GLYPH_INK_X(j) ] = (ink.x) / scale;
+ native_extents[ GLYPH_INK_Y(j) ] = (- ink.y) / scale;
+ native_extents[ GLYPH_INK_WIDTH(j) ] = (ink.width) / scale;
+ native_extents[ GLYPH_INK_HEIGHT(j) ] = (ink.height) / scale;
+
+ native_extents[ GLYPH_POS_X(j) ] = (x + geom->x_offset) / scale;
+ native_extents[ GLYPH_POS_Y(j) ] = ( - geom->y_offset) / scale;
+
+ x += geom->width;
+ }
+ (*env)->ReleaseDoubleArrayElements (env, java_extents, native_extents, 0);
+ (*env)->ReleaseIntArrayElements (env, java_codes, native_codes, 0);
+ }
+
+ pango_glyph_string_free (glyphs);
+ }
+
+ (*env)->ReleaseStringUTFChars (env, chars, str);
+
+ for (i = g_list_first (items); i != NULL; i = g_list_next (i))
+ g_free (i->data);
+
+ g_list_free (items);
+
+ gdk_threads_leave ();
+
+ return (*env)->NewObject (env,
+ glyphVector_class,
+ glyphVector_ctor,
+ java_extents, java_codes,
+ font, fontRenderContext);
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GdkFontPeer_getFontMetrics
+ (JNIEnv *env, jobject java_font, jdoubleArray java_metrics)
+{
+ struct peerfont *pfont = NULL;
+ jdouble *native_metrics = NULL;
+ PangoFontMetrics *pango_metrics;
+
+ gdk_threads_enter();
+
+ pfont = (struct peerfont *) NSA_GET_FONT_PTR (env, java_font);
+ g_assert (pfont != NULL);
+
+ pango_metrics
+ = pango_context_get_metrics (pfont->ctx, pfont->desc,
+ gtk_get_default_language ());
+
+ native_metrics
+ = (*env)->GetDoubleArrayElements (env, java_metrics, NULL);
+
+ g_assert (native_metrics != NULL);
+
+ native_metrics[FONT_METRICS_ASCENT]
+ = PANGO_PIXELS (pango_font_metrics_get_ascent (pango_metrics));
+
+ native_metrics[FONT_METRICS_MAX_ASCENT]
+ = native_metrics[FONT_METRICS_ASCENT];
+
+ native_metrics[FONT_METRICS_DESCENT]
+ = PANGO_PIXELS (pango_font_metrics_get_descent (pango_metrics));
+
+ if (native_metrics[FONT_METRICS_DESCENT] < 0)
+ native_metrics[FONT_METRICS_DESCENT]
+ = - native_metrics[FONT_METRICS_DESCENT];
+
+ native_metrics[FONT_METRICS_MAX_DESCENT]
+ = native_metrics[FONT_METRICS_DESCENT];
+
+ native_metrics[FONT_METRICS_MAX_ADVANCE]
+ = PANGO_PIXELS (pango_font_metrics_get_approximate_char_width
+ (pango_metrics));
+
+ (*env)->ReleaseDoubleArrayElements (env,
+ java_metrics,
+ native_metrics, 0);
+
+ pango_font_metrics_unref (pango_metrics);
+
+ gdk_threads_leave();
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GdkFontPeer_getTextMetrics
+ (JNIEnv *env, jobject java_font, jstring str, jdoubleArray java_metrics)
+{
+ struct peerfont *pfont = NULL;
+ const char *cstr = NULL;
+ jdouble *native_metrics = NULL;
+ PangoRectangle log;
+
+ gdk_threads_enter();
+
+ pfont = (struct peerfont *)NSA_GET_FONT_PTR (env, java_font);
+ g_assert (pfont != NULL);
+
+ cstr = (*env)->GetStringUTFChars (env, str, NULL);
+ g_assert(cstr != NULL);
+
+ pango_layout_set_text (pfont->layout, cstr, -1);
+ pango_layout_get_extents (pfont->layout, NULL, &log);
+
+ (*env)->ReleaseStringUTFChars (env, str, cstr);
+ pango_layout_set_text (pfont->layout, "", -1);
+
+ native_metrics = (*env)->GetDoubleArrayElements (env, java_metrics, NULL);
+ g_assert (native_metrics != NULL);
+
+ native_metrics[TEXT_METRICS_X_BEARING]
+ = PANGO_PIXELS( ((double)log.x) );
+
+ native_metrics[TEXT_METRICS_Y_BEARING]
+ = PANGO_PIXELS( ((double)log.y) );
+
+ native_metrics[TEXT_METRICS_WIDTH]
+ = PANGO_PIXELS( ((double)log.width) );
+
+ native_metrics[TEXT_METRICS_HEIGHT]
+ = PANGO_PIXELS( ((double)log.height) );
+
+ native_metrics[TEXT_METRICS_X_ADVANCE]
+ = PANGO_PIXELS( ((double) (log.x + log.width)) );
+
+ native_metrics[TEXT_METRICS_Y_ADVANCE]
+ = PANGO_PIXELS( ((double) (log.y + log.height)) );
+
+ (*env)->ReleaseDoubleArrayElements (env, java_metrics, native_metrics, 0);
+
+ gdk_threads_leave();
+}
+
+
JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_GdkFontPeer_setFont
(JNIEnv *env, jobject self, jstring family_name_str, jint style_int, jint size, jboolean useGraphics2D)
@@ -142,7 +353,6 @@
pango_font_description_set_family (pfont->desc, family_name);
(*env)->ReleaseStringUTFChars(env, family_name_str, family_name);
- pango_font_description_set_size (pfont->desc, size * dpi_conversion_factor);
if (style & java_awt_font_BOLD)
pango_font_description_set_weight (pfont->desc, PANGO_WEIGHT_BOLD);
@@ -152,6 +362,7 @@
if (useGraphics2D)
{
+ pango_font_description_set_size (pfont->desc, size * PANGO_SCALE);
if (pfont->ctx == NULL)
{
ft2_map = PANGO_FT2_FONT_MAP(pango_ft2_font_map_for_display ());
@@ -160,6 +371,9 @@
}
else
{
+ /* GDK uses a slightly different DPI setting. */
+ pango_font_description_set_size (pfont->desc,
+ size * dpi_conversion_factor);
if (pfont->ctx == NULL)
pfont->ctx = gdk_pango_context_get();
}
===================================================================
Checking out kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/gnu_java_awt_peer_gtk_GdkGlyphVector.c
RCS: /home/cvs/kaffe/kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/Attic/gnu_java_awt_peer_gtk_GdkGlyphVector.c,v
VERS: 1.5
***************
--- kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/gnu_java_awt_peer_gtk_GdkGlyphVector.c Mon Feb 14 20:06:40 2005
+++ /dev/null Sun Aug 4 19:57:58 2002
@@ -1,696 +0,0 @@
-/* gdkglyphvector.c
- Copyright (C) 2003, 2004 Free Software Foundation, Inc.
-
- This file is part of GNU Classpath.
-
- GNU Classpath is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- GNU Classpath 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 for more details.
-
- You should have received a copy of the GNU General Public License
- along with GNU Classpath; see the file COPYING. If not, write to the
- Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA.
-
- Linking this library statically or dynamically with other modules is
- making a combined work based on this library. Thus, the terms and
- conditions of the GNU General Public License cover the whole
- combination.
-
- As a special exception, the copyright holders of this library give you
- permission to link this library with independent modules to produce an
- executable, regardless of the license terms of these independent
- modules, and to copy and distribute the resulting executable under
- terms of your choice, provided that you also meet, for each linked
- independent module, the terms and conditions of the license of that
- module. An independent module is a module which is not derived from
- or based on this library. If you modify this library, you may extend
- this exception to your version of the library, but you are not
- obligated to do so. If you do not wish to do so, delete this
- exception statement from your version. */
-
-#include "gdkfont.h"
-#include "gnu_java_awt_peer_gtk_GdkGlyphVector.h"
-
-struct state_table *native_glyphvector_state_table;
-
-typedef struct {
- double x;
- double y;
- double width;
- double height;
-} rect_t;
-
-#define DOUBLE_TO_26_6(d) ((FT_F26Dot6)((d) * 64.0))
-#define DOUBLE_FROM_26_6(t) ((double)(t) / 64.0)
-#define DOUBLE_TO_16_16(d) ((FT_Fixed)((d) * 65536.0))
-#define DOUBLE_FROM_16_16(t) ((double)(t) / 65536.0)
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GdkGlyphVector_initStaticState
- (JNIEnv *env, jclass clazz)
-{
- NSA_GV_INIT (env, clazz);
-}
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GdkGlyphVector_initState
- (JNIEnv *env, jobject self, jobject font, jobject ctx __attribute__ ((unused)))
-{
- struct glyphvec *vec = NULL;
- struct peerfont *pfont = NULL;
-
- gdk_threads_enter ();
- g_assert (font != NULL);
- pfont = (struct peerfont *)NSA_GET_FONT_PTR (env, font);
- g_assert (pfont != NULL);
- g_assert (pfont->ctx != NULL);
- g_assert (pfont->desc != NULL);
-
- g_assert (self != NULL);
- vec = (struct glyphvec *) g_malloc0 (sizeof (struct glyphvec));
- g_assert (vec != NULL);
-
- vec->desc = pango_font_describe (pfont->font);
- g_assert (vec->desc != NULL);
-
- vec->font = pfont->font;
- g_object_ref (vec->font);
-
- vec->ctx = pfont->ctx;
- g_object_ref (vec->ctx);
-
- NSA_SET_GV_PTR (env, self, vec);
- gdk_threads_leave ();
-}
-
-static void free_glyphitems (GList *list)
-{
- GList *i = NULL;
- PangoGlyphItem *gi = NULL;
-
- for (i = g_list_first (list); i != NULL; i = g_list_next (i))
- {
- g_assert (i->data != NULL);
- gi = (PangoGlyphItem *)i->data;
-
- if (gi->glyphs != NULL)
- pango_glyph_string_free (gi->glyphs);
-
- if (gi->item != NULL)
- g_free (gi->item);
- }
- g_list_free (list);
-}
-
-static void seek_glyphstring_idx (GList *list, int idx,
- int *nidx,
- PangoGlyphString **gs,
- PangoFont **fnt)
-{
- GList *i = NULL;
- PangoGlyphItem *gi = NULL;
- int begin = 0;
-
- g_assert (list != NULL);
- g_assert (gs != NULL);
- g_assert (nidx != NULL);
-
-
- for (i = g_list_first (list); i != NULL; i = g_list_next (i))
- {
- g_assert (i->data != NULL);
- gi = (PangoGlyphItem *)i->data;
-
- g_assert (gi->glyphs != NULL);
-
- if (begin <= idx && idx < begin + gi->glyphs->num_glyphs)
- {
- *gs = gi->glyphs;
- *nidx = idx - begin;
- if (fnt && gi->item)
- *fnt = gi->item->analysis.font;
- return;
- }
- else
- {
- begin += gi->glyphs->num_glyphs;
- }
- }
- *gs = NULL;
- *nidx = -1;
-}
-
-static void seek_glyph_idx (GList *list, int idx,
- PangoGlyphInfo **g,
- PangoFont **fnt)
-{
- PangoGlyphString *gs = NULL;
- int nidx = -1;
-
- g_assert (list != NULL);
- g_assert (g != NULL);
-
- seek_glyphstring_idx (list, idx, &nidx, &gs, fnt);
-
- g_assert (gs != NULL);
- g_assert (nidx != -1);
- g_assert (nidx < gs->num_glyphs);
- g_assert (gs->glyphs != NULL);
-
- *g = gs->glyphs + nidx;
-}
-
-static void union_rects (rect_t *r1,
- const rect_t *r2)
-{
- rect_t r;
-
- g_assert (r1 != NULL);
- g_assert (r2 != NULL);
-
- /*
- x is the left edge of the rect,
- y is the top edge of the rect
- */
-
-#ifndef min
-#define min(x,y) ((x) < (y) ? (x) : (y))
-#endif
-
-#ifndef max
-#define max(x,y) ((x) < (y) ? (y) : (x))
-#endif
-
- r.x = min(r1->x, r2->x);
-
- r.y = min(r1->y, r2->y);
-
- r.width = max(r1->x + r1->width,
- r2->x + r2->width) - r.x;
-
- r.height = max(r1->y + r1->height,
- r2->y + r2->height) - r.y;
-
- *r1 = r;
-}
-
-static jdoubleArray rect_to_array (JNIEnv *env, const rect_t *r)
-{
- /* We often return rectangles as arrays : { x, y, w, h } */
- jdoubleArray ret;
- double *rp = NULL;
- g_assert (r != NULL);
- ret = (*env)->NewDoubleArray (env, 4);
- rp = (*env)->GetDoubleArrayElements (env, ret, NULL);
- g_assert (rp != NULL);
- rp[0] = r->x;
- /* freetype and pango's view of space is upside down from java2d's */
- rp[1] = r->y * -1;
- rp[2] = r->width;
- rp[3] = r->height;
- (*env)->ReleaseDoubleArrayElements (env, ret, rp, 0);
- return ret;
*** Patch too long, truncated ***
More information about the kaffe
mailing list