[cairo] text failing to display on SVG and X11 surface even though it works correctly on PDF and PS surfaces

Antony Lee antony.lee at berkeley.edu
Fri Nov 3 17:17:29 UTC 2017


Hi all,

I have an issue of text failing to be displayed onto a SVG surface.  I have
uploaded a cairo-script to
https://gist.github.com/anntzer/f8ac09399b3752574a90dc328afc0e19; the
script is quite large because of the font (DejaVu) definition embedded.
Stripping the font definition yields

    %!CairoScript
    << /content //COLOR_ALPHA /width 460 /height 345 /fallback-resolution
[100 100] >> surface context
    1 g set-source
    paint
    //ALPHA [] record
    dup /s6 exch def dup context
    [12 0 0 12 0 0] set-font-matrix
    << /type 42 /index 0 /flags 32 /source < ... > >> font dup /f0 exch def
set-font-face /scaled-font get /sf0 exch def
    [0 7 <~6i~>] show-glyphs
    pop pattern
    [1 0 0 1 -227.4 -9.312] set-matrix
    set-source
    paint
    pop

where the ellipsis stand for the binary font definition.

Replaying the script with csi-replay (cairo 1.14.10), patched to output the
results to a file

    {
    -    return cairo_pdf_surface_create_for_stream (NULL, NULL, width,
height);
    +    return cairo_pdf_surface_create("/tmp/out.pdf", width, height);
    }

(and similarly for ps and svg) shows that the pdf and ps surfaces
(correctly) create a file that displays a single letter "a" on the surface,
but the svg surface creates a file that displays nothing.  Although I can't
showcase the issue as easily on other surfaces, my tests indicate that the
text is also correctly displayed by the image surface, and also missing
when using the X11 surface.

As some side notes: 1) It may be worth documenting somewhere (e.g.
util/cairo-script/README) that the way to build csi-replay is `make
csi-replay`; this took me a while to realize.  2) It may be worth
supporting output to a file from csi-replay, in the manner of the patch I
used (but either with proper integration to the command line, or perhaps
just outputting to $pid.pdf).

Any help would be welcome.  Thanks!

Antony Lee
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.cairographics.org/archives/cairo/attachments/20171103/5ee8a8bf/attachment.html>


More information about the cairo mailing list