Author: jordi
Date: 2006-05-23 05:22:30 -0400 (Tue, 23 May 2006)
New Revision: 60981

Modified:
   trunk/libgdiplus/src/ChangeLog
   trunk/libgdiplus/src/font.c
   trunk/libgdiplus/src/gdip.h
Log:
2006-05-23 Jordi Mas i Hernandez  <[EMAIL PROTECTED]>
        
        * font.c:  removes libgdiplus dependency against Cairo 
        _cairo_toy_font_face_create API function. Change to make 
        Cairo 1.2 linkable with libgdiplus.



Modified: trunk/libgdiplus/src/ChangeLog
===================================================================
--- trunk/libgdiplus/src/ChangeLog      2006-05-23 09:16:48 UTC (rev 60980)
+++ trunk/libgdiplus/src/ChangeLog      2006-05-23 09:22:30 UTC (rev 60981)
@@ -1,3 +1,9 @@
+2006-05-23 Jordi Mas i Hernandez  <[EMAIL PROTECTED]>
+       
+       * font.c:  removes libgdiplus dependency against Cairo 
+       _cairo_toy_font_face_create API function. Change to make 
+       Cairo 1.2 linkable with libgdiplus.
+
 2006-05-22 Gonzalo Paniagua Javier <[EMAIL PROTECTED]>
 
        * gifcodec.c: null terminate the byte array passed to

Modified: trunk/libgdiplus/src/font.c
===================================================================
--- trunk/libgdiplus/src/font.c 2006-05-23 09:16:48 UTC (rev 60980)
+++ trunk/libgdiplus/src/font.c 2006-05-23 09:22:30 UTC (rev 60981)
@@ -37,12 +37,7 @@
 static int ref_familySansSerif = 0;
 static int ref_familyMonospace = 0;
 
-extern cairo_font_face_t *
-_cairo_toy_font_face_create (const char *family, 
-                            cairo_font_slant_t   slant, 
-                            cairo_font_weight_t  weight);
 
-
 /* Family and collections font functions */
 
 void
@@ -558,7 +553,24 @@
 }
 
 /* Font functions */
+cairo_font_face_t *
+gdip_face_create (const char *family, 
+                       cairo_font_slant_t   slant, 
+                       cairo_font_weight_t  weight,
+                       cairo_t** ct)
+{
+       cairo_surface_t *surface;
+       cairo_font_face_t *face;
 
+       surface = cairo_image_surface_create_for_data ((unsigned char *)NULL, 
CAIRO_FORMAT_ARGB32, 0, 0, 0);
+       *ct = cairo_create (surface);
+       cairo_select_font_face (*ct, (const char *) family, slant, weight);
+       face = cairo_get_font_face (*ct);
+       cairo_surface_destroy (surface);
+       return face;
+
+}
+
 GpStatus
 GdipCreateFont (GDIPCONST GpFontFamily* family, float emSize, GpFontStyle 
style, Unit unit,  GpFont **font)
 {
@@ -590,7 +602,7 @@
        else
                slant = CAIRO_FONT_SLANT_NORMAL;
 
-       cairofnt = _cairo_toy_font_face_create ((const char*) str, slant, 
weight);
+       cairofnt = gdip_face_create ((const char*) str, slant, weight, 
&result->ct);
 
        if (cairofnt == NULL) {
                GdipFree(result);
@@ -632,7 +644,8 @@
        if (!font)
                return InvalidParameter;
 
-       cairo_font_face_destroy (font->cairofnt);
+       cairo_destroy (font->ct);
+
        GdipFree ((void *)font->face);
        GdipFree ((void *)font);
        return Ok;             
@@ -753,7 +766,7 @@
 
        memcpy(result->face, src_font->face, strlen((char *)src_font->face) + 
1);
 
-       result->cairofnt = _cairo_toy_font_face_create ((const char*) 
src_font->face, slant, weight);
+       result->cairofnt = gdip_face_create ((const char*) src_font->face, 
slant, weight, &result->ct);
 
        if (result->cairofnt == NULL) {
                GdipFree(result);
@@ -841,7 +854,7 @@
                result->face[LF_FACESIZE - 1] = '\0';
        }
 
-       result->cairofnt = _cairo_toy_font_face_create ((const char 
*)result->face, slant, weight);
+       result->cairofnt = gdip_face_create ((const char *)result->face, slant, 
weight, &result->ct);
        if (result->cairofnt == NULL) {
                GdipFree(result);
                return GenericError;

Modified: trunk/libgdiplus/src/gdip.h
===================================================================
--- trunk/libgdiplus/src/gdip.h 2006-05-23 09:16:48 UTC (rev 60980)
+++ trunk/libgdiplus/src/gdip.h 2006-05-23 09:22:30 UTC (rev 60981)
@@ -890,6 +890,7 @@
        GpFontFamily        *family;
        float               emSize;
        GpUnit              unit;
+       cairo_t*            ct;
 } GpFont;
 
 

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to