[GRASS-dev] cairo: nothing in resulting ps file

Hello,

I just build grass --with-cairo, but when I try to create postscript, pdf or svg output, I only get empty files.

I'm on debian etch using the libcairo2 & libcairo2-dev 1.2.4-4 packages.

Is this a problem with my cairo implementation or is it a problem in the cairo driver ?

Moritz

Hi,

2008/2/7, Moritz Lennert <mlennert@club.worldonline.be>:

I just build grass --with-cairo, but when I try to create postscript,
pdf or svg output, I only get empty files.

I'm on debian etch using the libcairo2 & libcairo2-dev 1.2.4-4 packages.

Is this a problem with my cairo implementation or is it a problem in the
cairo driver ?

I tried some example from [1], seems to work here (png,pdf,ps). Debian
Sid (libcairo2 1.4.14).

d.mon x0
d.rast map=elevation.10m
d.vect map=streams width=1 color=blue fcolor=aqua type=area,line
d.vect map=roads width=2

d.out.file -c sf_cairo format=png size=800,800
d.out.file -c sf_cairo format=pdf size=800,800
d.out.file -c sf_cairo format=ps size=800,800

Martin

[1] http://grass.gdf-hannover.de/wiki/Cairo_driver

--
Martin Landa <landa.martin@gmail.com> * http://gama.fsv.cvut.cz/~landa *

Martin Landa wrote:

Hi,

2008/2/7, Moritz Lennert <mlennert@club.worldonline.be>:

I just build grass --with-cairo, but when I try to create postscript,
pdf or svg output, I only get empty files.

I'm on debian etch using the libcairo2 & libcairo2-dev 1.2.4-4 packages.

Is this a problem with my cairo implementation or is it a problem in the
cairo driver ?

I tried some example from [1], seems to work here (png,pdf,ps). Debian
Sid (libcairo2 1.4.14).

d.mon x0
d.rast map=elevation.10m
d.vect map=streams width=1 color=blue fcolor=aqua type=area,line
d.vect map=roads width=2

d.out.file -c sf_cairo format=png size=800,800
d.out.file -c sf_cairo format=pdf size=800,800
d.out.file -c sf_cairo format=ps size=800,800

Martin

[1] http://grass.gdf-hannover.de/wiki/Cairo_driver

I built the current version from SVN and tried some (fairly simple) things on my system, and it worked for me as well.

I'm using Cairo 1.4.12.

One thing you may want to double-check is that your cairo libs were built with support for these formats. Check cairo-features.h (probably in /usr/include/cairo/) and look for lines like:

#define CAIRO_HAS_SVG_SURFACE 1
#define CAIRO_HAS_PDF_SURFACE 1
#define CAIRO_HAS_PS_SURFACE 1

There are checks in lib/cairodriver/Graph.c for this. You should get an error message if cairo lacks support for a specific format, though.

/ Lars

--
Lars Ahlzen
lars@ahlzen.com

On 07/02/08 18:35, Martin Landa wrote:

Hi,

2008/2/7, Moritz Lennert <mlennert@club.worldonline.be>:

I just build grass --with-cairo, but when I try to create postscript,
pdf or svg output, I only get empty files.

I'm on debian etch using the libcairo2 & libcairo2-dev 1.2.4-4 packages.

Is this a problem with my cairo implementation or is it a problem in the
cairo driver ?

I tried some example from [1], seems to work here (png,pdf,ps). Debian
Sid (libcairo2 1.4.14).

d.mon x0
d.rast map=elevation.10m
d.vect map=streams width=1 color=blue fcolor=aqua type=area,line
d.vect map=roads width=2

[...]

d.out.file -c sf_cairo format=ps size=800,800

all I get as resulting ps file is this:

%!PS-Adobe-3.0
%%Creator: cairo (http://cairographics.org)
%%CreationDate: Fri Feb 8 09:41:26 2008
%%Pages: 0
%%BoundingBox: 0 0 800 800
%%DocumentData: Clean7Bit
%%LanguageLevel: 2
%%EndComments
%%BeginProlog
/C{curveto}bind def
/F{fill}bind def
/G{setgray}bind def
/L{lineto}bind def
/M{moveto}bind def
/P{closepath}bind def
/R{setrgbcolor}bind def
/S{show}bind def
%%EndProlog
% _cairo_ps_surface_emit_font_subsets
%%Trailer
%%EOF

Same if I use GRASS_CAIROFILE=map.ps and d.mon start=cairo.

With format=png or GRASS_CAIROFILE=map.png I get a nice png file just as expected.

On 07/02/08 22:25, Lars Ahlzen wrote:
>
> One thing you may want to double-check is that your cairo libs were
> built with support for these formats. Check cairo-features.h (probably
> in /usr/include/cairo/) and look for lines like:
>
> #define CAIRO_HAS_SVG_SURFACE 1
> #define CAIRO_HAS_PDF_SURFACE 1
> #define CAIRO_HAS_PS_SURFACE 1

these are all set to 1

>
> There are checks in lib/cairodriver/Graph.c for this. You should get an
> error message if cairo lacks support for a specific format, though.

I can see no error message.

Any hints ?

Moritz

On 08/02/08 09:56, Moritz Lennert wrote:

On 07/02/08 18:35, Martin Landa wrote:

Hi,

2008/2/7, Moritz Lennert <mlennert@club.worldonline.be>:

I just build grass --with-cairo, but when I try to create postscript,
pdf or svg output, I only get empty files.

I'm on debian etch using the libcairo2 & libcairo2-dev 1.2.4-4 packages.

Is this a problem with my cairo implementation or is it a problem in the
cairo driver ?

I tried some example from [1], seems to work here (png,pdf,ps). Debian
Sid (libcairo2 1.4.14).

d.mon x0
d.rast map=elevation.10m
d.vect map=streams width=1 color=blue fcolor=aqua type=area,line
d.vect map=roads width=2

[...]

d.out.file -c sf_cairo format=ps size=800,800

all I get as resulting ps file is this:

%!PS-Adobe-3.0
%%Creator: cairo (http://cairographics.org)
%%CreationDate: Fri Feb 8 09:41:26 2008
%%Pages: 0
%%BoundingBox: 0 0 800 800
%%DocumentData: Clean7Bit
%%LanguageLevel: 2
%%EndComments
%%BeginProlog
/C{curveto}bind def
/F{fill}bind def
/G{setgray}bind def
/L{lineto}bind def
/M{moveto}bind def
/P{closepath}bind def
/R{setrgbcolor}bind def
/S{show}bind def
%%EndProlog
% _cairo_ps_surface_emit_font_subsets
%%Trailer
%%EOF

Same if I use GRASS_CAIROFILE=map.ps and d.mon start=cairo.

With format=png or GRASS_CAIROFILE=map.png I get a nice png file just as expected.

On 07/02/08 22:25, Lars Ahlzen wrote:
>
> One thing you may want to double-check is that your cairo libs were
> built with support for these formats. Check cairo-features.h (probably
> in /usr/include/cairo/) and look for lines like:
>
> #define CAIRO_HAS_SVG_SURFACE 1
> #define CAIRO_HAS_PDF_SURFACE 1
> #define CAIRO_HAS_PS_SURFACE 1

these are all set to 1

>
> There are checks in lib/cairodriver/Graph.c for this. You should get an
> error message if cairo lacks support for a specific format, though.

I can see no error message.

Any hints ?

It was as simple as compiling libcairo2 1.4.14...
Now it works !

Maybe we should add a hint somewhere ?

Moritz

Moritz Lennert wrote:

>>> I just build grass --with-cairo, but when I try to create
>>>> postscript, pdf or svg output, I only get empty files.
>>>
>>> I'm on debian etch using the libcairo2 & libcairo2-dev 1.2.4-4
>>> packages.
>>>
>>> Is this a problem with my cairo implementation or is it a problem
>>> in the cairo driver ?

...

> all I get as resulting ps file is this:
>
> %!PS-Adobe-3.0
> %%Creator: cairo (http://cairographics.org)
> %%CreationDate: Fri Feb 8 09:41:26 2008
> %%Pages: 0
> %%BoundingBox: 0 0 800 800
> %%DocumentData: Clean7Bit
> %%LanguageLevel: 2
> %%EndComments
> %%BeginProlog
> /C{curveto}bind def
> /F{fill}bind def
> /G{setgray}bind def
> /L{lineto}bind def
> /M{moveto}bind def
> /P{closepath}bind def
> /R{setrgbcolor}bind def
> /S{show}bind def
> %%EndProlog
> % _cairo_ps_surface_emit_font_subsets
> %%Trailer
> %%EOF
>

...

It was as simple as compiling libcairo2 1.4.14...
Now it works !

see also previous discussion from late November:
  http://thread.gmane.org/gmane.comp.gis.grass.devel/23511/focus=23595

Hamish

      ____________________________________________________________________________________
Be a better friend, newshound, and
know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ

On 08/02/08 12:06, Hamish wrote:

Moritz Lennert wrote:

I just build grass --with-cairo, but when I try to create

postscript, pdf or svg output, I only get empty files.

I'm on debian etch using the libcairo2 & libcairo2-dev 1.2.4-4 packages.

Is this a problem with my cairo implementation or is it a problem
in the cairo driver ?

...

all I get as resulting ps file is this:

%!PS-Adobe-3.0
%%Creator: cairo (http://cairographics.org)
%%CreationDate: Fri Feb 8 09:41:26 2008
%%Pages: 0
%%BoundingBox: 0 0 800 800
%%DocumentData: Clean7Bit
%%LanguageLevel: 2
%%EndComments
%%BeginProlog
/C{curveto}bind def
/F{fill}bind def
/G{setgray}bind def
/L{lineto}bind def
/M{moveto}bind def
/P{closepath}bind def
/R{setrgbcolor}bind def
/S{show}bind def
%%EndProlog
% _cairo_ps_surface_emit_font_subsets
%%Trailer
%%EOF

...

It was as simple as compiling libcairo2 1.4.14...
Now it works !

see also previous discussion from late November:
  http://thread.gmane.org/gmane.comp.gis.grass.devel/23511/focus=23595

Yep, that's the same problem as Debian stable does not have 1.4.14, yet, not even in backports. But it's not a big issue to compile it, as it does not have any fancy build-deps and so it's enough to get the cairo source package (http://packages.debian.org/source/testing/cairo), apply the patches and run dpkg-buildpackage.

M