hi guys...<br>
<br>
I m trying to print text to a PostScript (PS) file using Cairo...<br>
<br>
I get the prog to complie and run with out errors...<br>
<br>
But the PS file obtained doesnot contain any text ...<br>
<br>
Here goes the code tell me where i m going wrong...<br>
//----------------------------Basket.c----------------------------------------------<br>
<br>
#include <cairo.h><br>
#include <cairo-ps.h><br>
#include <math.h><br>
<br>
void<br>
draw (cairo_t *cr);<br>
<br>
#define X_INCHES 8<br>
#define Y_INCHES 3<br>
<br>
#define FILENAME "<a href="http://basket.ps">basket.ps</a>"<br>
<br>
int<br>
main (void)<br>
{<br>
cairo_surface_t *surface;<br>
cairo_t *cr;<br>
FILE *file;<br>
<br>
file = fopen (FILENAME, "w");<br>
if (file == NULL) {<br>
fprintf (stderr, "Failed to open file %s for writing.\n", FILENAME);<br>
return 1;<br>
}<br>
<br>
surface = cairo_ps_surface_create (FILENAME,<br>
X_INCHES * 72.0,<br>
Y_INCHES *
72.0);<br>
<br>
cr = cairo_create (surface);<br>
cairo_surface_destroy(surface);<br>
<br>
draw (cr);<br>
cairo_show_page (cr);<br>
<br>
cairo_destroy (cr);<br>
<br>
fclose (file);<br>
<br>
return 0;<br>
}<br>
<br>
void<br>
draw (cairo_t *cr)<br>
{<br>
<br>
cairo_select_font_face (cr, "Sans", CAIRO_FONT_SLANT_NORMAL,<br>
CAIRO_FONT_WEIGHT_BOLD);<br>
cairo_set_font_size(cr,72) ;<br>
cairo_set_source_rgb(cr,0,0,0) ;<br>
cairo_move_to(cr,20,100) ;<br>
cairo_show_text(cr,"Hello world !") ;<br>
}<br>
//-------------------------------------------------end of basket.c-----------------------------------------<br>
<br>
<br>
Just in case , if someone wants to know.....<br>
The Makefile I use to compile looks like....<br>
<br>
EXAMPLES=basket<br>
<br>
# I'd like to put a bunch of compiler-specific warning flags here, but<br>
# I don't know a good way to choose the right flags based on the<br>
# compiler in use.<br>
#<br>
# So, for now, if you want more warnings, set them in CFLAGS before<br>
# calling make. For example, for gcc:<br>
#<br>
# CFLAGS="-Wall -Wpointer-arith -Wstrict-prototypes
-Wmissing-prototypes -Wmissing-declarations -Wnested-externs
-fno-strict-aliasing" make<br>
<br>
MYCFLAGS=`pkg-config --cflags cairo libpng12`<br>
MYLDFLAGS=`pkg-config --libs cairo libpng12`<br>
<br>
all: ${EXAMPLES}<br>
<br>
%.o: %.c<br>
$(CC) -c $(CFLAGS) $(CPPFLAGS) ${MYCFLAGS} $< -o $@<br>
<br>
%: %.c<br>
$(CC) $(CFLAGS) $(CPPFLAGS) ${MYCFLAGS} ${MYLDFLAGS} $^ -o $@<br>
<br>
clean:<br>
rm -f ${EXAMPLES} *.o<br>
<br>
<br>
pls reply ...<br>
<br>
regards <br>
rush<br>
<br>