import urllib.request
import os

def download_font():
    url = "https://cdn.jsdelivr.net/npm/dejavu-fonts-ttf@2.37/ttf/DejaVuSans.ttf"
    current_dir = os.path.dirname(os.path.abspath(__file__))
    dest = os.path.join(current_dir, "invoices", "DejaVuSans.ttf")
    
    print(f"Downloading font from {url}...")
    print(f"Destination: {dest}")
    
    os.makedirs(os.path.dirname(dest), exist_ok=True)
    
    urllib.request.urlretrieve(url, dest)
    print("Font download complete successfully!")

if __name__ == "__main__":
    download_font()
