Kozea / CairoSVG

Convert your vector images
https://courtbouillon.org/cairosvg
GNU Lesser General Public License v3.0
773 stars 151 forks source link

Font overlap #341

Open luoyu-123 opened 3 years ago

luoyu-123 commented 3 years ago

When I use CairoSVG to convert svg to pdf file, the fonts overlap. Is there any way to solve this problem? This is the effect of svg: image This is the effect after converting to a pdf file: image svg compressed file-- 2_1_5.zip

liZe commented 3 years ago

Hello, and thank you for your report.

Could you please share the original SVG file?

luoyu-123 commented 3 years ago

I'm very sorry, I uploaded the wrong file, and I am ashamed of my stupid behavior. This is the svg file and the font package used in it (note: the environment I use is the windows development environment, I don’t know if it is related to this) This is the source file: svgFile.zip Thank you for your help!!

liZe commented 3 years ago

No problem!

I don’t have the problem with your file, here’s what I get: 2_1_5

Your problem is actually the same as Kozea/WeasyPrint#1343. It’s a bug in Cairo that’s already fixed but not released. You’ll find different solutions (downgrade Cairo, apply a patch…) in WeasyPrint’s issue to fix this problem.

luoyu-123 commented 3 years ago

Thank you for your help

luoyu-123 commented 3 years ago

Regarding the problem of font overlap when installing cairosvg in the window environment, I tried the solutions in weasyprint, but none of them worked. For this reason, I tried to reinstall the computer system, but the font overlap problem still appeared. I don’t know how to solve it. This problem

liZe commented 3 years ago

@luoyu-123 Could you please share the generated PDF?

luoyu-123 commented 3 years ago

Thank you very much for your help, this is a pdf file question_PDF_FILE.zip

liZe commented 3 years ago

The problem is not caused by the version of Cairo.

We’ve tried hard to reproduce the problem, but we didn’t manage to get your rendering. The problem happens because the stroke is not displayed at the same place as the fill for characters. We don’t know why, and it’s hard to know as we can’t reproduce.

The name of the file you shared is a bit strange (╙╨╬╩╠Γ╡─pdf.pdf), maybe there’s a problem with some encoding configuration. Do you know the default encoding of your system?

Could you also please share information about your OS, and the version of some libraries: pango, harfbuzz, cairocffi, Python?

luoyu-123 commented 3 years ago

My system default encoding is gbk format。 The picture below is the system-related configuration image The reason why the file name should be in Chinese


The figure below is about the python environment and the version of GTK image image image GTK3 also has this problem, so I am installing GTK2 now. This is the solution I saw in Stack Overflow, but it still didn’t work.

luoyu-123 commented 3 years ago

I don't know if it is because of the Chinese encoding. I have not encountered such problems in the Linux system. But in the window system, I tried 3 windows system computers and encountered this problem, so that the reinstallation of the system did not improve

liZe commented 3 years ago

I’ve tried to find a solution for this problem, but it really looks like a bug in Pango with Windows’ Chinese encoding.

As a last resort, you can try to launch "pango-view" (installed with GTK+) to display Chinese text, and see if you get something wrong. It’s unlikely, because drawing text seems to work (what doesn’t is drawing text outline), but if you get extra spaces, at least you can give Pango devs a simple use case to fix their bug.

If "pango-view" works correctly, then I’m sorry but I really don’t know how to help you :cry:. You could try to talk with Pango devs to find a solution.

luoyu-123 commented 3 years ago

Thank you very much for your kind help Best wishes!

liZe commented 3 years ago

Did you try pango-views on your Windows computer?

luoyu-123 commented 3 years ago

Hello, it seems that there is a problem when installing pango. I cannot use the pango-view command on the command line (I have installed GTK related dependencies). I am still looking for related solutions.I am using these things for the first time,。if offend, please forgive my stupidity

liZe commented 3 years ago

No problem, take your time.

(And you’re not stupid!)