Ask coding questions

← Back to all posts
Download the roboto truefont from github.
Yoplayer1py (5)

Hi guys;
I was testing image overlay for my discord bot but when I run the function test_2() it shows that roboto truefont ttf file was not found:

Traceback (most recent call last):
  File "main.py", line 21, in <module>
    test_2()
  File "main.py", line 14, in test_2
    font = ImageFont.truetype('Roboto-Bold.ttf', size=45)
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/PIL/ImageFont.py", line 853, in truetype
    return freetype(font)
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/PIL/ImageFont.py", line 850, in freetype
    return FreeTypeFont(font, size, index, encoding, layout_engine)
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/PIL/ImageFont.py", line 209, in __init__
    self.font = core.getfont(
OSError: cannot open resource

so when I clone it from GitHub using : git clone https://github.com/google/fonts/tree/main/apache/roboto

it shows:

tree/main/apache/roboto
Cloning into 'roboto'...
fatal: repository 'https://github.com/google/fonts/tree/main/apache/roboto/' not found

So if I want to download it do I need to copy and paste all file contents?

Thanks in advance!