[cairo] problems with text rendering, 1.6.4

Adrian Johnson ajohnson at redneon.com
Tue May 13 06:42:12 PDT 2008


Tamas K Papp wrote:
> On Mon, Apr 21, 2008 at 08:47:46PM -0400, Behdad Esfahbod wrote:
>> On Mon, 2008-04-21 at 20:32 -0400, Tamas K Papp wrote:
>>> I can provide the example code that generated these (it is in Lisp,
>>> but maps into C commands straightforwardly).
>> If you can, then just straight do.  We don't read minds!
> 
> Sorry, here it is.  It just uses the simple text functions.  In the
> functions below, *context* is the default context.

The PostScript output contains only fallback images. It looks like there 
is a bug causing text in the fallback images to be too small. I am 
unable to reproduce the bug and without a C test case to reproduce the 
bug it is unlikely that I can fix the problem.

A work around for the bug is to change the code to avoid the image 
fallbacks. This will also result in smaller, higher quality PostScript 
that prints faster.

> (defun mark-at (x y d red green blue)
>   "Make a rectangle of size 2d around x y with the given colors,
>   50% alpha.  Used for marking points."
>   (rectangle (- x d) (- y d) (* 2 d) (* 2 d))
>   (set-source-rgba red green blue 0.5)
>   (fill-path))

The cause of the image fallbacks is the use of translucent colors. If 
you use only opaque colors you will get all vector output.

> ;; white background
> (set-source-rgb 1 1 1)
> (paint)

It is not necessary to paint the background white when generating PS 
output. The PS backend will flatten transparent objects when there is 
nothing printed underneath. By painting the background white you are 
preventing this flattening from occurring.




More information about the cairo mailing list