claudep / swiss-qr-bill

A Python library to generate Swiss QR-bill payment slips
MIT License
97 stars 39 forks source link

Font-Weight on Windows PC (distinction between titles and body) #91

Open BildKomGit opened 1 year ago

BildKomGit commented 1 year ago

Only Arial Regular FontWeight Windows

Hello I am trying to solve a problem which is not severe since all information is properly put on the bill and any payment transaction will work nevertheless. Either "Arial bold" or "Arial regular" is used for all text on my bill. In version 1.0.0 titles titles are set in "Arial Bold" and body text in "Arial Regular" - not at the moment with my bills on my Windows PC.

Here is what I tried. I am using the new version from Claude which he kindly prepared for me. He added font_family = 'Arial,Helvetica' which solved my problem with Croatian letters (see screenshot). Arial.ttf is installed and works without problems. Changing the font size works also on all styles.

On the screenshot of my code you see that I have set all other types of text to "Arial Bold" (line 392, 397, 401). Nevertheless the drawing is completely without any bold. Whathever I do, the setting on line 388 defines all font weight on my bills. I had been experimenting with ("font_style": "regular"/"normal") and "font_weight" : 400 (for regular) and 700 for bold ... no positive result. I can decide (on line 388) whether all font shall be set in bold or regular.

I googled and in my opinion svgdraw expects these kind of parameters in the form Claude put it. I believe something is overwriting this setting, thought. But this goes beyond my programming skills. Maybe somebody has an answer to my little problem. Have a nice weekend, Patrik.

bigbenhur commented 1 week ago

Hi @BildKomGit

I have the same issue, but only the png is affected: When I open the svg (e.g. in firefox) there is bold and normal text. Only after conversion to png (using the reportlab method suggested on the main qrbill github page) there is only bold text. Using another conversion method (e.g. inkscape) produces a perfect png with bold and normal text.

Hope this helps!