import resvg_py import arabic_reshaper from bidi.algorithm import get_display import base64 with open('/workspace/personal/dashboards/VPN_chanel/backend/app/static/fonts/Vazirmatn-Bold.ttf', 'rb') as f: font_b64 = base64.b64encode(f.read()).decode('utf-8') text_farsi = get_display(arabic_reshaper.reshape("ارتقای لول کارها با هوش مصنوعی")) price_farsi = get_display(arabic_reshaper.reshape("تخفیف ویژه: ۶۰۰,۰۰۰ تومان")) svg = f''' {text_farsi} {price_farsi} ''' png_bytes = resvg_py.svg_to_bytes(svg) with open('/tmp/test_resvg_farsi.png', 'wb') as f: f.write(png_bytes) print("Rendered PNG, size:", len(png_bytes))