deeplook / svglib

Read SVG files and convert them to other formats.
GNU Lesser General Public License v3.0
322 stars 79 forks source link

Unable to find a suitable font #284

Closed luoyu-123 closed 3 years ago

luoyu-123 commented 3 years ago

How to solve the problem of reporting an error while reading the svg and creating a drawing object

屏幕截图_6 code: from svglib.svglib import svg2rlg

from reportlab.graphics import renderPDF

drawing = svg2rlg("test.svg") print(drawing)

renderPDF.drawToFile(dr

awing, "22.pdf")

file: test.zip

dcarbone commented 3 years ago

Looks to me like you're missing a font pack.

https://docs.microsoft.com/en-us/typography/font-list/fangsong

Try installing that font pack, see if it works.

victorbnl commented 3 years ago

I think this issue should be renamed "Unable to find a suitable font"

claudep commented 3 years ago

I guess this is more of a usage issue, not really actionable.

rocketinventor commented 1 year ago

Is there a way to suppress these errors?

deeplook commented 1 year ago

This should do it on the command-line:

python -W ignore::SomeWarningCategory script.py
python -W ignore::Warning script.py              # supress all warnings

and in code:

import warnings

with warnings.catch_warnings():
    warnings.filterwarnings("ignore", category=SomeWarningCategory)
    # Code that generates the warning