Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Malformed SVG output when rendering text with spaces #385

Open
rightbrace opened this issue Sep 22, 2024 · 0 comments
Open

Malformed SVG output when rendering text with spaces #385

rightbrace opened this issue Sep 22, 2024 · 0 comments

Comments

@rightbrace
Copy link

rightbrace commented Sep 22, 2024

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">
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant