[cairo] Cairo 1.2 and pdf text - Help !!

Umberto Allievi uallievi at iol.it
Wed Jul 12 03:33:09 PDT 2006


Please, can someone tell me why the svg file generated is correct but
the pdf file is not (no text generated)?

The code was compiled on fedora core 5 with cairo 1.2 :

//-----------------------------------------------------------------
#include <cairo.h>
#include <cairo-pdf.h>
#include <cairo-svg.h>

void draw(cairo_surface_t *pSurf);

int main()
{
        int width=1024;
        int height=1024;
        cairo_surface_t *pPdfSurf =
cairo_pdf_surface_create("test.pdf",width,height);
        draw(pPdfSurf);
        cairo_surface_destroy(pPdfSurf);

        cairo_surface_t *pSvgSurf =
cairo_svg_surface_create("test.svg",width,height);
        draw(pSvgSurf);
        cairo_surface_destroy(pSvgSurf);

        return 0;
}

void draw(cairo_surface_t *pSurf)
{
    cairo_t *pCr = cairo_create(pSurf);  

        cairo_select_font_face (pCr,"Bitstream Vera Serif",
CAIRO_FONT_SLANT_NORMAL,
                                      CAIRO_FONT_WEIGHT_NORMAL);        
    cairo_set_source_rgb (pCr, 0,0,0);
    cairo_move_to (pCr, 0, 0);
    cairo_line_to (pCr, 40, 60);
    cairo_set_font_size (pCr,40);
    cairo_show_text (pCr,"Hello World");
        cairo_stroke(pCr);

    cairo_show_page (pCr);
        cairo_destroy(pCr);
}
//-----------------------------------------------------------------

Thanks, Umberto Allievi





More information about the cairo mailing list