Cairo.jl icon indicating copy to clipboard operation
Cairo.jl copied to clipboard

Text is getting clipped on top with latest Cairo_jll

Open mwlidar opened this issue 1 year ago • 0 comments

With the latest version Cairo some annoying problems with fonts or ReadOnlyMemory errors are gone, but unfortunately I now get the following clipping of pango generated text on the top:

pango_clip_MWE_latest

Reverting Cairo_jll from 1.18.2 to 1.16.1 gives the proper behavior again:

pango_clip_MWE

This was generated in a fresh environment were only Cairo was added.

The code for this MWE is as follows:

using Cairo
using Printf

c = CairoRGBSurface(256,256);
cr = CairoContext(c);

Cairo.save(cr);
set_source_rgb(cr, 0.8, 0.8, 0.8);    # light gray
rectangle(cr, 0.0, 0.0, 256.0, 256.0); # background
fill(cr);
restore(cr);

Cairo.save(cr);

set_font_face(cr, "Sans 11")
steps = 60.0:16.25:240
for py in steps
    @printf("%04.17f 1234567890\n", py)
    text(cr, 16.0, py, @sprintf("%04.17f", py))
end

restore(cr);
move_to(cr,0.0,12.0);
set_source_rgb(cr, 0,0,0);
show_text(cr, Libc.strftime(time()));
write_to_png(c, "pango_clip_MWE.png")"""

This behavior does not depend on font type or size.

This is on Windows with Julia 1.10.5

I have not test so far if reverting to the old Cairo_jll produces other issues...

mwlidar avatar Oct 18 '24 15:10 mwlidar