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

SVG example fails because expected fonts are missing from OS #2

Open
villares opened this issue Dec 12, 2022 · 0 comments
Open

SVG example fails because expected fonts are missing from OS #2

villares opened this issue Dec 12, 2022 · 0 comments

Comments

@villares
Copy link

I'm on Manjaro Linux and I think I don't have Arial or Helvetica.

Running this example:

import pero

# init size
width = 200
height = 200

# init canvas
canvas = pero.svg.SVGCanvas(width=width, height=height)

# draw graphics
canvas.line_color = "b"
canvas.fill_color = "w"
canvas.fill()
canvas.draw_circle(100, 100, 75)

# save to file
with open('test.svg', 'w', encoding='utf-8') as f:
    f.write(canvas.get_xml())

I get the following error:

Traceback (most recent call last):
  File "/home/villares/GitHub/sketch-a-day/2022/sketch_2022_12_12/sketch_2022_12_12.py", line 9, in <module>
    canvas = pero.svg.SVGCanvas(width=width, height=height)
  File "/home/villares/.local/lib/python3.10/site-packages/pero/backends/svg/canvas.py", line 56, in __init__
    self._update_text()
  File "/home/villares/.local/lib/python3.10/site-packages/pero/backends/svg/canvas.py", line 723, in _update_text
    font = self.get_font()
  File "/home/villares/.local/lib/python3.10/site-packages/pero/drawing/canvas.py", line 366, in get_font
    raise ValueError(message)
ValueError: Cannot initialize the font! -> Arial, arial, Arial, Helvetica
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