-
Notifications
You must be signed in to change notification settings - Fork 86
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
Text has green outline when saved to PNG file #355
Comments
This looks like it is very probably an upstream cairo issue. If you can port the program to C and cairo, you can check this - this sort of porting is one thing that LLMs can be quite good at. |
You're right, exact same issue occurs with equivalent c code: #include <cairo.h>
int main (int argc, char *argv[]) {
cairo_surface_t *surface;
cairo_t *cr;
surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, 256, 256);
cr = cairo_create (surface);
cairo_move_to(cr, 2, 210);
cairo_set_source_rgb (cr, 1, 1, 1);
cairo_set_font_size(cr, 20);
cairo_show_text(cr, "12");
cairo_move_to(cr, 100, 210);
cairo_set_font_size(cr, 100);
cairo_show_text(cr, "12");
cairo_set_line_width (cr, 0.1);
cairo_rectangle (cr, 0.25, 0.25, 0.5, 0.5);
cairo_stroke (cr);
/* Write output and clean up */
cairo_surface_write_to_png (surface, "new.png");
cairo_destroy (cr);
cairo_surface_destroy (surface);
return 0;
} I'll make a bug report here: https://gitlab.freedesktop.org/cairo/cairo |
Nice, post a link to it here when you do to help anyone coming across this in future. It being a font rendering thing the trail may go beyond Cairo and into something like Pango. |
Heh, it would be great to also provide the cross-linking on upstream bug reports. Anyway, Google brought me here and I just added a link to the this ticket to my cairo bug report.
Actually, my guess with these kinds of stuff is always fontconfig or freetype. Pango is not even used here. ;-) Anyway, to quote myself on the upstream issue:
|
Ah, I always get bits of the font rendering stack mixed up. |
Heh, same happens to me. I know at least that Pango and Harfbuzz exist to support complicated scripts (e.g. arabic). They select glyphs based on the input text. Fontconfig and freetype are about loading and rendering fonts. But I am certainly no font expert. |
Version: python-cairo 1.25.1-1
When drawing text, if the text is white there will be a green/yellow/blue outline when saving to png. Only occurs with text, normal drawing is unnaffected. Some examples below:
It doesn't affect the weather symbol thing as that's just normal drawing (arcs and lines)
The code used:
The text was updated successfully, but these errors were encountered: