Skip to content

Malformed SVG output when rendering text with spaces #385

@rightbrace

Description

@rightbrace

I noticed this while using PangoCairo, but I was able to reproduce it using Cairo alone:

import cairo 
with cairo.SVGSurface("output.svg", 700, 700) as surface: 
    context = cairo.Context(surface) 
    context.set_source_rgb(0, 0, 0) 
    context.set_font_size(25) 
    context.select_font_face("Arial", cairo.FONT_SLANT_NORMAL, cairo.FONT_WEIGHT_NORMAL) 
    context.show_text("hello_world") # works
    context.show_text("hello world") # does not work

When there is a space in the string, the SVG is malformed, and contains the line:

<image id="source-6" x="0" y="0" width="0" height="0" xlink:href="data:image/png;base64,<mask id="mask-0">

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions