[cairo-commit] [cairo-www] src/freetypepython.mdwn

Carl Worth cworth at freedesktop.org
Wed Nov 3 06:36:23 PDT 2010


 src/freetypepython.mdwn |   18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

New commits:
commit 19305c39d930adeafd9760597bf811d5e5316341
Author: vasya.pupkinbekov <vasya.pupkinbekov at web>
Date:   Wed Nov 3 06:36:21 2010 -0700

diff --git a/src/freetypepython.mdwn b/src/freetypepython.mdwn
index 9bafcc4..a1a48de 100644
--- a/src/freetypepython.mdwn
+++ b/src/freetypepython.mdwn
@@ -27,6 +27,12 @@ The resulting cairo font face however can be used normally with pycairo.
 			_freetype_so = ctypes.CDLL ("libfreetype.so.6")
 			_cairo_so = ctypes.CDLL ("libcairo.so.2")
 
+			_cairo_so.cairo_ft_font_face_create_for_ft_face.restype = ctypes.c_void_p
+			_cairo_so.cairo_ft_font_face_create_for_ft_face.argtypes = [ ctypes.c_void_p, ctypes.c_int ]
+			_cairo_so.cairo_set_font_face.argtypes = [ ctypes.c_void_p, ctypes.c_void_p ]
+			_cairo_so.cairo_font_face_status.argtypes = [ ctypes.c_void_p ]
+			_cairo_so.cairo_status.argtypes = [ ctypes.c_void_p ]
+
 			# initialize freetype
 			_ft_lib = ctypes.c_void_p ()
 			if FT_Err_Ok != _freetype_so.FT_Init_FreeType (ctypes.byref (_ft_lib)):
@@ -45,22 +51,18 @@ The resulting cairo font face however can be used normally with pycairo.
 		ft_face = ctypes.c_void_p()
 		cairo_ctx = cairo.Context (_surface)
 		cairo_t = PycairoContext.from_address(id(cairo_ctx)).ctx
+
 		if FT_Err_Ok != _freetype_so.FT_New_Face (_ft_lib, filename, faceindex, ctypes.byref(ft_face)):
-			raise "Error creating FreeType font face for " + filename
+			raise Exception("Error creating FreeType font face for " + filename)
 
 		# create cairo font face for freetype face
-		_cairo_so.cairo_ft_font_face_create_for_ft_face.restype = ctypes.c_void_p
-		_cairo_so.cairo_ft_font_face_create_for_ft_face.argtypes = [ ctypes.c_void_p, ctypes.c_int ]
 		cr_face = _cairo_so.cairo_ft_font_face_create_for_ft_face (ft_face, loadoptions)
 		if CAIRO_STATUS_SUCCESS != _cairo_so.cairo_font_face_status (cr_face):
-			raise "Error creating cairo font face for " + filename
+			raise Exception("Error creating cairo font face for " + filename)
 
-		_cairo_so.cairo_set_font_face.argtypes = [ ctypes.c_void_p, ctypes.c_void_p ]
 		_cairo_so.cairo_set_font_face (cairo_t, cr_face)
-
-		_cairo_so.cairo_status.argtypes = [ ctypes.c_void_p ]
 		if CAIRO_STATUS_SUCCESS != _cairo_so.cairo_status (cairo_t):
-			raise "Error creating cairo font face for " + filename
+			raise Exception("Error creating cairo font face for " + filename)
 
 		face = cairo_ctx.get_font_face ()
 


More information about the cairo-commit mailing list