[cairo-commit] cairo-java/src/java/org/freedesktop/cairo Cairo.java, 1.15, 1.16 TextExtents.java, 1.4, 1.5 ScaledFont.java, NONE, 1.1 Glyph.java, 1.3, 1.4 FontFace.java, 1.1, 1.2

Jeffrey Morgan commit at pdx.freedesktop.org
Sat Apr 23 12:25:58 PDT 2005


Committed by: kuzman

Update of /cvs/cairo/cairo-java/src/java/org/freedesktop/cairo
In directory gabe:/tmp/cvs-serv7968/src/java/org/freedesktop/cairo

Modified Files:
	Cairo.java TextExtents.java Glyph.java FontFace.java 
Added Files:
	ScaledFont.java 
Log Message:
updated FontFace and added ScaledFont

Index: Cairo.java
===================================================================
RCS file: /cvs/cairo/cairo-java/src/java/org/freedesktop/cairo/Cairo.java,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- Cairo.java	23 Apr 2005 16:48:28 -0000	1.15
+++ Cairo.java	23 Apr 2005 19:25:55 -0000	1.16
@@ -723,11 +723,6 @@
 		cairo_set_font_matrix(getHandle(), matrix.getHandle());
 	}
 	
-	
-//	public Matrix getFontMatrix() {
-//		return new Matrix(cairo_get_font_matrix(getHandle()));
-//	}
-
     /**
      * Draws the given text on the screen.
      * 
@@ -747,20 +742,27 @@
 		cairo_show_glyphs(getHandle(), hndls);
 	}
 
+	/**
+	 * Gets the current font face.
+	 */
 	public FontFace getFontFace() {
 		return new FontFace(cairo_get_font_face(getHandle()));
 	}
 
+	/**
+	 * Sets the current font face.
+	 * @param font
+	 */
+	public void setFont(FontFace font) {
+		cairo_set_font_face(getHandle(), font.getHandle());
+	}
+
 	public FontExtents getFontExtents() {
 		Handle hndl = Struct.getNullHandle();
 		cairo_font_extents(getHandle(), hndl);
 		return new FontExtents(hndl);
 	}
 	
-	public void setFont(FontFace font) {
-		cairo_set_font_face(getHandle(), font.getHandle());
-	}
-
     /**
      * Returns the text extents of the given string using current font and size
      * settings.
@@ -829,7 +831,6 @@
 
 	/**
 	 * Gets the current source pattern for this object.
-	 * @return
 	 */
 	public Pattern getSource() {
 		Handle hndl = cairo_get_source(getHandle());

Index: TextExtents.java
===================================================================
RCS file: /cvs/cairo/cairo-java/src/java/org/freedesktop/cairo/TextExtents.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- TextExtents.java	11 Apr 2005 23:44:05 -0000	1.4
+++ TextExtents.java	23 Apr 2005 19:25:56 -0000	1.5
@@ -11,6 +11,12 @@
 
 import org.gnu.javagnome.Handle;
 
+/**
+ * The TextExtents stores the extents of a single glyph or a 
+ * string of glyphs in user-space coordinates. Because text
+ * extents are in user-space coordinates, they don't scale along with
+ * the current transformation matrix.
+ */
 public class TextExtents extends CairoObject {
 
 	TextExtents(Handle hndl) {

--- NEW FILE: ScaledFont.java ---
/*
 * Java-Gnome Bindings Library
*
* Copyright 1998-2005 the Java-Gnome Team, all rights reserved.
*
* The Java-Gnome bindings library is free software distributed under
* the terms of the GNU Library General Public License version 2.
*/
package org.freedesktop.cairo;

import org.gnu.javagnome.Handle;

public class ScaledFont extends CairoObject {

	/**
	 * Create a new ScaledFont
	 * @param fontFace The FontFace
	 * @param matrix font space to user space transformation matrix for the
	 * font. In the simplest case of a N point font, this matrix is just a 
	 * scale by N, but it can also be used to shear the font or stretch it 
	 * unequally along the two axes.
	 * @param ctm user to device transformation matrix with which the font will
	 * be used.
	 */
	public ScaledFont(FontFace fontFace, Matrix matrix, Matrix ctm) {
		super(cairo_scaled_font_create(fontFace.getHandle(), matrix.getHandle(), ctm.getHandle()));
	}
	
	ScaledFont(Handle hndl) {
		super(hndl);
	}
	
	public FontExtents getFontExtents() {
		Handle hndl = getNullHandle();
		int status = cairo_scaled_font_extents(getHandle(), hndl);
		return new FontExtents(hndl);
	}
	
	native static final private Handle cairo_scaled_font_create(Handle face, Handle matrix, Handle ctm);
	native static final private int cairo_scaled_font_extents(Handle obj, Handle extents);

}

Index: Glyph.java
===================================================================
RCS file: /cvs/cairo/cairo-java/src/java/org/freedesktop/cairo/Glyph.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- Glyph.java	24 Mar 2005 18:11:40 -0000	1.3
+++ Glyph.java	23 Apr 2005 19:25:56 -0000	1.4
@@ -10,6 +10,18 @@
 
 import org.gnu.javagnome.Handle;
 
+/**
+ *  A Glyph holds information about a single glyph when drawing 
+ *  or measuring text. A font is (in simple terms) a collection 
+ *  of shapes used to draw text. A glyph is one of these shapes. 
+ *  There can be multiple glyphs for a single character (alternates 
+ *  to be used in different contexts, for example), or a glyph 
+ *  can be a <firstterm>ligature</firstterm> of multiple characters. 
+ *  Cairo doesn't expose any way of converting input text into 
+ *  glyphs, so in order to use the Cairo interfaces that take arrays 
+ *  of glyphs, you must directly access the appropriate underlying 
+ *  font system.
+ */
 public class Glyph extends CairoObject {
 	
 	Glyph(Handle hndl) {

Index: FontFace.java
===================================================================
RCS file: /cvs/cairo/cairo-java/src/java/org/freedesktop/cairo/FontFace.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- FontFace.java	11 Apr 2005 00:47:21 -0000	1.1
+++ FontFace.java	23 Apr 2005 19:25:56 -0000	1.2
@@ -10,6 +10,11 @@
 
 import org.gnu.javagnome.Handle;
 
+/**
+ * A FontFace specifies all aspects of a font other than the size 
+ * or font matrix (a font matrix is used to distort a font by 
+ * sheering it or scaling it unequally in the two directions). 
+ */
 public class FontFace extends CairoObject {
 	
 	FontFace(Handle hndl) {
@@ -20,29 +25,11 @@
 		cairo_font_face_destroy(getHandle());
 	}
 	
-//	public FontExtents getFontExtents(Matrix fontMatrix) throws CairoException {
-//		Handle hndl = Struct.getNullHandle();
-//		int status = cairo_font_extents(getHandle(), fontMatrix.getHandle(), hndl);
-//		if (status == Status.SUCCESS.getValue())
-//			return new FontExtents(hndl);
-//		return null;
-//	}
-	
-//	public TextExtents getGlyphExtents(Matrix fontMatrix, Glyph[] glyphs) {
-//		Handle[] hndls = new Handle[glyphs.length];
-//		for (int i = 0; i < glyphs.length; i++)
-//			hndls[i] = glyphs[i].getHandle();
-//		Handle te = Struct.getNullHandle();
-//		cairo_font_glyph_extents(getHandle(), fontMatrix.getHandle(), hndls, te);
-//		return new TextExtents(te);
-//	}
 
     /*
      * Native calls
      */
 	native static final private void cairo_font_face_reference(Handle obj);
 	native static final private void cairo_font_face_destroy(Handle obj);
-//	native static final private int cairo_font_extents(Handle obj, Handle matrix, Handle extents);
-//	native static final private void cairo_font_glyph_extents(Handle obj, Handle matrix, Handle[] glyphs, Handle extents);
 
 }




More information about the cairo-commit mailing list